Uniform Function Call Syntax (UFCS)
Roy Smith
roy at panix.com
Sun Jun 8 10:59:14 EDT 2014
In article <1dd863ba-09e5-439b-8669-db65f3e999eb at googlegroups.com>,
jongiddy <jongiddy at gmail.com> wrote:
> On Sunday, 8 June 2014 02:27:42 UTC+1, Gregory Ewing wrote:
> >
> > Also it doesn't sit well with Python's "one obvious
> > way to do it" guideline, because it means there are
> > *two* equally obvious ways to call a function.
>
> Actually, one of the best arguments against introducing UFCS is that Python
> currently provides two equivalent ways to check if an instance has an
> attribute: ask-permission using hasattr and ask-forgiveness using
> AttributeError.
>
> On the negative side, these currently equivalent (aside from performance)
> techniques could give different results using UFCS, potentially breaking some
> code.
Why? I assume a language which promoted the global namespace to be in
the attribute search path (which, as far as I can tell, is what we're
talking about here) would implement hasattr and raising AttributeError
in a consistent way.
More information about the Python-list
mailing list