laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
(I've just trimmed the code back in http://perlmonks.com/?node_id=1030806 to use a closure rather than a class -- needed a class back when it was a coroutine... not so much anymore)
Here be Python...
A decorator in python is just syntactic sugar, remembering that Python has first class functions and classes:
A decorator doesn't have to return a callable -- eg you could decorate class SomeClass with @id, and get a fairly useless number bound to the name SomeClass. And in theory you could fiddle with the code in the callable that's passed, and return the identical object but you wouldn't. One cannot @decorate a lambda, and "_" as a name is just convention. In reply to Re^7: RFC: Simulating Ruby's "yield" and "blocks" in Perl (Python)
by MonkOfAnotherSect
|
|