[Python-ideas] Change magic strings to enums

Antoine Pitrou solipsis at pitrou.net
Wed Apr 25 18:03:12 EDT 2018


On Wed, 25 Apr 2018 14:01:43 +0300
Serhiy Storchaka <storchaka at gmail.com>
wrote:
> 25.04.18 13:15, Ivan Levkivskyi пише:
> > Hm, this is what I wanted to know. I think by rewriting EnumMeta in C we 
> > can reduce the creation time of an Enum class
> > (almost) down to the creation time of a normal class, which may be a 
> > 4-5x speed-up. What do you think?  
> 
> It could be great. But I afraid this may add too much complexity in C 
> code. Maybe try to implement a simple and fast Enum for using it in the 
> stdlib and extend it with a richer interface in the enum module?

Or perhaps we want a way to eschew the current complexity of the
EnumMeta constructor, for example by passing some pre-computed values.

Regards

Antoine.




More information about the Python-ideas mailing list