ルビーではこれを行うことができます:
class A
def self.a
'A.a'
end
end
puts A.a #-> A.a
Pythonでこれをどのように行うことができますか。クラスのインスタンスで呼び出されることなく呼び出されるクラスのメソッドが必要です。これを実行しようとすると、次のエラーが発生します。
unbound method METHOD must be called with CLASS instance as first argument (got nothing instead)
これは私が試したものです:
class A
def a():
return 'A.a'
print A.a()