Created
March 5, 2020 18:48
-
-
Save w495/a643fbd88509b223afbf60700e0b158b to your computer and use it in GitHub Desktop.
Пример использования приватных методов модуля в классе
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import logging | |
__logger = logging.getLogger(__name__) | |
def global_function(): | |
__logger.error('global_function') | |
class Base(object): | |
def base_function(self): | |
""" | |
:raises NameError: name '_Base__logger' is not defined | |
""" | |
__logger.error('base_function') | |
if __name__ == '__main__': | |
__logger.error('main call') | |
global_function() | |
b = Base() | |
b.base_function() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment