metaclass names and backwards compatibility
The question:
Can we change the name of classes if we keep the old name as an alias?
The specifics:
When Enum was first created for 3.4 I thought the name EnumMeta
was
clever and appropriate. However, in the intervening years an error
message has occasionally popped up with mention of an "EnumMeta object",
and it invariably makes me think harder about what object it's talking
about than I think I should have to.
I would like to rename EnumMeta
to EnumType
, with an assignment of
EnumMeta = EnumType
at the end. The only affect this should have is
that those occasional error messages will now say "EnumType object"
which will fit my brain better.
Since we are allowed to change repr()
s between major releases I thought
this might be allowed, but wanted to check.
-- ~Ethan~
Seems reasonable -- I think we've done this kind of thing before.
On Fri, Jan 22, 2021 at 3:17 PM Ethan Furman <ethan@stoneleaf.us> wrote:
The question:
Can we change the name of classes if we keep the old name as an alias?
The specifics:
When Enum was first created for 3.4 I thought the name
EnumMeta
was clever and appropriate. However, in the intervening years an error message has occasionally popped up with mention of an "EnumMeta object", and it invariably makes me think harder about what object it's talking about than I think I should have to.I would like to rename
EnumMeta
toEnumType
, with an assignment ofEnumMeta = EnumType
at the end. The only affect this should have is that those occasional error messages will now say "EnumType object" which will fit my brain better.Since we are allowed to change
repr()
s between major releases I thought this might be allowed, but wanted to check.-- ~Ethan~
python-committers mailing list -- python-committers@python.org To unsubscribe send an email to python-committers-leave@python.org https://mail.python.org/mailman3/lists/python-committers.python.org/ Message archived at https://mail.python.org/archives/list/python-committers@python.org/message/A... Code of Conduct: https://www.python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
I think you had good reason to call it EnumMeta though: to better distinguish "the enum meta type" (i.e. EnumMeta) from "enum types" (i.e. instances of EnumMeta).
Cheers, Nick.
On Sat, 23 Jan 2021, 9:17 am Ethan Furman, <ethan@stoneleaf.us> wrote:
The question:
Can we change the name of classes if we keep the old name as an alias?
The specifics:
When Enum was first created for 3.4 I thought the name
EnumMeta
was clever and appropriate. However, in the intervening years an error message has occasionally popped up with mention of an "EnumMeta object", and it invariably makes me think harder about what object it's talking about than I think I should have to.I would like to rename
EnumMeta
toEnumType
, with an assignment ofEnumMeta = EnumType
at the end. The only affect this should have is that those occasional error messages will now say "EnumType object" which will fit my brain better.Since we are allowed to change
repr()
s between major releases I thought this might be allowed, but wanted to check.-- ~Ethan~
python-committers mailing list -- python-committers@python.org To unsubscribe send an email to python-committers-leave@python.org https://mail.python.org/mailman3/lists/python-committers.python.org/ Message archived at https://mail.python.org/archives/list/python-committers@python.org/message/A... Code of Conduct: https://www.python.org/psf/codeofconduct/
Hi Ethan,
In general, I would say that we don't provide any backward compatibility warranties on the exact repr() output. In practice, we attempt to not change it unless there is a good reason for that. IMO in your case, it's justified. When float repr() was changed, it broke tons of doctests :-(
You might document it somewhere in What's New In Python 3.10. Maybe near: https://docs.python.org/dev/whatsnew/3.10.html#changes-in-the-python-api
Victor
participants (4)
-
Ethan Furman
-
Guido van Rossum
-
Nick Coghlan
-
Victor Stinner