Hi,

when running a code analysis in PyDev 3.8.0, I noticed that
 - using 'cls' instead of 'self' as the name of the first parameter of a
metaclass instance method is flagged as an error (but see example in PEP
3115)
 - metaclass instance methods are not always recognized as attributes of
instances of the metaclass. Calling such method for an imported class is
flagged as an error

Here is minimal example:


meta_ca1.py:

class MyMeta(type):
    def create_instance(cls):          # flagged as error
        return 42

class MyClass(metaclass=MyMeta):
    pass

print(MyClass.create_instance())       # not flagged as error


meta_ca2.py

from .meta_ca2 import MyClass

print(MyClass.create_instance())       # flagged as error


Am I missing something?

Malte


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Pydev-users mailing list
Pydev-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-users

Reply via email to