[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-23 Thread Ryan Petrello

Ryan Petrello added the comment:

Nick,

That seems reasonable to me :)  I've updated my library to just use 
inspect.getfullargspec for Py3.  Thanks for taking the time to walk through 
this with me!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-22 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, so maybe the right answer here is to officially undeprecate 
inspect.getfullargspec(), as we definitely *don't* want people feeling obliged 
to write their own version of that, and potentially introducing inconsistencies 
between different tools.

Then the deprecation warning on inspect.getargspec() can be updated to point 
people towards "inspect.signature() or inspect.getfullargspec()", while the 
docs for getfullargspec() itself can be updated to say it isn't recommended for 
use in new code, rather than that it's deprecated.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-22 Thread Ryan Petrello

Ryan Petrello added the comment:

Nick,

My main reasoning for not using it is that it's marked as deprecated in the 
docstring, and I want to avoid relying on it if disappears in the future :)

Warnings or not, the shim that I wrote doesn't use any deprecated code, so 
that's why I took that approach.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-22 Thread Nick Coghlan

Nick Coghlan added the comment:

Are you able to use inspect.getfullargspec() on Python 3 rather than 
inspect.getargspec()?

While both are technically deprecated, only inspect.getargspec() actually emits 
a deprecation warning - inspect.getfullargspec() still works without complaint 
and is in no danger of being removed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-22 Thread Ryan Petrello

Ryan Petrello added the comment:

Nick,

My use case is an issue of backwards compatibility and multiple Python version 
support for a library that makes prolific use of the legacy argspec (args, 
varargs, varkw, defaults) namedtuple, *including* the bound self argument 
behavior.  argspec and signature are quite different, and supporting a 
Py26-Py36 codebase that handles both simultaneously seemed like quite a burden, 
so I opted to write a compatibility shim that returned an Argspec-like object 
for all versions of Python;  this seemed the simplest approach to bridge the 
gap in a codebase that supports Python 2.6 through 3.6, and it's the approach 
that I've seen other major libraries (like Django) take:

https://github.com/pecan/pecan/pull/61

I'm using a similar approach to Python 3.5's getfullargspec() implementation:

https://github.com/python/cpython/blob/3.5/Lib/inspect.py#L1069

...but I don't have a long-term public API for doing it (so I have to rely on 
the private inspect._signature_from_callable call, which seems icky).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-21 Thread Nick Coghlan

Nick Coghlan added the comment:

Hi Ryan, sorry for the delayed response.

My own concern with this proposal is that I don't understand the use case for 
it. We changed the inspect.signature behaviour away from that of 
inspect.getfullargspec because we considered the latter behaviour to be 
*wrong*: it reported a parameter the already bound method didn't actually 
accept when called. The "skip_bound_arg" functionality then remains *within* 
the inspect module for the sake of providing backwards compatible 
implementations of getargspec and getfullargspec without duplicating a lot of 
other callable introspection logic.

If you can provide more information on the motivating use case, we can better 
determine if exposing this option directly is a suitable design response, or if 
there may be better alternatives available.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-20 Thread Ryan Petrello

Ryan Petrello added the comment:

Yury/Nick,

Any word on this?  I know it's minor, but I'd love to see this make it into 
Python3.6.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-02 Thread Yury Selivanov

Yury Selivanov added the comment:

Nick, what do you think about this one?

I'm +1 to add this, but I'm not sure about the name for the argument. Do you 
have better ideas, or "skip_bound_arg" is good enough?

--
nosy: +ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread Ryan Petrello

Changes by Ryan Petrello :


Added file: 
http://bugs.python.org/file43090/signature-from-callable-skip-bound-arg.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread Ryan Petrello

Changes by Ryan Petrello :


Added file: 
http://bugs.python.org/file43089/signature-from-callable-skip-bound-arg.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread SilentGhost

Changes by SilentGhost :


--
assignee:  -> yselivanov
stage: patch review -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread Yury Selivanov

Yury Selivanov added the comment:

Please don't commit this without my review.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread Ryan Petrello

Changes by Ryan Petrello :


Added file: 
http://bugs.python.org/file43087/signature-from-callable-skip-bound-arg.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread ryan.petrello

Changes by ryan.petrello :


--
nosy: +eric.snow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread ryan.petrello

Changes by ryan.petrello :


Added file: 
http://bugs.python.org/file43081/signature-from-callable-skip-bound-arg.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread ryan.petrello

ryan.petrello added the comment:

Thanks, I'll upload a new patch shortly that addresses these.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-06-01 Thread SilentGhost

New submission from SilentGhost:

This could only go in 3.6, but it needs proper documentation and test(s).

--
nosy: +SilentGhost, yselivanov
stage:  -> test needed
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-05-31 Thread ryan.petrello

Changes by ryan.petrello :


--
versions: +Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable()

2016-05-31 Thread ryan.petrello

Changes by ryan.petrello :


--
components: Library (Lib)
files: signature-from-callable-skip-bound-arg.patch
keywords: patch
nosy: ryan.petrello
priority: normal
severity: normal
status: open
title: Add skip_bound_arg argument to inspect.Signature.from_callable()
type: enhancement
versions: Python 3.6
Added file: 
http://bugs.python.org/file43078/signature-from-callable-skip-bound-arg.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com