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 <>
> * 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?
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: <>
2018-09-21 21:15:17vstinnerlinkissue32892 messages
2018-09-21 21:15:17vstinnercreate