>> mydie = Die(mydie.n,5) >> >> And I believe you can do that by implementing the __coerce__ >> method. - but I've never tried it... > > If you can do that with __coerce__, I'm not clever enough to figure > out > how. IIRC, Python only calls __coerce__ if you're using arithmetic > operators on different types, and only if the operator in question > isn't > overloaded to handle this case.
You are quite right, Python doesn't know that you don't really want to to just assign an integer. It is only in an expression that python can guess what you mean. So the only way to do it would be explicitly myDie = Die(myDie.n, 5) Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor