This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年07月13日 09:35 by yuriy_levchenko, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg140239 - (view) | Author: yuriy_levchenko (yuriy_levchenko) | Date: 2011年07月13日 09:35 | |
sample: def foo(a,b): print a,b foo(1,2) fa = foo%(1) fa(2) fab = foo%(1,2) fab() result 12 12 12 |
|||
| msg140240 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年07月13日 09:43 | |
It's not entirely clear to me what you are proposing, but it looks like functools.partial[0]. Whatever it is, adding new syntax especially for it sounds highly unlikely. You might want to propose and discuss it on python-ideas though. [0]: http://docs.python.org/library/functools.html#functools.partial |
|||
| msg140325 - (view) | Author: yuriy_levchenko (yuriy_levchenko) | Date: 2011年07月14日 10:30 | |
http://www.python.org/dev/peps/pep-0309/#note -------------------------------------------------------------------- Abandoned Syntax Proposal I originally suggested the syntax fn@(*args, **kw), meaning the same as partial(fn, *args, **kw). The @ sign is used in some assembly languages to imply register indirection, and the use here is also a kind of indirection. f@(x) is not f(x), but a thing that becomes f(x) when you call it. It was not well-received, so I have withdrawn this part of the proposal. In any case, @ has been taken for the new decorator syntax -------------------------------------------------------------------- Maybe change '@' -> '%' |
|||
| msg140327 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年07月14日 11:24 | |
Using the func%(args) syntax is not possible because fab = foo%(1,2) is equivalent to fab = foo.__mod__((1,2)) It might actually be possible to overload the % operator to make something that looks like your proposed syntax (without changing the actual Python syntax), but it still look hackish to me. (We are also moving away from the % overload used by strings for the formatting in favor of the .format() method.) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56757 |
| 2011年07月14日 12:34:35 | r.david.murray | set | status: open -> closed |
| 2011年07月14日 11:24:15 | ezio.melotti | set | messages: + msg140327 |
| 2011年07月14日 10:30:07 | yuriy_levchenko | set | status: closed -> open messages: + msg140325 |
| 2011年07月13日 09:43:09 | ezio.melotti | set | status: open -> closed nosy: + rhettinger, ezio.melotti messages: + msg140240 resolution: rejected stage: resolved |
| 2011年07月13日 09:35:27 | yuriy_levchenko | create | |