Skip to content

Conversation

gasparka
Copy link

Low hanging fruit!

return "".join(map(lambda x: x.capitalize(), baron_type.split("_"))) + "Node"


from functools import lru_cache

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imports should be top level

return "".join(map(lambda x: x.capitalize(), baron_type.split("_"))) + "Node"


from functools import lru_cache

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functools.lru_cache is python3 only and will not work in python2. It might be easy to write a cache decorator with no max size:

def memoize(function):
    memo = {}

    @wraps(function)
    def wrapper(*args):
        if args in memo:
            return memo[args]
        else:
            rv = function(*args)
            memo[args] = rv
            return rv
    return wrapper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants