The documentation implies that it's ok for __new__(cls, ...)
to return an object of a type different than cls
. It says in that case __init__()
won't be called. It's not stated explicitly, but common sense or a simple test confirms that the resulting the object won't have type cls
.
Why is this seemingly strange behavior allowed? What's the use case? It's clearly intentional.
No comments:
Post a Comment