18 ms·
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.
by lacker 18y ago
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.
- mojuba 18y agoIt 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) ...
- earthboundkid 18y agoHere'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.