Re: [Python-Dev] Fwd: str(IntEnum)

2015-02-20 Thread Ian Cordasco
On Fri, Feb 20, 2015 at 12:36 PM, Florian Bruhin m...@the-compiler.org wrote: * Demian Brecht demianbre...@gmail.com [2015-02-20 10:24:53 -0800]: These and other implementations return a string representation of the instance’s value, not a string representation of the object itself. Whereas

[Python-Dev] Fwd: str(IntEnum)

2015-02-20 Thread Demian Brecht
On Feb 20, 2015, at 8:54 AM, Brett Cannon br...@python.org wrote: Concrete reason. The string is 'MyEnum.FOO' which is much more readable and obvious where the value came from. The fact that it can be treated as an int is the same as the reason True and False are subclasses of int; it made

Re: [Python-Dev] Fwd: str(IntEnum)

2015-02-20 Thread Florian Bruhin
* Demian Brecht demianbre...@gmail.com [2015-02-20 10:24:53 -0800]: These and other implementations return a string representation of the instance’s value, not a string representation of the object itself. Whereas elsewhere in the standard library: str(ProtocolError('url', 42, 'msg', ''))

Re: [Python-Dev] Fwd: str(IntEnum)

2015-02-20 Thread Ethan Furman
On 02/20/2015 10:24 AM, Demian Brecht wrote: I think that a decent rule around the usage of __str__ is that it should be a string representation of the value, not of the object. Failing the ability to logically coerce the value to a string, it should simply fall back to repr(obj). There are