bpo-38659: [Enum] add _simple_enum decorator#25285
bpo-38659: [Enum] add _simple_enum decorator#25285ethanfurman merged 109 commits intopython:masterfrom
Conversation
gpshead
left a comment
There was a problem hiding this comment.
neat approach. i haven't done a thorough review. just high level skimming. we should loop in enum experts.
Doc/library/enum.rst
Outdated
There was a problem hiding this comment.
I suggest we not make this a public API for at least the first release we see if we want to live with this approach. So I wouldn't document it yet and would add an _ prefix to both names. That way if we wind up doing something else later it is easy to undo without a drawn out deprecation.
Doc/library/enum.rst
Outdated
There was a problem hiding this comment.
if we were keeping the docs... extra trailing : and I believe auto() needs to be imported below?
Lib/enum.py
Outdated
There was a problem hiding this comment.
make _simple a keyword only arg.
Instead of raising ValueError on mismatch, raise a TypeError instead.
I am the enum expert. :-) |
39ca1c8 to
bed8851
Compare
…thon#24818) * coerce bytes separator to string * Add news * Update Misc/NEWS.d/next/Library/2021-03-11-00-31-41.bpo-42967.2PeQRw.rst
* Split PyType_Ready() into sub-functions. * type_ready_mro() now checks if bases are static types earlier. * Check tp_name earlier, in type_ready_checks(). * Add _PyType_IsReady() macro to check if a type is ready.
Static methods (@staticmethod) are now callable as regular functions.
The snake_case names have existed since Python 2.6, so there is no reason to keep the old camelCase names around. One similar method, threading.Thread.isAlive, was already removed in Python 3.9 (bpo-37804).
The Python _pyio.open() function becomes a static method to behave as io.open() built-in function: don't become a bound method when stored as a class variable. It becomes possible since static methods are now callable in Python 3.10. Moreover, _pyio.OpenWrapper becomes a simple alias to _pyio.open. init_set_builtins_open() now sets builtins.open to io.open, rather than setting it to io.OpenWrapper, since OpenWrapper is now an alias to open in the io and _pyio modules.
Signed-off-by: Christian Heimes <christian@python.org>
* Add method localize to the locale module * Update the documentation of the locale module
The configure --without-cycle-gc option has been removed in Python 2.3 by the commit cccd1e7. It's now time to remove the last reference to it in the documentation.
|
Not sure what happened -- was only supposed to change 20 files, not 234. Reverting. |
|
Umm... Did something go wrong here? 109 commits?! |
|
|
|
I think you used |
|
@methane - so instead of |
|
add:
_simple_enumdecorator to transform a normal class into an enum_test_simple_enumfunction to compare_old_convert_to enable checking_convert_generated enums_simple_enumtakes a normal class and converts it into an enum:_old_convert_works much like_convert_does, using the original logic:test_simple_enumtakes a traditional enum and a simple enum andcompares the two:
Any important differences will raise a
TypeErrorhttps://bugs.python.org/issue38659