Hacker News new | past | comments | ask | show | jobs | submit login

Just make sure you have for loops that use Python style "for x in alist" syntax rather than C++ style "for i = 0; i < alist.size(); ++i" syntax.



It has

  each i in list: ...
  each i in generator: ...
  each i in 0..9: ... # where 0..9 is a set, but this 
                      # construct is optimized down
                      # to a plain incremental loop
or in case I choose C style:

  each (i = list) ...
  each (i = generator) ...
  each (i = 0..9) ...


Here's my advice about the most important thing Python does:

    >>> if x = y:
      File "<stdin>", line 1
        if x = y:
             ^
    SyntaxError: invalid syntax
Why is this important? Because it's such a damnably subtle bug. But what if people want to do something like if r = get_result(): r.do_something()? Make them write if r with r as get_result(): r.do_something() instead.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: