| Decoratorys. Ŭ·¡½º, ±â´É ¹× ¸ÞŸ Ŭ·¡½º µ¥ÄÚ·¹ÀÌÅÍ - ÆÄÀ̽ã 2.3 (ÀÌÁ¦ »ý¼º µÈ Äڵ忡 ´ëÇÑ ¼Ò½º µð¹ö±ëÀÌÀÖ´Â)¿¡¼µµ! |
Áö±Ý ´Ù¿î·Îµå |
Decoratorys. ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À̸§:
- Phillip J. Eby
Decoratorys. ű×
Decoratorys. ¼³¸í
Ŭ·¡½º, ±â´É ¹× ¸ÞŸŬ·¡½º µ¥ÄÚ·¹ÀÌÅÍ - Python 2.3 (ÀÌÁ¦´Â »ý¼º µÈ Äڵ忡 ´ëÇÑ ¼Ò½º µð¹ö±ëÀÌ Æ÷ÇÔ)! µ¥ÄÚ·¹ÀÌÅ͸¦ »ç¿ëÇÏ°í ½ÍÁö¸¸ ¿©ÀüÈ÷ Python 2.3À» Áö¿øÇؾßÇմϱî? ¼ö¾÷ µ¥ÄÚ·¹ÀÌÅ͸¦ °¡Áú ¼ö ÀÖ°í, ÀÓÀÇÀÇ ÇÒ´çÀ» ²Ù¹Ì°Å³ª Àå½Ä µÈ ±â´É ¼¸íÀ» ¿ø·¡ ±â´ÉÀ¸·Î ÀÏÄ¡½Ãų ¼ö ÀÖ¾ú½À´Ï±î? ¸ÞŸ Ŭ·¡½º¸¦ ¸¸µéÁö ¾Ê°í ¸ÞŸŬ·¡½º ±â´ÉÀ» °¡Á® ¿À·Á°í? µ¿±âÈ µÈ ¹æ¹ýÀº ¾î¶»½À´Ï±î? DecoraTortools´ÂÀÌ ¸ðµç °ÍÀ» ¾ò´Â ÆÄÀ̽㠸ðµâÀÔ´Ï´Ù. ÀϺΠºü¸¥ ¿¹ : # ¸Þ¼Òµå decorator exampleFrom peak.util.Decorators decorateClass demo1 (°´Ã¼) °¡Á® ¿À±â : @classmethod def ¿¹Á¦ (CLS) : @classmethod ¿¹Á¦ (CLS) : "Hello from", CLS # Ŭ·¡½º Decorator exampleFrom peak.util. µ¥ÄÚ·¹ÀÌÅÍ °¡Á® ¿À±â Decorate_classdef MY_CLASS_DECORATER (CLS) : DEF Decorator (CLS) : Àμâ "Àå½Ä", CLS RETURN CLS DECRATE_CLASS (Decorator) Ŭ·¡½º DEMO2 : MY_CLASS_DECORATOR () # "DECORTORTOOLS ("»ç¿ë) Easy_install decoRoTools "¶Ç´Â"setup.py install ")Àº peak.util.Decorators ¸ðµâ¿¡ ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ¸ðµâÀÇ µµ±¸´Â Peak, Pyprotocols, Ruledispatch ¹× Zope.Interface ÆÐÅ°ÁöÀÇ ³»ºÎ¿¡¼ ¼ö³â µ¿¾È ¹øµé·Î Á¦°øµÇ¾î ³Î¸® »ç¿ëµÇ°í Å×½ºÆ®µÇ¾ú½À´Ï´Ù. (¹°·Ð ´ÜÀ§ Å×½ºÆ®°¡ Æ÷ÇԵ˴ϴÙ.)ÀÌ µ¶¸³ ½ÇÇà Çü ¹öÀüÀº ¹øµé ¹öÀü°ú ¿ª ȣȯ µÇ¹Ç·ÎÀÌ ÆÐÅ°Áö¿¡¼ Zope.Interface, Turbogears µîÀÌ Á¦°øÇÏ´Â ÇÁ·ÎÁ§Å͸¦ È¥ÇÕÇÏ°í ÀÏÄ¡½Ãų ¼ö ÀÖ½À´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽ã
Decoratorys. °ü·Ã ¼ÒÇÁÆ®¿þ¾î