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
Python-Dev@python.org
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