[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-05 Thread Nicholas Matthews


New submission from Nicholas Matthews :

The class inspect.Signature asks for parameters of type dict in python 3.8+ 
(and OrderedDict in earlier versions); however the __init__ function iterates 
over parameters as if it were a list, specifically:

for param in parameters:
name = param.name
kind = param.kind
...

Either the docstring should be changed to specify Sequence / List, or the 
implementation should be changed to iterate over the values of parameters:

for param in parameters.values():
...

(https://github.com/python/cpython/blob/2cca8efe46935c39c445f585bce54954fad2485b/Lib/inspect.py#L2734)

--
messages: 361461
nosy: Nicholas Matthews
priority: normal
severity: normal
status: open
title: inspect.Signature.__init__ asks for parameters as dict but treats as list
type: behavior
versions: Python 3.8

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



[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-06 Thread Nicholas Matthews


Nicholas Matthews  added the comment:

I originally filed an issue believing the documentation for inspect.Signature 
was incorrect; I now think I misread the documentation. (Apologies, I'm used to 
a different docstring format)

--

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



[issue36947] Fix 3.3.3.1 Metaclasses Documentation

2019-05-17 Thread Nicholas Matthews


New submission from Nicholas Matthews :

Currently the final sentence of the second paragraph reads:
"In the following example, both MyClass and MySubclass are instances of Meta:"
It should read something like:
"In the following example, both MyClass and MySubclass have the metaclass Meta, 
and new instances will be created using Meta:"

Classes are created by their metaclass, but cannot be said to be instances of 
their metaclass, correct?

--
components: Library (Lib)
messages: 342723
nosy: Nicholas Matthews
priority: normal
severity: normal
status: open
title: Fix 3.3.3.1 Metaclasses Documentation
type: behavior
versions: Python 3.7

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



[issue36947] [Good first issue] Fix 3.3.3.1 Metaclasses Documentation

2019-05-17 Thread Nicholas Matthews


Nicholas Matthews  added the comment:

Ok, I will create a PR soon and update the issue.

--

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



[issue36947] [Good first issue] Fix 3.3.3.1 Metaclasses Documentation

2019-05-17 Thread Nicholas Matthews


Nicholas Matthews  added the comment:

Thanks for the clarification. For the first point on the correctness of the 
original text, that makes sense, could you link me to any relevant 
documentation for further reading?

On the second point "Meta modifies the creation of the classes themselves, not 
instances of the classes." I think this is not 100% correct. When you create an 
instance of a class via "instance = MyClass()", the `__call__` method of the 
metaclass is invoked, so metaclasses can control both class definition and 
instance creation.

--

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