たろマーク (はてなブックマーク)
-
[ api ][ phone ][ webservice ]
- Colorful Bokeh Effect in Pixelmator | Abduzeedo | Graphic Design Inspiration and Photoshop Tutorials
[ pixelmator ] -
[ pixelmator ]
-
[ python ] 結構ボリュームあるw python のみならず、チームの開発サイクルとか、実際にどう活用していくかと言うことが書いてありそうで wktk
■ メソッド一覧を取得する dir
python では、dir 関数で、引数に渡した object の method 一覧が見られる。
>>> class Hoge(object): ... def bar(self): ... pass ... >>> hoge = Hoge() >>> >>> dir(hoge) ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'bar']
ruby だと methods だっけ?
>> class Hoge >> end => nil >> ?> hoge = Hoge.new => #<Hoge:0x101315f40> >> hoge.methods => ["inspect", "tap", "clone", "public_methods", "object_id", "__send__", "instance_variable_defined?", "equal?", "freeze", "extend", "send", "methods", "to_yaml", "hash", "to_yaml_properties", "dup", "to_enum", "instance_variables", "eql?", "instance_eval", "id", "singleton_methods", "taint", "frozen?", "instance_variable_get", "enum_for", "instance_of?", "display", "to_a", "method", "type", "instance_exec", "protected_methods", "==", "===", "taguri", "instance_variable_set", "kind_of?", "respond_to?", "taguri=", "to_s", "class", "private_methods", "=~", "tainted?", "__id__", "untaint", "nil?", "to_yaml_style", "is_a?"]
でした。






