[Python-Dev] Extended Function syntax

Lalo Martins lalo@laranja.org
Wed, 29 Jan 2003 11:59:23 -0200


On Wed, Jan 29, 2003 at 01:32:11AM -0500, Guido van Rossum wrote:
> I have no idea what you mean by this.  This doesn't look like Python
> at all.

I guess he meant that a method that has its first argument named "class" is
automagically a class method.  I strongly object.

(Besides, he seems to want a class __init__, which isn't really needed -
this is what the class declaration body is for)

However this could work:

class Foo(object):
    myprop = property:
	"""A computed property on Foo objects."""
	def __get__(self):
	    return ...
	def __set__(self, value):
	    ...
	def __delete__(self):
	    ...

This would call property() with the results of parsing the indented block.
Not sure yet this is a good idea, but it could have many other (possibly
good, possibly harmful) uses.

[]s,
                                               |alo
                                               +----
--
            Those who trade freedom for security
               lose both and deserve neither.
--
http://www.laranja.org/                mailto:lalo@laranja.org
         pgp key: http://www.laranja.org/pessoal/pgp

Eu jogo RPG! (I play RPG)         http://www.eujogorpg.com.br/
GNU: never give up freedom                 http://www.gnu.org/