Official definition of call-by-value (Re: Finding the instance reference...)

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Wed Nov 19 04:21:12 CET 2008


On Tue, 18 Nov 2008 15:55:10 -0500, Terry Reedy wrote:

> Steven D'Aprano wrote:
>> On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote:
> 
>> For example, consider the two electrons around a helium nucleus. They
>> have the same mass, the same speed, the same spin, the same electric
>> charge, the same magnetic moment, they even have the same location in
>> space (technically, the same wave function).
> 
> By quantum mechanics (Pauli Exclusion principle), this is impossible.

Ah yes, you're right. Oops.

However, my point remains if you consider electrons in two atoms, and 
remove the "same location in space". 

[...]
>>> For example, you can define the value of None however you want, but it
>>> seems clear that it has (and needs) no intrinsic-value.
>> 
>> To me, that seems just as silly as arguing that zero is not a number,
> 
> To me, that distortion of his (and my) point is silly.  0 partipipates
> in numerous integer operations, whereas None participates in no NoneType
> operations.  (Neither has attributes.)  And that is the difference he is
> pointing at.

Why do you care about built-in NoneType operations? Why don't we count 
the infinite number of useful operations we can do to None that merely 
happen to not be built-in to the type?

We can convert None to a bool: bool(None)
We can append it to a list: alist.append(None)
We can convert it to a string: str(None), repr(None)
(In Python 2.6) We can ask how many bytes the None object uses.
We can ask the garbage collector how many objects refer to it: 
gc.get_referrers
We can count how many words have been written debating whether or not 
None is a value.

and so forth. These operations aren't methods on NoneType but that is not 
of any importance. The richness or poverty of methods in a class is 
irrelevant.

(I trust that nobody is going to raise yet another irrelevant detail and 
argue that since None is immutable, these operations don't actually do 
anything *to* None. Ints are immutable too, and nobody argues that int(5) 
has no value because operations on it don't do anything to it.)

It is useful and convenient to have "null values" like None, but it isn't 
useful to say that None is not a value. What does it gain you, other than 
losing the useful ability to say "the value of x is None"?



-- 
Steven



More information about the Python-list mailing list