Copy constructors

Bengt Richter bokr at accessone.com
Sun Aug 12 23:20:10 EDT 2001


On Sun, 12 Aug 2001 01:35:16 GMT, Guido van Rossum <guido at python.org> wrote:

>Glyph Lefkowitz <glyph at twistedmatrix.com> writes:
>
>> Am I correct in understanding from this thread that there is an intent to
>> remove the ability to assign an instance's __class__ attribute?
>
>Yes, I'd like to remove this.  See my previous post in this thread for
>more of an explanation of the problem.  But I haven't decided yet!
>This thread will help me figure out how big of a deal it will be.
>
Assigning to an instance's __class__ attribute strikes me as a kind of in-place
coercion of the instance to a new type/class (hopefully compatible ;-).

Could it be handled as a standard coercion (which might fail safely on its own
terms) and assignment, optimized down to rebinding __class__ when some kind of
fast check revealed that that was safe?

I guess it comes down to what assumptions you want to be able to preserve (and/or
provide checks and alternate handling for) through read/compile/load/execute phases
and their permutations -- but whatever is allowed, the result must be blamable
on the programmer ;-)




More information about the Python-list mailing list