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 vstinner
Recipients benjamin.peterson, brett.cannon, gvanrossum, nascheme, ncoghlan, serhiy.storchaka, vstinner, yselivanov
Date 2018-09-21.21:15:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537564517.27.0.956365154283.issue32892@psf.upfronthosting.co.za>
In-reply-to
Content
> * If the user of NodeVisitor implemented visit_Num(), but not implemented visit_Constant(), his handler will not be triggered. This can be easily fixed by implementing visit_Constant(). Constant was introduced in 3.6.

IHMO that's an acceptable tradeoff. We should just make sure that it's properly documented in the Porting section of What's New in Python 3.8.

> * issubclass() check and exact type check. `issubclass(type(node), Num)` and `type(node) is Num` will return False for node = Num(42). But seems isinstance() is a more common way of checking the type of a node.

In the AST code that I read, isinstance() was the most popular way to check the type of a node. I don't recall any AST code using issubclass.

> isinstance() check for underinitialized node. `isinstance(Num(), Num)` will return False.

I don't think that it's an issue. 

--

In term of optimization, I'm curious, do you know if your PR optimize more cases than previously? Or do you expect futher optimizations later thanks to this change?
History
Date User Action Args
2018-09-21 21:15:17vstinnersetrecipients: + vstinner, gvanrossum, brett.cannon, nascheme, ncoghlan, benjamin.peterson, serhiy.storchaka, yselivanov
2018-09-21 21:15:17vstinnersetmessageid: <1537564517.27.0.956365154283.issue32892@psf.upfronthosting.co.za>
2018-09-21 21:15:17vstinnerlinkissue32892 messages
2018-09-21 21:15:17vstinnercreate