[Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

Markus Meskanen markusmeskanen at gmail.com
Fri Feb 10 09:00:26 EST 2017

> > I've started working on a PEP for this since most people seem to be for
> it.
> I don't know how you get "most people" -- there's only been a handful of
> responses in the few hours since the original post. And apart from one
> explicit -1, I read most of them as neutral, not in favour.

Yeah I worded that poorly, more like most people didn't turn me down which
I was a bit afraid of.

> I'm one of the neutral parties, perhaps just a tiny bit positive +0, but
> only for the original proposal.
> I am -1000 on allowing arbitrary assignment targets. I believe that the
> cost in readability far outweighs the usefulness of allowing things
> like:
> def mydict[key].attr[-1](arg): ...

Do not worry, I will not propose the advanced method, only dot notation!
That being said, I don't think it's up to the language if someone wants to
write ugly code like that, you can already do way uglier stuff with the
existing features. I don't really see people doing this either:


So why would they if we suddenly introduce this to functions? Anyways
that's not a worry of this to-be PEP.

- Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170210/926ab6f7/attachment.html>

More information about the Python-ideas mailing list