Tapping into the access of an int instance

James Stroud jstroud at mbi.ucla.edu
Thu Sep 20 20:46:01 EDT 2007


Tor Erik Sønvisen wrote:
> Hi,
> 
> Does anyone know how to interrupt the lookup of an integer value? I
> know I need to subclass int, since builtin types can't be altered
> directly...
> 
> Below is how far I've come... What I want is to tap into the access of
> instance i's value 1...
> 
>>>> class Int(int):
> 	def __init__(self, *a, **k):
> 		super(Int, self).__init__(self, *a, **k)
> 
> 		
>>>> i = Int(1)
>>>> i
> 1
> 
> Regards,
> Tor Erik

Perhaps you could elaborate on what you want to do with that value once 
you "tap" it.



More information about the Python-list mailing list