Ivan Levkivskyi added the comment:

Guido,

I fixed __annotations__ in interactive REPL, will fix other minor things and 
submit a new patch tomorrow morning.

There are two important questions in typing.py:

> Why is the second isinstance() needed? Isn't _ClassVar a subclass of
> TypingMeta

and 

> This being a metaclass, the name should end in Meta, like most
> other subclasses of TypingMeta. (And they don't have a leading _,
> though they're still not public.)

The problem with ClassVar is that it is not actually a class, and _ClassVar is 
not a metaclass, it is just a class. I deviated from the common pattern in 
module for the following reason. ClassVar is going to be extensively used at 
class scope, where all annotations are evaluated. Therefore I wanted not to 
create new class objects by __getitem__ like it is going for other classes like 
Union etc (I tried to timeit this and ClassVar is almost ten times faster than 
Union)

What do you think?
Should I keep it like this, or rewrite in a common pattern for the module?

----------

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

Reply via email to