Re: [Python-Dev] Semantics of __int__(), __index__()

2013年4月04日 08:04:38 -0700

On 2013年04月04日, at 16:47 , Chris Angelico wrote:
> Sure, I could override __new__ to do stupid things
Or to do perfectly logical and sensible things, such as implementing
"cluster classes" or using the base class as a factory of sorts.
> in terms of logical expectations, I'd expect
> that Foo(x) will return a Foo object, not a Bar object.
The problem is the expectation of what "a Foo object" is: type-wise, any
Bar object is also a Foo object. I would not expect Foo() to return an
object of a completely unrelated type, but returning an object of a
subtype? That does not seem outlandish.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to