On 9/18/20 3:12 PM, Guido van Rossum wrote:
On 9/18/20 2:44 PM, Ethan Furman wrote:
I'm looking for arguments relating to:
- should _convert_ make the default __repr__ be module_name.member_name?
I actually like the status quo for regular enums, when repr() shows the type, name and value, and str() shows "classname.flagname", so I'd stick to that for converted flags. Even though this violates the rule of thumb that repr() should look like a valid expression -- perhaps a stronger rule of thumb is that repr() should show more than str().
Well, if the repr is re.IGNORECASE and the str is 2, then we've met that bar. ;-)
- should _convert_ make the default __str__ be the same, or be the numeric value?
Showing just (the str of) the value seems unkind, since e.g. showing '4'makes me think it's just an int. (Then again I can see that for *converted* flags that's not unreasonable.)
But yeah, backwards compatibility. However, I don't think we got any complaints about the `re` flags, did we?
The only complaints I'm aware of were before the re constants became an Enum, but my social media activity consists almost entirely of Stackoverflow.
So at this point, I think the choices are:
Standard Enum __repr__ __str__ <RegexFlag.IGNORECASE: 2> RegexFlag.IGNORECASE
Modified Converted Constant __repr__ __str__ re.IGNORECASE 2
I will admit I fancy the MCC variant more, but we should make a choice and then be consistent.