[Python-ideas] Re: Is possible some day add Uniform Function Call Syntax (UFCS) in Python like Dlang?

2020-06-29 Thread Christopher Barker
It's been said, but one more tidbit: On Sun, Jun 28, 2020 at 10:32 PM Steven D'Aprano 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`. >

[Python-ideas] Re: Is possible some day add Uniform Function Call Syntax (UFCS) in Python like Dlang?

2020-06-29 Thread David Mertz
A large number of topics have come up that wish to make Python more "fluent" (https://en.wikipedia.org/wiki/Fluent_interface). This is an example of the same general idea. In every single case, the goal has been almost universally rejected as opposite Python's attitude. Converting fun(a) to

[Python-ideas] Re: Is possible some day add Uniform Function Call Syntax (UFCS) in Python like Dlang?

2020-06-28 Thread Steven D'Aprano
On Sun, Jun 28, 2020 at 02:23:38PM -, marc...@email.com wrote: > Is possible some day add Uniform Function Call Syntax (UFCS) in Python like > Dlang? > > Example: https://tour.dlang.org/tour/en/gems/uniform-function-call-syntax-ufcs That converts calls like: a.fun() to fun(a) I

[Python-ideas] Re: Is possible some day add Uniform Function Call Syntax (UFCS) in Python like Dlang?

2020-06-28 Thread Steele Farnsworth
In theory it could be checked to see if a given function exists in the same namespace as a given variable if it doesn't exist in it that variable's object's method resolution order and try calling it using the syntax described here, but I don't think it affords the language any added elegance or