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/044004.html below:

[Python-Dev] PEP 318: Properties

[Python-Dev] PEP 318: Properties [Python-Dev] PEP 318: PropertiesSkip Montanaro skip at pobox.com
Sat Apr 3 16:24:57 EST 2004
    Phillip> Technically, what you show is not the actual expansion of the
    Phillip> new syntax.  The new syntax applies decorators before binding
    Phillip> 'x' to the new function.  So, the old value of 'x' is available
    Phillip> to a decorator via sys._getframe().f_locals.  This technique is
    Phillip> also useful for implementing generic functions and/or
    Phillip> multimethods, signature-based overloading, etc.

How would this be interpreted?

    x = 42

   def x(self) [propget]:
       "Doc string for x"
       return self.__x

   def x(self, newx) [propset]:
       self.__x = newx

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

That is, there is already an (otherwise invalid) 'x' in the calling scope
when propget() is called.  Do the property doodads just need to be
bulletproofed or should an exception be raised?

Skip

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