Hey yes it's working that way. But I don't like it very much either. If as OKB
said the whole point is that outside functions can't detect a property then I'm
going to stick with the non-decorator way. Thanks anyway.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Nov 10, 2011 at 9:17 PM, Laurent wrote:
> Yes using a separate class variable would transfer the problem to the class
> level. But adding 10 class variables if I have 10 properties would be ugly.
> Maybe I should reformulate the subject of this thread to "is there some
> python magic to
Laurent wrote:
> Yes using a separate class variable would transfer the problem to
> the class level. But adding 10 class variables if I have 10
> properties would be ugly. Maybe I should reformulate the subject of
> this thread to "is there some python magic to pass parameters to
> decorator-decl
Yes using a separate class variable would transfer the problem to the class
level. But adding 10 class variables if I have 10 properties would be ugly.
Maybe I should reformulate the subject of this thread to "is there some python
magic to pass parameters to decorator-declared properties ?"
--
On Nov 11, 2:03 pm, Laurent wrote:
> Hi. I couldn't find a way to overwrite a property declared using a decorator
> in a parent class.
> class Polite:
> @property
> def greeting2(self, suffix=", my dear."):
> return self._greeting + suffix
Here you set up greeting2 as a property
Hi. I couldn't find a way to overwrite a property declared using a decorator in
a parent class. I can only do this if I use the "classic" property() method
along with a getter function. Here's an example:
#!/usr/bin/python3
class Polite:
def __init__(self):
self._greeting = "He