SimpleTaits ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À̸§:
- Kuba Janoszek
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- https://github.com/jqb/
SimpleTaits ű×
SimpleTaits ¼³¸í
SimpleTraits´Â Python Ŭ·¡½º¸¦ ´ú verboseÀÇ »ý¼ºÀ» ¸¸µå´Â °æ·® ¶óÀ̺귯¸®ÀÔ´Ï´Ù. Simple Python Ŭ·¡½ºÀÇ ¼Ó¼º À̸§À» Áö¼ÓÀûÀ¸·Î ¹Ýº¹ÇÕ´Ï´Ù. µû¶ó¼ÀÌ Å¬·¡½º »ç¿ëÀÚ (¿ÀºêÁ§Æ®) ´ë½Å ___ (ÀÚü, ·Î±×ÀÎ, À̸§, last_name, email = none) : self.login = login self.name = name self.last_name = last_name self.email = eMaili from simpleTraits BaseClassClass »ç¿ëÀÚ °¡Á® ¿À±â : _ARG = ( '·Î±×ÀÎ', 'À̸§', 'last_name') _kwa = ( 'À̸ÞÀÏ', ress.detailsas°¡ "_ARG"¸¦ ±â´ëÇÒ ¼ö ÀÖ½À´Ï´Ù. Basaclass¿¡ ´ëÇÑ * argsÀÇ À̸§ÀÌ °´Ã¼ canructor¿¡ ´ëÇÑ À̸§ÀÌ ¾ó¸¶³ªµÇ´ÂÁö ¾Ë·ÁÁÖ°í ÀÖ½À´Ï´Ù. "_kwa"´Â Å°¿öµå ÀμöÀÇ À̸§ÀÌ ¹«¾ùÀÎÁö ¾Ë·ÁÁÝ´Ï´Ù. °¢ Å°¿öµåÀÇ ±âº»°ªÀº simpleTraits.nilÀÔ´Ï´Ù. ÀڽŸ¸ÀÇ ±âº»°ªÀ» Ãß°¡ÇÏ·Á¸é µÎ °¡Áö ¿É¼ÇÀÌ ÀÖ½À´Ï´Ù. 1. SimpleTraits.kwa °´Ã¼¸¦ »ç¿ëÇϽʽÿÀ. SimpleTraits¿¡¼ BaseClass, KWA Ŭ·¡½º »ç¿ëÀÚ (BaseClass) : _kwa = (kwa ( 'À̸ÞÀÏ', 'default@email.com')) 2. _kwa Ŭ·¡½º º¯¼ö¿¡ ´ëÇÑ Dict Dict : SimpleTraits BaseClass Ŭ·¡½º »ç¿ëÀÚ (BaseClass)¿¡¼ _kwa = dict (Email = 'default@email.com',) PIP ¼³Ä¡ ¹æ¹ý SimpleTraitStestSto ½ÇÇà Å×½ºÆ® ´Ü¼øÈ÷ ´Ù¿î·Îµå / º¹Á¦ ÆÐÅ°Áö ¹× À¯Çü ÆÄÀ̽ã Tests.pyPoductÀÇ È¨ÆäÀÌÁö
SimpleTaits °ü·Ã ¼ÒÇÁÆ®¿þ¾î