Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would write:

  if the_result_of_this_function(on_this_arg) == 10 \
  and this_overly_descriptive_boolean:
      do_stuff()
Indenting the second line of the if statement would, at first glance, indicate that it's part of the block instead. Then again, it depends. If it was the header of a def statement, I would follow the PEP, e.g.

  def __init__(self, width, height,
                     color='black', emphasis=None, highlight=0):
On a side note, I once did the "Art & Logic challenge" [http://www.artlogic.com/] and they use guidelines that apply to several languages, e.g. you would use the same formatting style for C++ and for Python, if at all possible. Much of it flies in the face of PEP 8.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: