News for hackers. Stuff that matters.
Re:Goto decorator for python by sitkack on Sunday March 11, 2012 @10:27PM (#3692099)
You can find the line number that the func was defined in and reparse the source. I do this in quite a few decorators that need source.

The other option is to wrap the thing decorated in a doc string

    @fancy_source_needing_decorator
    def foo(s):
        """
        put some haskell or DSL stuff in here
        """
Then you don't have to reparse the source, etc etc, but it still gets packaged as a function.
Re:Goto decorator for python by drx on Monday March 12, 2012 @05:12AM (#3692783)
Would you mind linking to some examples? I'd love to read them.
Re:Goto decorator for python by cheatercheater on Monday March 12, 2012 @08:37PM (#3696417)
I remember this being used in a unit testing framework of some sort.. maybe twisted's?