Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

func_noerror_mcs_attr_access.py 511B

1234567891011121314151617181920
  1. # pylint: disable=R0903, metaclass-assignment
  2. """test attribute access on metaclass"""
  3. from __future__ import print_function
  4. class Meta(type):
  5. """the meta class"""
  6. def __init__(cls, name, bases, dictionary):
  7. super(Meta, cls).__init__(name, bases, dictionary)
  8. print(cls, cls._meta_args)
  9. delattr(cls, '_meta_args')
  10. class Test(object):
  11. """metaclassed class"""
  12. __metaclass__ = Meta
  13. _meta_args = ('foo', 'bar')
  14. def __init__(self):
  15. print('__init__', self)