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
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
* 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', ''))
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