Created
August 29, 2008 02:48
-
-
Save jugyo/7885 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
class Test: | |
@classmethod | |
def test(self): | |
""" クラスメソッド | |
""" | |
print 'test' | |
@classmethod | |
def test2(self): | |
""" クラスメソッド2 | |
プライベートなクラスメソッドを呼び出す | |
""" | |
print 'test2' | |
self.__test() | |
@classmethod | |
def __test(self): | |
""" プライベートなクラスメソッド | |
""" | |
print '__test' | |
Test.test() | |
Test.test2() | |
Test.__test() | |
""" 実行結果 | |
$ python class_method_test.py | |
test | |
test2 | |
__test | |
Traceback (most recent call last): | |
File "import_test_lib.py", line 26, in <module> | |
Test.__test() | |
AttributeError: class Test has no attribute '__test' | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment