proposal: replace decoration functions with decorate module

Issue #1152 resolved
Mike Bayer repo owner created an issue

The attached patch replaces all the eval/argspec stuff in util with the usage of the decorator module. This would add a dependency to SQLAlchemy's install, but the patch has a net code reduction of 350 lines (including some cleanup and removal of some other dead functions in util).

Comments (12)

  1. jek

    -1 for now. the stuff decorator stuff that's in there is small and well tested. i'd like to revisit later, when other non-dbapi dependencies are in play.

    there's a bunch of unrelated stuff in that patch that looks fine.

  2. Mike Bayer reporter

    is the concern that the decorators module is not as well tested as our homegrown code or that its not worth having a single dependency ? One advantage to going to 'decorators' now is that we don't move further away from migrating to it later. Another is that the current code does the "string eval" thing in three places and it would be a lot cleaner if it were only in one. In that sense, our own util.decorators could be used the same way decorators is used in this patch...which would be my next proposal.

  3. jek

    the stuff in util and attributes is tightly tuned to what we're doing + a little more capable than decorators. using it for init (e.g.) adds a chunk of overhead.

  4. Mike Bayer reporter

    Replying to guest:

    Meta-question: How do I add my email address to the CC-list of this bug?

    if theres no "Cc:" edit field for you, just send me your email address to mike_mp at zzzcomputing.com . or point me to where I have trac misconfigured since this is an annoying issue.

  5. Mike Bayer reporter

    took a look at the newly publicized FunctionMaker interface and didn't see a huge win on that. this would be used in theory for the __init__ decoration. its not occurring to me how using FunctionMaker directly would be better than the usage of @decorator I have in the patch - it seems complicated and doesn't save me the need to call inspect.getargspec() and similar, if I'm going to render the code as a string. whereas using decorator I don't have to deal with strings at all.

  6. Log in to comment