Re:C-style vs. Python-style syntax: which one would you pref...
by lacker on Sunday December 14, 2008 @02:49PM
(#397585)
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.
[ Parent
| on HN ]
Re:C-style vs. Python-style syntax: which one would you pref...
by mojuba on Sunday December 14, 2008 @02:57PM
(#397590)
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) ...
Re:C-style vs. Python-style syntax: which one would you pref...
by earthboundkid on Sunday December 14, 2008 @09:04PM
(#397866)
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.