> > My questions: > - is the '==' operation a 'list' comparison - rather than a pointer > comparison? (my experiments seem to indicate that it is a 'list' > comparison)
Forget pointers and all you ever knew of them from C. Trying to think of Python in terms of Pointers is ultimately an excercise in frustration. Python uses dictionaries for its indirection not memory addresses. > - if this is the case, then why does the 'if L==[5]' test still catch > later on, when the 'L' should no longer be a '[5]' list? It shouldn't! Are you absolutely sue about that? I didn't see a case in your examples where the [5] case would fail... > - if this is *not* the case then, then how do you determine the '==' > is supposed to match? It should match if both are [5] > - or is this a matter of 'compare by value' first, then after we get a > match, we 'compare by reference' later on??? The actual semanics of omparisons for all Pythons types are described in the Language reference. But mostly you can ignore it and it will just work... Alan G Author of the Learn to Program web tutor http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
