Ticket #593 (closed defect: fixed)
Decorators implementation
| Reported by: | vitja | Owned by: | scoder |
|---|---|---|---|
| Priority: | major | Milestone: | 0.16 |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description
Now decorators are implemented like this:
def foo(): pass foo = decorator(foo)
- first declare function in current scope
- then decorate it
This is not a big issue now, but when we will support function reassignment take a look at this example:
class Foo(object): _x = 0 @property def x(self): return self._x @x.setter def x(self, value): self._x = value # this code will be transformed into this class Foo(object): _x = 0 def x(self): return self._x x = property(x) def x(self, value): self._x = value x = x.setter(x) # this will raise AttributeError exception # as second x() doesn't have setter attribute
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

