See also: Heapify

Go back to post Create new comment

RSS Be notified of new comments on this post with the RSS feed for this post.


Since Python 2.5 you can do ternary operations like so:

f() if h() else g()

Dive into Python also gives a good overview of solving it the long way:

Last edited by doug on Sun, 18th Jul 2010 21:24:54

Go back to post

Create a new comment

Go to the top

You can use a restricted version of markdown formatting here. You can use the toolbar above the text field to make this more painless. For more information about markdown please refer to the markdown cheatsheet.

For post: Ternary operator in Python
Your name:
Your email (optional):
Your website (optional):

A preview of your comment:

Powered by Debian, Guinness, and excessive quantities of caffeine and sugar.