私はこのような何か場合:私は次のエラーを取得 class MyClass(object):
def __init__(self, a=MyClass.f):
self.a = a
@classmethod
def f():
print 'tump drump'
:明らか NameError: name 'MyClass' is not d
クラスとインスタンスのメソッドを定義するモジュールと、それを継承する2番目のクラスを含むクラスのRubyの例を考えてみましょう。 module Z
def self.included(base)
class << base
def classmethod
puts "Hello, I'm #{__method__} in #{self}"
e
をクラスメソッドハイブリッド私は今です: class A:
def method(self = None, *params): code
# or
def method2(self = None, **params): code
# but what I need is rather normal parameters, not optional and n