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


> I think we can do something similar to ABCMeta, i.e. the metaclass itself
will stay defined in Python, but the "hottest" parts of its methods will be
replaced with helper functions written in C.
> This way we can limit complexity of the C code while still getting almost
all the performance benefits.

> --
> Ivan


Adding C speedup module has high bar, especially performance gain is only
on startup time.

Personally speaking, I want speedup module for `re.compile` than enum.
In case of enum, I feel CONSTANT = "magic" is enough for most cases.
re doesn't have such workaround, and using third party regular expression
library has
very high bar, especially when using it in stdlib.

But there were some -1 on adding speedup module for re.
I think it's same to enum.

So I think we should:

* Don't use enum blindly;  use it only when it's very far better than CONST
= "magic".
* Add faster API which bypass some slow part, especially for
IntEnum.convert() or IntFlag.convert() in socket module.

Regards,

-- 
INADA Naoki  <songofaca...@gmail.com>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to