Skip to content

[docs] How does @ez.timeit decorator work? #164

@cboulay

Description

@cboulay

I tried adding it to a subscriber/publisher method but that crashed; _, task_info = self._tasks[func.__name__] doesn't work because self._tasks[func.__name__] is a single function, not a tuple. And the function doesn't have an .address so it can't be used for the fstring in the log call anyway.

If I fix the above, then the function returns immediately because it's actually returning the generator method it's wrapping.
That makes me think that it's only intended to be used in a standalone function / method that isn't called by the framework, but then I can't consolidate why it has setattr(func, TIMEIT_ATTR, True).

I'll make a separate wrapper for my own uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions