A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-April/043922.html below:

[Python-Dev] PEP 318 -- a couple use cases

[Python-Dev] PEP 318 -- a couple use casesGuido van Rossum guido at python.org
Thu Apr 1 16:56:37 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:
>    - no sys._getframe magic
> Disadvantages:
>    - you have to type the property/function name twice
>    - you have to do something special for the first def
>    - you can't easily rearrange the defs

I see no big advantage to this solution; the requirement to type the
name an extra time seems arbitrary.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4