Case Statements

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Mar 17 01:45:29 EDT 2016


Steven D'Aprano wrote:
> On Thu, 17 Mar 2016 11:31 am, Chris Angelico wrote:
> 
>>    orig = globals()[cls.__name__]
> 
> I wouldn't want to rely on it working with decorator syntax either. Even if
> it does now, I'm not sure that's a language guarantee.

The following idiom relies on similar behaviour:

     @property
     def x(self):
         return self._x

     @x.setter
     def x(self, value):
         self._x = value

That's taken from the official docs, so I don't think
this is likely to change any time soon.

-- 
Greg



More information about the Python-list mailing list