On 12 February 2017 at 16:51, Markus Meskanen <markusmeska...@gmail.com> wrote:
>> I will say, though, that you're right that we've over-reacted a bit to
>> the monkeypatching use case. Although maybe that's because no-one can
>> think of many *other* use cases that they'd need the new syntax for
>> :-)

> Hi Paul, I believe at least two other use cases than monkey patching have
> been mentioned already:

My point was that people couldn't think of use cases *they* would need
the syntax for. Personally, I'd never use the new syntax for the 2
examples you gave. I don't know if your examples are from real-world
code, but they feel artificial to me (the callback one less so, but
people have been using callbacks for years without missing this
syntax).

This is just one example of using it to set an instance's variable to
a callback. It's just shorthand for:

>   def select_callback(item_index):
>       ...
>   my_menu.select_callback = select_callback

> This reads much easier

That's personal opinion, and there's a lot of disagreement on this point.

> and saves us from typing the same thing three times
> (see decorators).

That's an objective benefit, sure. I don't think it's major in itself,
but that's just *my* opinion :-) You could of course use a shorter
name for the function, if it matters to you (it doesn't *have* to be
the same as the attribute name).

Anyway, let's wait for a PEP that addresses all of the points raised
in this thread.
Paul
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to