You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 362 "Signature Objects" reference implementation #59213
Yes, it seems quite common to me to have a class called Thing and instances named thing. Unless it makes the code wrap better, using real names like signature instead of for example sig is recommended by PEP-8.
One small thing: can we find a name for the function that starts with a verb? It’s the recommended naming style for functions, and would help making a difference between the class and the function. I also expect people to use “signature” and “sig” for their instances.
I left a few comments on rietveld.
The '\' is sometimes used where not necessary and the preferred way to write conditions on multiple lines is:
(foo == bar and
bar == baz and
baz == asd)
rather than
foo == bar \
and bar == baz \
and baz == asd
Signature has a new default constructor, which
accepts parameters list and a return_annotation; and
a new 'from_function', which create a Signature object
for the passed function.
Parameter.__str__
The implementation has 100% test coverage and is stable.
Please review.
One big change (Guido's request) - No more AttributeErrors on missing Parameter.default of Signature.return_annotation. They now will be set to Parameter.empty & Signature.empty correspondingly.
Activity
YurySelivanov commentedon Jun 5, 2012
This issue will track implementation of PEP-362 functionality.
RamchandraApte commentedon Jun 6, 2012
Signature and signature are two variable names that differ only in case.
To avoid confusion, I recommend one of the names should be changed.
YurySelivanov commentedon Jun 6, 2012
Well, 'Signature' class is unlikely to be used very frequently. So I think it's fine.
merwok commentedon Jun 6, 2012
Yes, it seems quite common to me to have a class called Thing and instances named thing. Unless it makes the code wrap better, using real names like signature instead of for example sig is recommended by PEP-8.
[-]PEP 362 reference implementation for 3.3[/-][+]PEP 362 "Signature Objects" reference implementation[/+]YurySelivanov commentedon Jun 14, 2012
Attaching a patch that implements the latest version of the PEP.
Quick summary:
there is one
YurySelivanov commentedon Jun 15, 2012
Attaching the new version of the patch.
Summary:
attribute in all callables
merwok commentedon Jun 16, 2012
One small thing: can we find a name for the function that starts with a verb? It’s the recommended naming style for functions, and would help making a difference between the class and the function. I also expect people to use “signature” and “sig” for their instances.
YurySelivanov commentedon Jun 19, 2012
New version (PEP-363.4.patch)
Summary:
Thanks and please review!
YurySelivanov commentedon Jun 19, 2012
Eric,
I personally prefer simple 'signature()' more than 'get_signature()'. But I'll ask this question on python-dev on the next PEP update.
YurySelivanov commentedon Jun 19, 2012
New patch (PEP-362.5.patch)
Fixed a bug in BoundArguments.args & BoundArguments.kwargs
ezio-melotti commentedon Jun 19, 2012
I left a few comments on rietveld.
The '\' is sometimes used where not necessary and the preferred way to write conditions on multiple lines is:
(foo == bar and
bar == baz and
baz == asd)
rather than
foo == bar \
and bar == baz \
and baz == asd
Have you measured the coverage of the tests?
YurySelivanov commentedon Jun 19, 2012
New patch - PEP-362.6.patch
Ezio,
I've eliminated almost all '\'.
Test coverage is now almost 100%.
YurySelivanov commentedon Jun 21, 2012
New patch - PEP-362.7.patch
Summary:
Signature & Parameter objects are now immutable
Signature.replace() and Parameter.replace()
Signature has a new default constructor, which
accepts parameters list and a return_annotation; and
a new 'from_function', which create a Signature object
for the passed function.
Parameter.__str__
The implementation has 100% test coverage and is stable.
Please review.
Thanks!
YurySelivanov commentedon Jun 22, 2012
New patch - PEP-362.8.patch
One big change (Guido's request) - No more AttributeErrors on missing Parameter.default of Signature.return_annotation. They now will be set to Parameter.empty & Signature.empty correspondingly.
python-dev commentedon Jun 22, 2012
New changeset d892bf410478 by Larry Hastings in branch 'default':
Issue bpo-15008: Implement PEP-362 "Signature Objects".
http://hg.python.org/cpython/rev/d892bf410478
benjaminp commentedon Jul 25, 2012
Are we going to get documentation?
1st1 commentedon Jul 25, 2012
Benjamin: http://bugs.python.org/issue15151