Label-Value (was: Re: Inheriting the @ sign from Ruby)
Thomas Wouters
thomas at xs4all.net
Tue Dec 12 12:14:42 EST 2000
On Tue, Dec 12, 2000 at 11:46:48AM -0500, Roy Katz wrote:
> > (Hint: Everything is a reference to an object. Variables are
> > named references, not actual objects. Some objects can be
> > modified in place. Some cannot be modified. That's all)
>
> Okay! tell me, which are the objects which cannot be modified in place?
The immutable ones. Those include the numeric types, tuples and strings, and
classes that define themselves as immutable.
> Pardon my choice of diction, but I am against inventing new terminiologies
> (modified-in-place??).
Mutable. Of the builtin types, that's lists, dictionaries, arrays, and most
classes.
> While I'm brainstorming with Python grammar changes, what about a real &
> operator.
What would the real & operator do ? I assume here you mean the unary & from
C, the 'address-of' operator ? The binary & already exists, and does exactly
what it does in C. If you want to know if an object you have now is the same
object as you had previously, either store a reference to it and compare it
using 'is', or use the 'id()' builtin. You can't convert the number returned
by 'id' into a reference, though, for a lot of reasons -- the most important
of which is "that isn't the Python way" :) The rest have to do with data
integrity, reference-counting isues, code sanity, and lots more.
--
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list
mailing list