pylint-bot / astroid-unofficial

UNOFFICIAL playground for astroid github migration
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Metaclass evaluation #173

Open pylint-bot opened 9 years ago

pylint-bot commented 9 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore)


There's a big potential of improvements regarding the metaclasses. We should definitely have some sort of evaluation, for code such as the following:

#!python

import six

class A(type):
   def __call__(cls):
        return 42

@six.add_metaclass(A)
class B(object):
   pass

b = B()
print(b.f) # b is an integer

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):


We could try to respect this as much as possible: https://docs.python.org/3/reference/datamodel.html?highlight=metaclass#customizing-class-creation