以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2016/12/06/234859より取得しました。


pythonのクラスはただのオブジェクト

Rubyだと、クラスはClass型として扱われますね。

class Hoge
  def fuga()
    print(21)
  end
end

Hoge.class
#=> Class

ところが……pythonだと素のclassはobjectと同じく'type'を返します

class Sample:
  def func(str):
    print(str)

Class    = Sample
instance = Class()
print(type(object),type(Class),type(instance))
#>> <class 'type'> <class 'type'> <class '__main__.Sample'>



以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2016/12/06/234859より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14