Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Thank you very much, that is very interesting and precise, I didn't thought about max() cause my tree is not binary and it takes only 2 argument, also I did not know that I could pass a for as argument! Doing a little research would have saved me a lot of struggle. Commented Dec 5, 2012 at 19:40
  • @Janbure Look at max() doc and you'll see that it has two signatures: a single iterable argument(like this case) or n arguments(so they can be more than 2). You can also specify a keyword only parameter key, just like in sort. Commented Dec 5, 2012 at 20:09
  • @Janbure: That max call uses what's known as a "generator expression". They're really handy for creating an iterable object on the fly. Commented Dec 5, 2012 at 20:16