[Python-Dev] PEP 318 -- a couple use cases (original) (raw)

Edward Loper edloper at gradient.cis.upenn.edu
Thu Apr 1 14:57:09 EST 2004


I'm wavering between 2 (perfectly acceptable) and 3 (somewhat hackish), only because I consider anything that uses sys.getframe() to be a danger to society unless proven innocent.

Would these be preferable:?

 class C(object):
     [property]
     def x(self): return self.__x

     [property_setter(x)]
     def x(self, val): self.__x = val

     [property_deleter(x)]
     def x(self): del self.__x

and: [generic(None, (int,int))] def f(x,y): print 'two ints'

 [generic(f, (float,float))]
 def f(x,y): print 'two floats'

I.e., explicitly pass the old value in, rather than grabbing it from sys._getframe.

Advantages:

-Edward



More information about the Python-Dev mailing list