mnba / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

no support for @x.setter syntax #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
No support for @property

What steps will reproduce the problem?
    @property
    def Width(self): 
        return self.x2 - self.x1
    @Width.setter
    def Width(self, width):
        self.x2 = self.x1 + width

*ERROR* Rectangle.py:208: function/class redefinition is not allowed 
('Width')

What version of the product are you using?
Ubuntu Shedskin 4.0.deb

Original issue reported on code.google.com by mcdonald...@gmail.com on 21 Apr 2010 at 3:33

GoogleCodeExporter commented 9 years ago
thanks for reporting. shedskin supports @property and most uses of property, 
but not
yet the 'setter' syntax. it would have complained about this fact, if it didn't 
trip
over the seeming redefinition first.. :) in any case, I don't think this kind of
syntax would be hard to add. for now, if you need a workaround:

    def width_get(self):
        return self.x2 - self.x1

    def width_set(self, width):
        self.x2 = self.x1 + width

    Width = property(width_get, width_set)

note that this also works, but of course now there's no setter:

    @property
    def Width(self):
        return self.x2 - self.x1

Original comment by mark.duf...@gmail.com on 21 Apr 2010 at 9:52

GoogleCodeExporter commented 9 years ago
thanks again for reporting. this should work now.. could you please verify?

Original comment by mark.duf...@gmail.com on 19 May 2010 at 9:53

GoogleCodeExporter commented 9 years ago
assuming this works, closing..

Original comment by mark.duf...@gmail.com on 23 May 2010 at 11:27