Uniform Function Call Syntax (UFCS)

Paul Sokolovsky pmiscml at gmail.com
Sun Jun 8 07:52:13 EDT 2014


Hello,

On Sun, 8 Jun 2014 01:15:43 -0700 (PDT)
jongiddy <jongiddy at gmail.com> wrote:

> Thanks for the extensive feedback.  Here's my thoughts on how to
> address these issues.
> 
> On Saturday, 7 June 2014 20:20:48 UTC+1, Ian  wrote:
> > 
> > It's a nice feature in a statically typed language, but I'm not sure
> > how well it would work in a language as dynamic as Python.  There
> > are some questions that would need to be addressed.
> > 
> > 1) Where should the function (or perhaps callable) be looked for?
> > The most obvious place is the global scope.  I think it would be a
> > bit too far-reaching and inconsistent with other language features
> > to reach directly inside imported modules (not to mention that it
> > could easily get to be far too slow in a module with lots of
> > imports). As a result it would have to be imported using the "from
> > module import function" syntax, rather than the somewhat cleaner
> > "import module" syntax.
> > 
> > While there's nothing wrong with such imports, I'm not sure I like
> > the thought of the language encouraging them any more than
> > necessary.
> 
> It would only work on functions in scope. x.len() would only work if
> len(x) would work.

In other words, you propose you add yet another check for each function
call. But what many people has to say about Python is that it's "slow".
There should be lookout for how to make it faster, not yet slower.


[]

> 
> The bigger problem I find is reading other code that uses UFCS and
> not realising that a "method" is not actually a method of the class,
> but requires importing a module.  That can cause confusion when
> trying to use it in your own code.

Indeed, this UFCS idea adds inefficiency and confusion, but doesn't
appear to solve any reasonable problem or add any firm benefit.



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com



More information about the Python-list mailing list