STINNER Victor <vstin...@redhat.com> added the comment:

> * 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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32892>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to