[issue22998] inspect.Signature and default arguments

2014-12-09 Thread Walter Dörwald
Walter Dörwald added the comment: The updated code in the documentation still doesn't set the * and ** parameters. I would have preferred the following code: for param in sig.parameters.values(): if param.name not in ba.arguments: if param.kind is inspect.Parameter.VAR_POSITIONAL:

[issue22998] inspect.Signature and default arguments

2014-12-05 Thread R. David Murray
R. David Murray added the comment: I'm good with your solution, but I'm going to adjust the resolution by changing the component :) -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python resolution: wont fix -> fixed stage: -> resolved __

[issue22998] inspect.Signature and default arguments

2014-12-05 Thread Yury Selivanov
Yury Selivanov added the comment: > Should this be closed now? Yes, let's close it. David and Walter, you're welcome to re-open the issue if you want to discuss it in more detail. -- resolution: -> wont fix status: open -> closed ___ Python tracke

[issue22998] inspect.Signature and default arguments

2014-12-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: Should this be closed now? -- nosy: +terry.reedy ___ Python tracker ___ ___ Python-bugs-list mailing

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 71c38c233e5c by Yury Selivanov in branch '3.4': docs.inspect: Fix BoundArguments example. Issue #22998. https://hg.python.org/cpython/rev/71c38c233e5c New changeset 697adefaba6b by Yury Selivanov in branch 'default': docs.inspect: Fix BoundArguments

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread Yury Selivanov
Yury Selivanov added the comment: I think we should just fix the documentation, and update the code in example with a proper check: for param in sig.parameters.values(): if (param.name not in ba.arguments and param.default is not param.empty): ba.arguments[param.name]

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread R. David Murray
R. David Murray added the comment: This is indeed a bit tricky. Your use case is pretty specialized (it doesn't involve any actual python functions), so I don't think by itself it argues for the inclusion of a _with_defaults method. The example fill-in in the docs fails because args and kwar

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread Walter Dörwald
Walter Dörwald added the comment: The following doesn't work:: import inspect def foo(*args, **kwargs): return (args, kwargs) # Code from https://docs.python.org/3/library/inspect.html#inspect.BoundArguments.arguments to fill in the defaults sig = inspect.signature(foo)

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread R. David Murray
R. David Murray added the comment: Can you give an example of what you say doesn't work? IIRC the reason this method isn't part of the API is because normally it isn't needed (the defaults are filled in when you do the actual call). What is your use case for needing the defaults to be pre-bou

[issue22998] inspect.Signature and default arguments

2014-12-04 Thread Walter Dörwald
New submission from Walter Dörwald: inspect.Signature.bind() doesn't add values for parameters that are unspecified but have a default value. The documentation at https://docs.python.org/3/library/inspect.html#inspect.BoundArguments.arguments includes an example how to add default values, but