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 fish2000, levkivskyi, serhiy.storchaka
Date 2018-10-28.16:51:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Serhiy, thanks for benchmarks and good suggestions!

> If make NewType a class, I would make the repr looking like a call

This is a nice idea, it indeed looks better. We can probably also use `_type_repr()` helper for the argument (for consistency).

> Should the NewType() result be pickleable?

This is not required by PEP 484, but I could imagine this may be useful.

> If it should be pickleable, should it be pickled by name (resulting in restoring the same instance on unpickling, but failing if it is not accessible by name) or by its arguments (resulting in creating a new instance when unpickled)?

Logically, they should behave like class objects, so if we are going to make them pickleable, they should be pickled by full name.

> Should it support comparison and what values should be treated as equal?

Again, since they should behave like class objects, I think we don't need any dedicated `__eq__`, they should be just compared by identity.

From performance point of view, both PRs look good. Maybe we can even combine both, so that we have both fine-tuned repr and pickleability. I understand this means we will get slower benchmarks for both creation and instantiation, but I think it is still OK, since it is still much faster than creating a new class.
Date User Action Args
2018-10-28 16:51:55levkivskyisetrecipients: + levkivskyi, serhiy.storchaka, fish2000
2018-10-28 16:51:55levkivskyisetmessageid: <>
2018-10-28 16:51:55levkivskyilinkissue34963 messages
2018-10-28 16:51:55levkivskyicreate