On 12/19/22 13:59, Chris Angelico wrote:

> The way things are, a StrEnum or an HTML string will behave *exactly
> as a string does*. The alternative is that, if any new operations are
> added to strings in the future, they have to be explicitly blocked by
> StrEnum or else they will randomly and mysteriously misbehave - or, at
> very best, crash with unexpected errors. Which one is more hostile to
> subclasses?

As Brendan noted, mixed-type enums are special -- they are meant to be whatever they subclass, with a couple extra features/restrictions.

Personally, every other time I've wanted to subclass a built-in data type, I've wanted the built-in methods to return my subclass, not the original class.

All of which is to say:  sometimes you want it one way, sometimes the other.  
;-)

Metaclasses, anyone?

--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/H6TQFFG3QZDNC4EJGROYLJVWU6L57XBA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to