[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread Ron Adam
Ron Adam added the comment: Is this issue referring to something in Python's library, or a hypothetical function someone may write? If it's in the library, we can look at that case in more detail, otherwise, it's just a bad program design issue and there's nothing to do. --

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread R. David Murray
R. David Murray added the comment: The reason that it is surprising is that the API is designed to allow an arbitrary function to be called, with whatever arguments and keyword arguments that function takes. The user of the API is not necessarily going to remember that the first argument to

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread Ron Adam
Ron Adam added the comment: Why is this surprising? >>> def foo(c, c=None): ... pass ... File "", line 1 SyntaxError: duplicate argument 'c' in function definition In the previous examples, it finds the duplicate at run time instead of compile time due to not being able to determine the

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread R. David Murray
R. David Murray added the comment: Adrian's suggestions don't look to me like they fiddle with the API, but rather make the behavior match the documented API. The existing behavior is, IMO, a very surprising corner case, especially to a less experienced Python programmer. I do note that ass

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread Brian Quinlan
Brian Quinlan added the comment: Good point! I'd suggest functools.partial. -- ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread Adrian Dries
Adrian Dries added the comment: What now? Python 3.1.3 (r313:86834, Jan 17 2011, 22:33:40) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def foo(f, **kw): ... pass ... >>> foo(1, **{'f': 2}) Traceback (most recent call last): File "", l

[issue10918] **kwargs unnecessarily restricted in API

2011-01-17 Thread Brian Quinlan
Brian Quinlan added the comment: Arian, This seems like such an unimportant edge case that I don't want to mess with the API just to accommodate it. If you really need to pass an "fn" keyword argument, use: .submit(foo, 1, 2, **{'fn': bar}) -- resolution: -> wont fix status: open -

[issue10918] **kwargs unnecessarily restricted in API

2011-01-16 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> bquinlan nosy: +bquinlan versions: +Python 3.3 -Python 3.2 ___ Python tracker ___ ___ Pytho

[issue10918] **kwargs unnecessarily restricted in API

2011-01-16 Thread Adrian Dries
New submission from Adrian Dries : An API such as in, e.g. futures: def submit(self, fn, *args, **kwargs): pass cannot be used thus: submit(foo, 1, 2, fn=bar) I can see two options: either mangle the named parameters: def submit(__self, __fn, *args, **kwargs): pass Or