A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/120050.html below:

[Python-Dev] PEP 362 Second Revision

[Python-Dev] PEP 362 Second RevisionTerry Reedy tjreedy at udel.edu
Thu Jun 7 23:39:54 CEST 2012
On 6/7/2012 4:54 PM, Yury Selivanov wrote:

> I think we'll add a 'format' method to the Signature, that will work
> like 'inspect.formatargspec'.  'Signature.__str__' will use it with
> default parameters/formatters.

Great. If I don't like the default, I could customize.

> I'm not sure how __repr__ should look like.  Maybe default repr
> (object.__repr__) is good enough.

__repr__ = __str__ is common.

Idle tooltips use an re to strip 'self[, ]' from the 
inspect.formatargspec result*. I have revised the code to only do that 
when appropriate (for bound instance methods and callable instances), 
which is to say, when the user has already entered the object that will 
become the self parameter). If signature does the same, I might delete 
the code and use the signature object instead.

*The same could be done for class methods, but I am not sure that 'cls' 
is standard enough to bother. Of course, any function using anything 
other than 'self' will also not see the deletion. Come to think of it, 
now that I am doing the search-and-replace conditionally rather than 
always, I can and should re-write the re to remove the first name rather 
than 'self' specifically. It will be good to have all such signature 
manipulations done correctly in one place.

---
Terry Jan Reedy
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4