Can I reference 1 instance of an object by more names ? rephrase

Peter Otten __peter__ at web.de
Thu May 24 17:46:47 EDT 2007


Stef Mientki wrote:

> Maric Michaud wrote:

   def bit(index):
>>     def fset(self, value):

>>         value    = ( value & 1L ) << index
>>         mask     = ( 1L ) << index
>>         self._d  = ( self._d & ~mask ) | value
>>     def fget(self):

>>         return ( self._d >> index ) & 1
>>     return property(**locals())
>> 
>> 
>> class cpu_ports(object) :

       p1 = bit(1)
       p2 = bit(2)
       p3 = bit(3)
       p4 = bit(4)
       p5 = bit(5)

> Looks good, but I miss the index :-(

No more.

Peter



More information about the Python-list mailing list