?ã³ã³ã¹ãã©ã¯ã¿ã®å¼æ° Pythonã®ã³ã¼ãã®ã³ã³ã¹ãã©ã¯ã¿ã§ã¯ç¬¬ä¸å¼æ°ã«ãselfããæå®ãã¦ããã¾ãã ããã¯Javaã§è¨ããthisãã§ãã(selfã¯ãããã¹ãã¨ãã£ã¿ã§ã¯ãã¤ã©ã¤ãããã¾ã) Pythonã§ã¯ãJavaã§è¨ããthisããæ示çã«ãselfãã¨æå®ãã¦ããã¾ãã ãself.foo = barãã¯ã¤ã³ã¹ã¿ã³ã¹å¤æ°fooã宣è¨ã¨åæã«åæåãããã¨ã«ãªãã¾ãã ãdef printFoo(self):ããåæ§ã«ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã Python15åè¬åº§ #3 ï¼ã¯ã©ã¹ï¼ - t_nagataã®æ¥è¨ ãã®è¾ºã¯é çªã«èãã¦ããã¨åãããããããã§ãï¼ ããï¼ããã ã㧠Python åå¼·ãã¹ãã£ã¦æãããã ã¤ã³ã¹ã¿ã³ã¹ã«å¤ã追å ãã¦ã¿ã class Hoge(object): pass hoge = Hoge() hoge.a = 10 // hoge ã« a ã
{{#tags}}- {{label}}
{{/tags}}