Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useless cache in EventType #202

Closed
apollo13 opened this issue Jan 20, 2017 · 6 comments
Closed

Useless cache in EventType #202

apollo13 opened this issue Jan 20, 2017 · 6 comments

Comments

@apollo13
Copy link
Contributor

Currently EventType looks like this:

class EventType(type):

    __cache__ = {}

    def __new__(cls, name, bases, ns):
        key = (cls, name, bases)

        try:
            return cls.__cache__[key]
        except KeyError:
            cls = type.__new__(cls, name, bases, ns)

            setattr(cls, "name", ns.get("name", cls.__name__))

            return cls

I couldn't find any code setting something in the __cache__ -- should we just delete it or actually try using it?

@prologic
Copy link
Member

prologic commented Jan 21, 2017 via email

@spaceone
Copy link
Contributor

The whole class is useless in python3 because it is defined via __metaclass__ = ...

@apollo13
Copy link
Contributor Author

Guess we should add a test and use six.with_metaclass then. I wonder if we even need that metaclass, we can set the name by hand in __new__/__init__ of the class?!

@spaceone
Copy link
Contributor

we already do this

@prologic
Copy link
Member

prologic commented Jan 21, 2017 via email

@apollo13
Copy link
Contributor Author

seems to be the case according to the tests, I'll remove it for now.

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

No branches or pull requests

3 participants