What is a type error?

Marshall marshall.spight at gmail.com
Fri Jul 14 11:31:32 EDT 2006


Joachim Durchholz wrote:
> 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.

Yes.


>  > 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.

It is a fair critque. I'll try to be more precise.


Marshall




More information about the Python-list mailing list