What is a type error?

Joachim Durchholz jo at durchholz.org
Fri Jul 14 05:51:58 EDT 2006


Marshall schrieb:
> void foo() {
>   int i = 0;
>   int j = 0;
>   j = 1;
>   i = 2;
>   // check value of j here. It is still 1, no matter what you filled
 >   // in above.
>   // The assignment to i cannot be made to affect the value of j.
> }
> 
> Those two local primitive variables cannot be made to have the same
> identity.

Sure. To state it more clearly, they cannot be aliases.

 > But you can update them, so this is an example of mutability
> without the possibility of identity.

You're being a bit sloppy with terminology here. "Identity" in the 
phrase above refers to two entities, in the sense of "i and j cannot be 
identical".
Identity is actually a property of a single entity, namely that what 
remains constant regardless of what you do with the entity.

Regards,
Jo



More information about the Python-list mailing list