3 ms·
Ah, I see -- this is a really good point, thanks for bringing it up. You're right, one can not arbitrarily increase scope in Python. The most common way I've se
by Locke1689 16y ago
Ah, I see -- this is a really good point, thanks for bringing it up. You're right, one can not arbitrarily increase scope in Python. The most common way I've seen of demarcating this kind of structure is actually using a blank line. For example, the code would instead look more like:
c = create_context()
for foo in foos:
do_something(foo, c)
do_other_thing(foo, c)
accumulate(foos, c)
do_other_stuff
One could also throw the separate stuff into a new function.
- neutronicus 16y agoOne could also throw the separate stuff into a new function. That's the elephant in the room in all of these "my language is more readable" discussions, isn't it?
- euccastro 16y agoTo be fair, that's what Lisp's let is syntactic sugar for, too.
- deleted 16y ago[deleted]