Yury Selivanov added the comment:
But I can't think of any use case when it would be undesirable to include the
extra parameters
One use case is that you are actually loosing information what arguments
Signature.bind() was called with, when defaults are included. In some cases
this
Ryan McCampbell added the comment:
It's not really a particular use case. I was making a function decorator for
automatic type checking using annotations (ironically I discovered later there
is an almost identical example in the PEP for signatures). But I can't think of
any use case when it
Yury Selivanov added the comment:
Ryan,
Can you explain the use case for it? What's the problem you're trying to solve?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21684
___
Ryan McCampbell added the comment:
Copying defaults still doesn't give you var positional/keyword arguments, which
means, you have to explicitly check the parameter type, and then add them in. I
still think it would more useful to have an official way of getting all
function parameters from
Yury Selivanov added the comment:
That's the intended and documented behaviour, see
https://docs.python.org/3/library/inspect.html#inspect.BoundArguments.arguments.
You can easily implement the functionality you need by iterating through
Signature.parameters and copying defaults to the
Ryan McCampbell added the comment:
If this is decided against, a partial solution would be to set the default
attribute of VAR_POSITIONAL and VAR_KEYWORD args to an empty tuple/dict,
respectively. Then you could get a parameter's value no matter what with
boundargs.get(param.name,
Changes by Terry J. Reedy tjre...@udel.edu:
--
stage: - test needed
versions: +Python 3.5 -Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21684
___
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +yselivanov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21684
___
___
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +r.david.murray
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21684
___
___
New submission from Ryan McCampbell:
I'm not sure if this is really a bug, but it is unexpected behavior. When you
call bind on a Python 3.3 signature object, if you omit an optional argument,
the default is not provided in the arguments dict. Similarly, if there is a
var positional or var
10 matches
Mail list logo