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

Python:FriendFeedµÄTornado Web Server

´úÂëºÜ¼òµ¥£¬²»µ½5kÐС£µ«ÊÇ˼·ͦºÃµÄ£¬¸Ä³Énon-blockingÁËÖ®ºóЧÂʾÍÊÇÄÜÌá¸ß²»ÉÙ£¬ÌرðÊÇ¿¼Âǵ½ÏÖ´úµÄweb app¶¼ÐèÒªºÍÆäËûµÄ
HTTP·þÎñÆ÷ͨÐÅ£¬blockingµÄ´ú¼ÛÌ«´óÁË¡£ Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed. The FriendFeed application is written using a web framework that looks a bit like web.py or Google's webapp, but with additional tools and optimizations to take advantage of the underlying non-blocking infrastructure.
The framework is distinct from most mainstream web server frameworks (and certainly most Python frameworks) because it is non-blocking and reasonably fast. Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing connections, which means it is ideal for real-time web services. We built the web server specifically to handle FriendFeed's real-time features — every active user of FriendFeed maintains an open connection to the FriendFeed servers. (For more information on scaling servers to support thousands of clients, see The C10K problem.)
See the Tornado documentation for a detailed walkthrough of the framework. Tornado: Facebook Releases Python Framework as Open Source http://www.linux-magazine.com/Online/News/Tornado-Facebook-Releases-Python-Framework-as-Open-Source


Ïà¹ØÎĵµ£º

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ͬÑùÓÐÏÞµÄÖ§³Ö¶à¼Ì³ÐÐÎʽ¡£¶à¼Ì³ÐµÄÀඨÒåÐÎÈçÏÂÀ ......

easy_installÈÃpythonµÄ°ü¹ÜÀí±äµÃeasy

PythonÖеÄeasy_install¹¤¾ßºÜºÃÓã¬ËüµÄ×÷ÓÃÀàËÆÓÚPhpÖеÄpear£¬»òÕßRubyÖеÄgem£¬»òÕßPerlÖеÄcpan¡£
Èç¹ûÏëʹÓÃeasy_install¹¤¾ß£¬¿ÉÒÔÖ±½Ó°²×°ez_setup.py
½Å±¾£¬ÔÙpython ez_setup.py£¨Ö®Ç°ÏÈÒª°²×°python£©£º
°²×°Íêºó£¬×îºÃÈ·±£easy_installËùÔÚĿ¼ÒѾ­±»¼Óµ½PATH»·¾³±äÁ¿Àï:
Windows: C:\Python25\Scripts
Li ......

Python´úÂëÓÅ»¯

Python´úÂëÓÅ»¯--ÉÙ´ò×ÖС¼¼ÇÉ
˵Ã÷£ºÔö¼Ó´úÂëµÄÃèÊöÁ¦£¬¿ÉÒԳɱ¶¼õÉÙÄãµÄLOC£¬×öµ½¼òµ¥£¬²¢ÇÒÕæÇÐÓÐÁ¦
¹Ûµã£ºÉÙ´ò×Ö£½¶à˼¿¼£«ÉÙ³ö´í£¬10´úÂëÐбÈ50ÐиüÄÜÈÃÈËÃ÷°×£¬ÒÔϼ¼ÇÉÓÐÖúÓÚÌá¸ß5±¶¹¤×÷ЧÂÊ
1. ½»»»±äÁ¿ÖµÊ±±ÜÃâʹÓÃÁÙʱ±äÁ¿£º(cookbook1.1)
ÀÏ´úÂ룺ÎÒÃǾ­³£ºÜÊìÁ·ÓÚÏÂÃæµÄ´úÂë
temp = x
x = y
y = ......

pythonÔËËã·û ¹©ÖØÔزο¼

¶þÔªÔËËã·û¼°Æä¶ÔÓ¦µÄÌØÊâ·½·¨
¶þÔªÔËËã·û
ÌØÊâ·½·¨
+
__add__,__radd__
-
__sub__,__rsub__
*
__mul__,__rmul__
/
__div__,__rdiv__,__truediv__,__rtruediv__
//
__floordiv__,__rfloordiv__
%
__mod__,__rmod__
**
__pow__,__rpow__
<<
__lshift__,__rlshift__
>>
_ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ