On dim., Mar 31, 2019 at 6:00 PM, python-list-requ...@python.org wrote:
On Sat, Mar 30, 2019, 5:32 AM Alexey Muranov <alexey.mura...@gmail.com>
wrote:


On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org wrote:
 >
 > There could perhaps be a special case for lambda expressions such
 >  that,
> when they are directly assigned to a variable, Python would use the
 > variable name as the function name. I expect this could be
 >  accomplished by
 > a straightforward transformation of the AST, perhaps even by just
 >  replacing
 > the assignment with a def statement.

If this will happen, that is, if in Python assigning a lambda-defined function to a variable will mutate the function's attributes, or else,
 if is some "random" syntactically-determined cases

     f = ...

 will stop being the same as evaluating the right-hand side and
 assigning the result to "f" variable, it will be a fairly good extra
 reason for me to go away from Python.


Is there a particular reason you don't like this? It's not too different from the syntactic magic Python already employs to support the 0-argument
form of super().

I do not want any magic in a programming language i use, especially if it breaks simple rules.

I do not like 0-argument `super()` either, but at least I do not have to use it. I am suspicious of `__class__` too. But here only identifiers are hacked, not the assignment operator. (I suppose the hack can be unhacked by using your own meta-class with a custom `__prepare__`.)

Neither i like how a function magically turns into a generator if the keyword `yield` appears somewhere within its definition.

Those are the things i don't like the most in Python.

Alexey.


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to