Re: vote on prop keyword
Paul Prescod <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
> object Widget:
> price = 3.72
> object tax(Property):
> def get_():
> return self.price * 0.03
>
Doesn't work for me in build 710. (see below)
Mark Hahn wrote:
>...
>
> Vote FOR the keeping the keyword or AGAINST the keyword and just typing out
> the object statement.
Can I vote AGAINST the object syntax? ;)
To my Python-trained brain I can't see how it would work.
object Widget:
price = 3.72
object tax(Property):
def set_(abc):
...
Widget().tax = 15
Doesn't this _rebind_ .tax rather than calling it? How is the "Property"
object implemented so that it can prevent its own rebinding? Can I use
this elsewhere? At the top level:
object foo(Property):
def set_(abc):
...
foo = 5 # calls set_ instead of rebinding???
Here's my test of your Property syntax:
paul:/tmp pprescod$ cat test.pr
#!/usr/local/bin/prothon
print "Hello world"
object Widget:
price = 3.72
object tax(Property):
def get_():
return self.price * 0.03
paul:/tmp pprescod$ ./test.pr
Hello world
Uncaught exception:
--- File: ./test.pr, line: 11, char: 2
--- File: <null>, line: 7, char: 25
Name Error, prototype $Property not found.
Paul Prescod