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

meta classes + if + array indexing + setattr completion #25

Closed
dbrgn opened this issue Oct 2, 2012 · 2 comments
Closed

meta classes + if + array indexing + setattr completion #25

dbrgn opened this issue Oct 2, 2012 · 2 comments
Labels

Comments

@dbrgn
Copy link
Collaborator

dbrgn commented Oct 2, 2012

Oh, you thought reverse iterators were too easy?

class _TrackingMetaclass(type):
    def __init__(cls, name, bases, attrs):
        if hasattr(cls, '_bazinga'):
            IncredibleClass._registry.append(cls)

class IncredibleClass(object):
    __metaclass__ = _TrackingMetaclass
    _registry = []

class Eggs(IncredibleClass):
    _bazinga = True

class Bacon(IncredibleClass):
    pass

class Spam(IncredibleClass):
    _bazinga = None
    number = '01189998819991197253'

yoda = Bacon()
setattr(yoda, '_omgwtf', Eggs._registry)
yoda._omgwtf[1].number.<tab>

...doesn't work. There you go, Jedi sucks so much!

☀️ Cheers! ☀️

@davidhalter
Copy link
Owner

This is really crazy :-D It took me 10 minutes to understand what you actually did. It seems like that Jedi really sucks. So much. :-)

@davidhalter
Copy link
Owner

Meta classes are being ignored for now. Maybe I'll add support for typical use cases of meta classes (e.g. django).

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

No branches or pull requests

2 participants