Message326043
> * 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:17 | vstinner | set | recipients:
+ vstinner, gvanrossum, brett.cannon, nascheme, ncoghlan, benjamin.peterson, serhiy.storchaka, yselivanov |
2018-09-21 21:15:17 | vstinner | set | messageid: <1537564517.27.0.956365154283.issue32892@psf.upfronthosting.co.za> |
2018-09-21 21:15:17 | vstinner | link | issue32892 messages |
2018-09-21 21:15:17 | vstinner | create | |
|