Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Think Python: Is functional programming covered in your book?

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like python due to its capability to support both functional programming and OO. I didn't find any chapter in your book covers functional programming.
 
Allen Downey
Author
Greenhorn
Posts: 28
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main thread through Think Python is from procedural programming to object-oriented programming, so I don't do a lot of functional programming.

I cover a few topics that fall under the general heading of functional programming: there are some examples that pass functions in as parameters, and lots of recursion. I present map, filter and reduce patterns, but we do it using for loops (for good reason, I think, but the style is not as functional as it could be).

Beginners often struggle with recursion, so I present it early (before iteration!) and often.

But I don't present recursive data structures in this book, and I don't think I use lambda to create anonymous functions.

So, no, functional programming is not a focus.

Allen

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic