[issue22547] Implement an informative `BoundArguments.__repr__`

2015-05-15 Thread Yury Selivanov
Yury Selivanov added the comment: Actually, I like the current repr (minus the object ID, I'll update the code). The thing about BoundArguments is that '.arguments' is the main property. You use it to add more stuff to *args & **kwargs, or to add/remove positional/keyword arguments. Seeing a

[issue22547] Implement an informative `BoundArguments.__repr__`

2015-05-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is an implementation. -- keywords: +patch Added file: http://bugs.python.org/file39380/BoundArguments_repr_alt.patch ___ Python tracker _

[issue22547] Implement an informative `BoundArguments.__repr__`

2015-05-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: May be omit names for positionalarguments? >>> def foo(a, *args, b=10, **kwargs): pass ... >>> inspect.signature(foo).bind(1, 2, 3, b=4, c=5) I think it would look better as: -- nosy: +serhiy.storchaka ___ Pyt

[issue22547] Implement an informative `BoundArguments.__repr__`

2015-05-14 Thread Yury Selivanov
Changes by Yury Selivanov : -- resolution: -> fixed stage: -> resolved status: open -> closed type: -> enhancement ___ Python tracker ___ _

[issue22547] Implement an informative `BoundArguments.__repr__`

2015-05-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset a64a2e87 by Yury Selivanov in branch 'default': Issue 22547: Implement informative __repr__ for inspect.BoundArguments https://hg.python.org/cpython/rev/a64a2e87 -- nosy: +python-dev ___ Python tr

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: .arguments returns a mutable (ordered) dict that can be modified. See the example in the doc https://docs.python.org/3.4/library/inspect.html#inspect.BoundArguments -- ___ Python tracker

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: > Another thing I proposed in python-ideas is to have `__getitem__` delegate to > `.arguments`, so this proposal is similar in spirit, because I want to have > `__repr__` show information from `.arguments`. Big -1 on __getitem__ > To be honest I don't see the

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Another thing I proposed in python-ideas is to have `__getitem__` delegate to `.arguments`, so this proposal is similar in spirit, because I want to have `__repr__` show information from `.arguments`. To be honest I don't see the point in having to access `.argume

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Terry J. Reedy
Terry J. Reedy added the comment: Context: inspect.signature returns an inspect.Signature instance. Its .bind and .bind_partial methods return ab inspect.BoundArguments instance with a standard <...@ 0x...> representation. >>> import inspect >>> def foo(a, b=10): pass >>> ba = inspect.signatu

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: I think the point of `__init__` is to know what the object is, and if you're hiding the values then someone has to access the attributes to find out the values and that sucks. -- ___ Python tracker

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: Yes and no ;) You can have partially bound args, you can bind just one argument and use defaults for the rest, etc. I agree that it's not an ideal solution, but it is a sane compromise. -- ___ Python tracker

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Em, that kind of defeats the purpose of describing the object, doesn't it? -- ___ Python tracker ___ ___

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Yury Selivanov
Yury Selivanov added the comment: How about we just list bound arguments names, without values? -- ___ Python tracker ___ ___ Python-b

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Ram Rachum added the comment: Something like I have no problem with truncation when it gets too long. -- ___ Python tracker ___ ___

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Yury Selivanov
New submission from Yury Selivanov: Can you propose a format for it? I'm not sure that including all arguments and their reprs is a good idea, as it will make BA's repr too long. -- nosy: +yselivanov ___ Python tracker

[issue22547] Implement an informative `BoundArguments.__repr__`

2014-10-03 Thread Ram Rachum
Changes by Ram Rachum : -- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Implement an informative `BoundArguments.__repr__` versions: Python 3.5 ___ Python tracker __