æ¿åï¼Pythonã®ãã³ã¬ã¼ã¿(decorator)ãç解ãã 2 ãã³ã¬ã¼ã¿ã«å¼æ°ã渡ã ç´ æ´ããããã§ã¯ãã³ã¬ã¼ã¿èªèº«ã«å¼æ°ã渡ãã«ã¯ã©ããããããã®ã ãããï¼ããã¦ããã³ã¬ã¼ã¿ã¯å¼æ°ã¨ãã¦é¢æ°ãåãå ¥ããå¿ è¦ãããã®ã§ã¡ãã£ã¨ãã£ããã ããã³ã¬ã¼ã¿ã«ç´æ¥ãã³ã¬ã¼ããããé¢æ°-å¼æ°ã渡ããã¨ã¯ã§ããªãããã ã 解決ãæ¥ãåã«ãã¡ãã£ã¨å¾©ç¿ããããã # ãã³ã¬ã¼ã¿ã¯'æ®é'ã®é¢æ°ã§ãã def my_decorator(func): print "I am a ordinary function" def wrapper(): print "I am function returned by the decorator" func() return wrapper # ãã®ããããªã«ã"@"ãªã©ä½¿ããã«å¼ã³åºããã¨ãã§ãã def lazy_function(): print "zzz
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}