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 levkivskyi
Recipients gvanrossum, levkivskyi
Date 2016-09-08.00:59:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473296387.16.0.0224669848227.issue27985@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-09-08 00:59:47levkivskyisetrecipients: + levkivskyi, gvanrossum
2016-09-08 00:59:47levkivskyisetmessageid: <1473296387.16.0.0224669848227.issue27985@psf.upfronthosting.co.za>
2016-09-08 00:59:47levkivskyilinkissue27985 messages
2016-09-08 00:59:46levkivskyicreate