[Python-Dev] Re: Extended Function syntax (original) (raw)
Arne Koewing ark@gmx.net
Wed, 29 Jan 2003 18:32:56 +0100
- Previous message: [Python-Dev] Extended Function syntax
- Next message: [Python-Dev] Extended Function syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum <guido@python.org> writes:
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. Funny, I had a vision of something very similar this morning in the shower. :-) The problem is that this is a very radical change to the grammar, and I'm not sure I can rigorously define how the switch from "expression parsing mode" to "block parsing mode" should work.
If we have:
def f(x) [function_that_takes_f]: pass
what about an block-variant:
blockdef my_thing [function_that_takes_dict_of_the_block_definition] ...block...
so we could write:
blockdef myprop [property]:
def get(self):
return ...
def set(self, value):
...
def delete(self):
...
(replace blockdef with your favorite new keyword...)
- Previous message: [Python-Dev] Extended Function syntax
- Next message: [Python-Dev] Extended Function syntax
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]