operator overloading + - / * = etc...
apardon at forel.vub.ac.be
Mon Oct 9 13:27:40 CEST 2006
On 2006-10-08, Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> wrote:
> On Sat, 07 Oct 2006 17:21:55 -0500, Tim Chase wrote:
>>>> With the caveat of the "=" mentioned in the subject-line (being
>>>> different from "==")...I haven't found any way to override
>>>> assignment in the general case.
>>> Why would you want to do that?
>> For the same reason one would use property() to create
>> getter/setter functions for a particular variable--to intercept
>> attempts to set a variable.
> Despite sloppy talk to the contrary (which I think most of us do from time
> to time), Python doesn't have variables. It has names and objects. Names
> are just labels -- there is no difference in behavior between the *names*
> this_is_an_integer and this_is_a_string. (The *objects* they point to are
> a different story, naturally.)
I honestly don't see why "variable" would be an inappropiate word to use.
AFAIU, python assignment seems to behave much like lisp and smalltalk
and I never heard that those communities found the word "variable"
inappropiate to use. And since the word variable originally comes
from mathematics and IMHO the mathematical semantics are closer
to the lisp/smalltalk/python semantics than the C/algol/pascal/ada
semantics I don't see why "variable" is seen as "sloppy talk"
More information about the Python-list