Hi.
It would be great to be able to reverse usage/definition parts in
haskell-way with "where" keyword. Since Python 3 would miss lambda, that
would be extremly useful for creating readable sources.
Usage could be something like:
[color=blue][color=green][color=darkred]
>>> res = [ f(i) for i in objects ] where:
>>> def f(x):
>>> #do something[/color][/color][/color]
or
[color=blue][color=green][color=darkred]
>>> print words[3], words[5] where:
>>> words = input.split()[/color][/color][/color]
- defining variables in "where" block would restrict their visibility to
one expression
- it's more easy to read sources when you know which part you can skip,
compare to
[color=blue][color=green][color=darkred]
>>> def f(x):
>>> #do something
>>> res = [ f(i) for i in objects ][/color][/color][/color]
in this case you read definition of "f" before you know something about
it usage.
It would be great to be able to reverse usage/definition parts in
haskell-way with "where" keyword. Since Python 3 would miss lambda, that
would be extremly useful for creating readable sources.
Usage could be something like:
[color=blue][color=green][color=darkred]
>>> res = [ f(i) for i in objects ] where:
>>> def f(x):
>>> #do something[/color][/color][/color]
or
[color=blue][color=green][color=darkred]
>>> print words[3], words[5] where:
>>> words = input.split()[/color][/color][/color]
- defining variables in "where" block would restrict their visibility to
one expression
- it's more easy to read sources when you know which part you can skip,
compare to
[color=blue][color=green][color=darkred]
>>> def f(x):
>>> #do something
>>> res = [ f(i) for i in objects ][/color][/color][/color]
in this case you read definition of "f" before you know something about
it usage.
Comment