Create a NamedTuple instance for NamedTuples#1306
Conversation
|
@cdce8p do you think you'll have time to review this ? I see you self requested a review two months ago. I'm trying to release astroid 2.10 :) |
areveny
left a comment
There was a problem hiding this comment.
I'm beginning to understand Astroid brain a lot better after looking at this!
cdce8p
left a comment
There was a problem hiding this comment.
Had finally time to look at it. Tbh I'm myself not exactly the "brain" expert. However from what I've gathered so far, I'm not sure this is the best solution to the problem.
I do understand your desire to have NamedTuple / namedtuple at least somewhere which isn't the case today, but it seems strange to add a new instance type just for that. Wouldn't it be much more intuitive to insert a new base which itself has tuple as base? That's at least roughly similar to the pattern we used in the typing brain.
Regarding the remaining changes, I would probably need more time but it looks like there are 3-4 others bundled here as well. That makes it more challenging to review.
Going forward, I would suggest we (1) move the PR back to 2.11, (2) unbundle additional changes, and (3) explore if inserting a dummy base class would work.
Hmm, I guess this depends on what
I'll try and separate some of the work here. Some of the typing should be fairly straightforward to extract and then review for example. I'll get back to you! |
98a090a to
806aa81
Compare
|
@DanielNoord can we close this ? |
|
I'll triage this somewhere next week to see if there is anything still relevant in here |
|
Closing! |
Steps
Description
This is the first step towards some improvements to the
NamedTuplebrain. One of the first things I thought we should fix is the fact that we currently lose the fact that something is aNamedTuple. We don't add it to the object's bases and they are undistinguishable from other instances.I'm not sure if adding a new
Instanceis actually necessary. I thought it might make sense asNamedTuplebehaves differently thantupleand can have default values for example. I have created theT(opic): NamedTuplelabel to identify some issues related toNamedTuple. I thought a newInstancetype could be the basis for solving some of these.Changes have been tested against current latest commit of
pytest.Type of Changes
Related Issue