It's been said, but one more tidbit:

On Sun, Jun 28, 2020 at 10:32 PM Steven D'Aprano <[email protected]>
wrote:

> - the compiler doesn't know what type `a` will have;
> - whether or not it has a `fun` method;
> - whether or not there is a global function `fun`;
> - and whether it takes an argument matching `a`.
>
> So all of that would have to happen at run time. That means that using
> UFCS would make slow code. The interpreter would have to try calling
> `a.fun()`, and if that failed with an AttributeError, it would then try
> `fun(a)` instead.
>

and then it would have to see if fun(a) was successful, as there would be
no way to know if 'a' was indeed a type that fun() could be called on --
AND you'd never know if it did the right thing it if happened not to fail.

if fun() is method of the a object, you know that it will be passed a a
object as it's first parameter (self) -- but stand alone? there is no way
to know that that's the function that's wanted.

-CHB





>
>
>
>
> --
> Steven
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/TGGNWJPMKBYYTENDMGYYV2I5QEBTNJGP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/XPXLN4XYV3PPRZAXCMGAFAU5MCBSQXHT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to