This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jreese
Recipients benjamin.peterson, jreese, lukasz.langa, serhiy.storchaka
Date 2018-06-28.18:14:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530209689.69.0.56676864532.issue33983@psf.upfronthosting.co.za>
In-reply-to
Content
The problem I'm trying to solve is around functions that operate on a Union[Leaf, Node], and want to be able to do things like `grandchildren = node.children[0].children + node.children[1].children` (contrived example, but point being tuple+list=TypeError while list+tuple=OK).  There are similar cases around list methods not being available for tuples.  In both cases, as is, the function needs to do some amount of type checking at runtime of each child to determine what operations can be done.  Also, IMO, from a type annotation perspective, having a child class that uses a different type for an attribute from the base class is an anti-pattern, or weird at best.

re. error prone:  Since the expectation in lib2to3 is already that fixers shouldn't be modifying `node.children` directly, I don't see how this makes anything more error prone.  Base/Leaf objects lack those methods for modifications, so unless the code is already being a bad actor, the situation isn't changed.
History
Date User Action Args
2018-06-28 18:14:49jreesesetrecipients: + jreese, benjamin.peterson, lukasz.langa, serhiy.storchaka
2018-06-28 18:14:49jreesesetmessageid: <1530209689.69.0.56676864532.issue33983@psf.upfronthosting.co.za>
2018-06-28 18:14:49jreeselinkissue33983 messages
2018-06-28 18:14:49jreesecreate