anything like C++ references?

Stephen Horne intentionally at blank.co.uk
Sun Jul 13 17:52:46 EDT 2003


On Sun, 13 Jul 2003 16:57:18 -0400, "Tim Peters" <tim.one at comcast.net>
wrote:

>[Stephen Horne]
>> ...
>> The fact is that 'assignment' has a common meaning separate from the
>> choice of programming language,
>
>Well, that's not a fact, although there may be much commonality among the
>(necessarily few, if you believe this) programming languages you've used.
>Python's assignment semantics are in fact common among languages
>higher-level than those of the Fortran/COBOL/Algol/C ilk.  For examples,
>Lisp, SNOBOL4, Scheme, Smalltalk and Icon are (very) much like Python in
>this respect.  So is Java in the end, although the underlying machinery is
>more complicated there.
>
>> and that the way Python handles name binding means that meaning is not
>> respected by Python for mutable objects.
>
>Python's assignment semantics don't vary according to object type.

OK then. With reference to another of my posts...

1.  Why are dictionarys called dictionaries (rather than references to
dictionarys or whatever)? Similar for lists and class instances.

2.  Why are the values of mutable objects always forced to be accessed
via a pointer (or reference or whatever)?

Note - whether it makes sense to allow in-place changes to part or all
of a value is not the same as whether it makes sense to reference that
value indirectly.

3.  Why is there no way to reference an immutable object via a
pointer, other than stuffing it into a mutable object designed for
some purpose other than simple pointer behaviour?

This excuse is, as I already said, invalid.

>Well, I can assure you Guido wouldn't change anything about Python's
>assignment semantics if were able to do it all over from scratch.  That's a
>puzzle for you to work out, then:  is Guido unique, or are all Dutch people
>that stupid <wink>?

Your words, not mine. I simply point out that no-one, BDFL or
otherwise, can be perfect.





More information about the Python-list mailing list