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.

access_to__name__.py 624B

123456789101112131415161718192021
  1. # pylint: disable=too-few-public-methods, print-statement
  2. """test access to __name__ gives undefined member on new/old class instances
  3. but not on new/old class object
  4. """
  5. from __future__ import print_function
  6. class Aaaa: # <3.0:[old-style-class]
  7. """old class"""
  8. def __init__(self):
  9. print(self.__name__) # [no-member]
  10. print(self.__class__.__name__)
  11. class NewClass(object):
  12. """new class"""
  13. def __new__(cls, *args, **kwargs):
  14. print('new', cls.__name__)
  15. return object.__new__(cls, *args, **kwargs)
  16. def __init__(self):
  17. print('init', self.__name__) # [no-member]