The point is that at the moment to set this sort of api up requires a lot of
work, defeating 50% of the value i.e. to define a new function with the
attribute access behaviour requires defining each individual function to return
a middle step object that has the attribute of the next function, so you can't
define a function in plain english.
e.g.
def insert_into(x, y):
...
def insert(x):
class Return:
def into(self, y):
return insert_into(x, y)
return Return()
insert.into = insert_into
is a very long way to say:
def insert(x)._into(y):
...
and that is without the actual logic and for only 2 positional args.
> But why would you? It's ugly if spelled like that, and your whole argument is
> that the "interspersed arguments" form is better. If you just want to pass
> the function to something that expects "normal" argument conventions, lambda
> x,y: insert(x).into(y) does what you want.
The point is so that in code that expects dynamically called functions or to be
able to reference the function by name it needs to have a single name that
follows backward compatible naming conventions. I would be happy with it being
on the onus of the developer in question to add a wrapping function, less happy
than if it was added by default but it would still be a saving (and could maybe
be in a decorator or something).
> I've never heard anyone else suggest anything like this, so you might want to
> consider that the annoyance you feel is not a common reaction...
I know lots of people that have had this reaction but just shrugged it off as
"the way things are", which would seem like a good way to stagnate a language,
so I thought I would ask.
_______________________________________________
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/JY3JEMACQQ33F6NTZJZ7T6U4YPEZFQTJ/
Code of Conduct: http://python.org/psf/codeofconduct/