Issue31006
Created on 2017-07-24 09:07 by Antony.Lee, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg298937 - (view) | Author: Antony Lee (Antony.Lee) * | Date: 2017-07-24 09:07 | |
Currently, the fields, types and defaults used to define a typing.NamedTuple need to be retrieved from three different attributes: `_fields`, `_field_types`, and `_field_defaults` (the first two are combined in `__annotations__`, but that still misses the defaults). However, there is a place where all this information can be naturally combined: in the Signature of the constructor (as returned by `inspect.signature(cls)`). Currently, the Parameter objects in the signature have the information about the parameter names and defaults, but their annotation is not set. Thus, I would like to propose setting the annotation of the Parameters in the Signature object as well. |
|||
| msg299413 - (view) | Author: Ivan Levkivskyi (levkivskyi) * ![]() |
Date: 2017-07-28 17:32 | |
This looks like a reasonable idea, if it is possible to implement this without complications. Would you like to submit a PR at https://github.com/python/typing ? (We have a separate upstream repo for typing while it is provisional.) |
|||
| msg299433 - (view) | Author: Antony Lee (Antony.Lee) * | Date: 2017-07-28 19:54 | |
I'll just repost the issue there for now (https://github.com/python/typing/issues/454). May work on a patch at some point (looks relatively simple) but no guarantees, so if someone else wants to take over feel free to do so. |
|||
| msg344390 - (view) | Author: Batuhan Taskaya (BTaskaya) * ![]() |
Date: 2019-06-03 08:08 | |
IMHO this issue can be closed with this commit (https://github.com/python/typing/commit/435b29470c7d3e87055531f65681bee9746ab999) |
|||
| msg344496 - (view) | Author: Ivan Levkivskyi (levkivskyi) * ![]() |
Date: 2019-06-03 23:46 | |
Thanks! It looks like this was fixed in typing and then forward ported to CPython. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:49 | admin | set | github: 75189 |
| 2019-06-04 10:00:03 | Antony.Lee | set | nosy:
- Antony.Lee |
| 2019-06-03 23:46:42 | levkivskyi | set | status: open -> closed resolution: fixed messages: + msg344496 stage: needs patch -> resolved |
| 2019-06-03 08:08:03 | BTaskaya | set | nosy:
+ BTaskaya messages: + msg344390 |
| 2017-07-28 19:54:40 | Antony.Lee | set | messages: + msg299433 |
| 2017-07-28 17:32:26 | levkivskyi | set | nosy:
+ levkivskyi messages: + msg299413 type: enhancement |
| 2017-07-24 09:07:47 | Antony.Lee | create | |
