[Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator
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
> 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
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas