Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

python ¶à¼Ì³Ð(2)

from:  http://www.chinesepython.org/pythonfoundry/tut2.3/tmp/multiple.html
9.5.1 ¶à¼Ì³Ð Multiple Inheritance
Python supports a limited form of multiple inheritance as well. A class definition with multiple base classes looks as follows:
PythonͬÑùÓÐÏÞµÄÖ§³Ö¶à¼Ì³ÐÐÎʽ¡£¶à¼Ì³ÐµÄÀඨÒåÐÎÈçÏÂÀý£º
class DerivedClassName(Base1, Base2, Base3):
<statement-1>
.
.
.
<statement-N>
The only rule necessary to explain the semantics is the resolution rule used for class attribute references. This is depth-first, left-to-right. Thus, if an attribute is not found in DerivedClassName, it is searched in Base1, then (recursively) in the base classes of Base1, and only if it is not found there, it is searched in Base2, and so on.
ÕâÀïΨһÐèÒª½âÊ͵ÄÓïÒåÊǽâÎöÀàÊôÐԵĹæÔò¡£Ë³ÐòÊÇÉî¶ÈÓÅÏÈ£¬´Ó×óµ½ÓÒ¡£Òò´Ë£¬Èç¹ûÔÚ DerivedClassName £¨Ê¾ÀýÖеÄÅÉÉúÀࣩÖÐûÓÐÕÒµ½Ä³¸öÊôÐÔ£¬¾Í»áËÑË÷ Base1 £¬È»ºó£¨µÝ¹éµÄ£©ËÑË÷Æä»ùÀ࣬Èç¹û×îÖÕûÓÐÕÒµ½£¬¾ÍËÑË÷ Base2£¬ÒÔ´ËÀàÍÆ¡£
(To some people breadth first -- searching Base2 and Base3 before the base classes of Base1 -- looks more natural. However, this would require you to know whether a particular attribute of Base1 is actually defined in Base1 or in one of its base classes before you can figure out the consequences of a name conflict with an attribute of Base2. The depth-first rule makes no differences between direct and inherited attributes of Base1.)
£¨ÓÐЩÈËÈÏΪ¹ã¶ÈÓÅÏÈ£­£­ÔÚËÑË÷Base1µÄ»ùÀà֮ǰËÑË÷Base2ºÍBase3£­£­¿´ÆðÀ´¸üΪ×ÔÈ»¡£È»¶ø£¬Èç¹ûBase1ºÍBase2Ö®¼ä·¢ÉúÁËÃüÃû³åÍ»£¬ÄãÐèÒªÁ˽âÕâ¸öÊôÐÔÊǶ¨ÒåÓÚBase1»¹ÊÇBase1µÄ»ùÀàÖС£¶øÉî¶ÈÓÅÏȲ»Çø·ÖÊôÐԼ̳Ð×Ô»ùÀ໹ÊÇÖ±½Ó¶¨Òå¡££©
It is clear that indiscriminate use of multiple inheritance is a maintenance nightmare, given the reliance in Python on conventions to avoid accidental name conflicts. A well-known problem with multiple inheritance is a class derived from two classes that happen to have a common base class. While it is easy enough to figure out what happens i


Ïà¹ØÎĵµ£º

python ´´Ê¼ÈË·Ã̸¼1£º¹ØÓÚ django ºÍ ruby ÊÕ²Ø

python ´´Ê¼ÈË·Ã̸¼1£º¹ØÓÚ django ºÍ ruby ÊÕ²Ø
Ö÷³ÖÈË: Chris DiBona £¨Google ¿ªÔ´ÍøÕ¾¸ºÔðÈË£© and Leo Laporte £¨Twit ÍøÕ¾´´Ê¼ÈË£©
±»²É·ÃÈË£ºGuido van Rossum £¨python ´´Ê¼ÈË£©
Leo £º Python ȱÉÙһЩ±¾µØµÄ gui ¿â°É£¬Ö»ÓÐ tk ʲôµÄ£¬ Äã¾õµÃÕâÊDz»ÊÇÒ»¸öÎÊÌâÄØ£¿
Guido£º ÏÖÔÚÕâÔ½À´Ô½²»³ÉΪһ¸öÎÊÌâÁË£ ......

Pythonѧϰ×ÊÁÏ


Pythonѧϰ
 
»ù±¾ÄÚÈÝ
Python»ù±¾°²×°£º
http://www.python.org/ ¹Ù·½±ê×¼Python¿ª·¢°üºÍÖ§³Ö»·¾³£¬Í¬Ê±Ò²ÊÇPythonµÄ¹Ù·½ÍøÕ¾£»
http://www.activestate.com/ ¼¯³É¶à¸öÓÐÓòå¼þµÄÇ¿´ó·Ç¹Ù·½°æ±¾£¬ÌرðÊÇÕë¶ÔWindows»·¾³Óв»ÉٸĽø£»
 
PythonÎĵµ£º
http://www.python.org/doc/current/lib/ ......

PythonÖÐsocketºÍ¶àÏ̵߳ÄÓ¦ÓÃ

ÕâÊÇÎÒÒÔǰдµÄÒ»¸ösocketСӦÓã¬ÆäÖÐҲ˳±ãÓõ½ÁËÒ»µãµã¶àÏ̵߳Ķ«Î÷¡£
Õâ¸ösocket¿Í»§¶ËÊÇÎÒΪÁË·½±ã¹«Ë¾µÄ³äֵϵͳµ÷ÊÔ¶øдµÄÒ»¸öСӦÓá£ÓÉËü¸ú³äֵϵͳ½øÐÐsocketͨѶ£¬×Ô¶¯Íê³É³äÖµµÄ²âÊÔ¹¤×÷¡£
¿´´úÂë°É£º
import socket,thread
def Communicate(s):
phoneno = raw_input("Please input your PhoneNo.:(Pu ......

Pythonѧϰ±Ê¼ÇÒ»




·¢
Ïֺܶ๫˾ҪÇóÕÆÎÕһÎű¾ÓïÑÔ£¬Ò»Ö±Ò²Ïë¸ã¸ãÕâ¸ö£¬¿´C++£¬Linux
C±à³ÌÒ²Ö»ÊÇΪÁ˶Ôϵͳ¸ü¼ÓµÄÁ˽⣬°¦£¬ÎҵŤ×÷¶¨Î»ºÃÏñÒ»Ö±¶¼²»ÔõôÃ÷È·£¬ÊÇÒª¸ã¸ö×Ô¼º×îÉó¤µÄÁË£¬ÒÔºóÓÐʱ¼äÔÙ¸ãlinuxC£¬ÕÒ¹¤×÷µÚһλ¡£¡£¡£¹¤
×÷»ù±¾¶¨Î»ÔÚ Java+python£¬´ó²¿·Ö¹«Ë¾Ò²²»»áÒªÇóÒ»¸öÈ˼È×öJavaÒ²×öC++¡£ÔÙ˵ÕâÓïÑÔÒ²ÊÇ´ ......

python×Ô¶¯²¹È«ÒÔ¼°×Ô´ø½Å±¾ÔËÐÐʧ°Ü½â¾ö·½·¨

pythonµÄ×Ô¶¯²¹È«Óкܶ෽·¨£¬±¾ÖÊÉ϶¼ÊÇÓÃ×ֵ䡣Éú³É×Öµä×î³£Óõĵ±È»ÊÇctagÁË£¬µ«ÊÇÿ´ÎÔö¼ÓÄ£¿é¶¼ÒªctagÒ»´ÎҲͦÂé·³µÄ¡£
ÄÜ͵ÀÁµÄÊǺó͵ÀÁÊÇÒ»ÖÖÃÀµÂ£¬ÓÐÈËÒѾ­×öÁË×ÖµäºÍÔö¼ÓÄ£¿éµÄ½Å±¾£¬ÎÒÃǸÉÂï²»×øÏíÆä³ÉÄØ¡£
http://vim.sourceforge.net/scripts/script.php?script_id=850
Õâ¸öÃûΪpydictionµÄÏîÄ¿°üÀ¨ÁËÒ»¸ö×Ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ