Re: [Hampshire] Python query

Top Page
Author: Chris Smith
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Python query

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x57ab8100.hantslug.org.uk.21935': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Wed Apr 29 14:03:46 2009 BST
gpg: using DSA key 11BEF6408586B4B2
gpg: Can't check signature: No public key
Hugo Mills wrote:
[on creating a Python class]
>
>    Is there an way I can sanely make this class behave like an
> integer-with-extensions, with the value of .value?

>
> i.e., allowing behaviours something like this:
>
> x = Foo()
> x = 4              # This one may be a bit tricky. :)
> x += 3
> print x - 2


You can redefine certain operators: __add__(), __sub__(), __mul__(),
etc. Unfortunately you don't appear to be able to do that for the
assignment operator. :(

Chris
--
Chris Smith <cjs94@???>