Disclaimer: 以ä¸å¯¹æ¯å¯è½æ强çç个人è²å½©
Node.js > Python çå°æ¹
å¿«ï¼è¿ä¸ªå¿«æ两æ¹é¢ï¼ç¬¬
ä¸æ¯V8å¼æå¿«ï¼å¨V8å¼æèåæåçæ¯Lars Bak大ç¥ï¼ä»åé è¿é«æ§è½SmallTalkå¼æåJava
Hotspotå¼æ(ç°å¨Javaçé»è®¤VM)ï¼ä»å¸¦é¢ä¸çV8å¼æ让Javascripté度达å°äºä¸ä¸ªæ°çé¶æ®µã第äºæ¯å¼æ¥æ§è¡ï¼Node.jsåè½
ä¸æ¯ä¸ä¸ªåºäºV8å¼æçå¼æ¥ç½ç»åIO Libraryï¼åPythonçTwistedå¾åï¼ä¸åçæ¯Node.jsçevent
loopæ¯å¾åºå±çæ·±å
¥å¨è¯è¨ä¸çï¼å¯ä»¥æ³è±¡ææ´ä¸ªæ件å¨æ§è¡çæ¶åå°±å¨ä¸ä¸ªå¾å¤§çevent loopéã
npmï¼npmå¯ä»¥è¯´æ¯ç¨èµ·æ¥æ顺æçpackage managementäºï¼npmä½ä¸ºNode.jsçå®æ¹package managementï¼æ±éäºæ´ä¸ªç¤¾åºæéä¸çèµæºãä¸åPythonç»åè¿easy_installåpipï¼è¿æ2to3çé®é¢ã
Windowsæ¯æï¼Node.jsæ微软çå æï¼Windowsåºæ¬è¢«è§ä¸ºä¸çå
¬æ°æ¥æ¯æï¼libuvå·²ç»å¯ä»¥å¾å¥½çåå°ç»ä¸è·¨å¹³å°çAPIï¼èPythonè½ç¶ä¹å¯¹Windowsæå®æ¹çæ¯æï¼ä½æ¯æ»æè§æ¯äºçå
¬æ°ï¼æ¶ä¸æ¶åºäºé®é¢ã
Python > Node.js çå°æ¹
è¯
è¨ï¼å°±å纯ä»è¯è¨çè§åº¦æ¥è¯´ï¼Pythonåèµ·æ¥è¦æ¯Javascriptèæå¾å¤ãJavascript设计æ¬èº«æ许å¤ç¼ºé·ï¼æ¯ç«å½æ¶è®¾è®¡çæ¶ååªæ¯ä½
为å¨æµè§å¨ä¸åä¸äºç®åä»»å¡çscriptï¼æ以代ç ä¸æ¦åºå¤§ï¼ç»´æ¤è¿æ¯æå°é¾ï¼ä¸è¿Node.jsçmoduleå¾å¤§çæ¹åäºè¿ä¸ªé®é¢ï¼ãä¸è¿ç¨
Coffeescriptå¯ä»¥å¾å¤§çæ¹åJavascriptï¼å ä¹å¯ä»¥åPythonçåã
æçï¼æçå
æ¬è¯è¨æ¬èº«å·²ç»æçï¼è¿æ
Frameworkåecosystemä¹å¾åºå¤§ãNode.jsçç»å¤§å¤æ°frameworké½å¾æ°ï¼æçAPIä¸ç´å¨åï¼æçæè§å·²ç»ä¸å¨ç»´æ¤ï¼æ»ä¹
没æä¸ä¸ªåDjangoé£ç§ç¾è¶³ä¹è«æè§çframeworkãPythonç主æµORM SQLalchemyä¹å¾æçã
Python å Node.js å¾é¾åé«ä¸çå°æ¹
å¼
æ¥Styleï¼Node.jsçå¼æ¥Styleæ¯CPSï¼ä¹å°±æ¯å±å±callbackï¼åºäºeventï¼åæµè§å¨ä¸çJavascriptå¾åãCPS好
å¤æ¯è®©çææµè§å¨Javascriptç人è½å¾å¿«ä¸æï¼å¦ä¹ é¾åº¦ä¹ä¸å¤§ã缺ç¹æ¯é»è¾ä¸å¤æï¼å°±åå¾å¾é¾ç»´æ¤ï¼åºæ¬ä¸éè¦éè¿async.jsè¿ç§
libraryï¼æè
ç¨promiseãPythonçå¼æ¥é¤äºåNode.jså¾åçTwistedä¹å¤ï¼ä¹æåºäºcoroutineç
geventï¼coroutine让å¼æ¥ä»£ç ç»´æ¤èµ·æ¥æ´å®¹æï¼ä¸è¿å¦ä¹ æ²çº¿é¡ã
åºç¨åºæ¯ï¼å¦ææ¯ä¸ä¸ªCRUDçappï¼é£ä¹æ³é½ä¸æ³ç´æ¥æ¯
Pythonï¼Node.jsæ¬èº«ä¸æ
é¿CRUDçappï¼ç»å¤§å¤æ°Node.jsé½æ¯ç´æ¥è£¸å¨å¤é¢çï¼èä¸æ¯æä¸ä¸ªNginxå¨åé¢ï¼å¦å
websocketå°±ä¸è½ç¨äºï¼ä¸è¿æ°çnginxå¼å§æ¯æwebsocketï¼ï¼ä»£ç åä¸å¥½ç»´æ¤ï¼èPythonçWSGIå¾éåï¼æççstackä¹
æå¾å¤ãå¦ææ´ååäºreal-timeï¼æ¯å¦ä¸ä¸ªchat roomï¼é£ä¹Node.jså®ç°æ´å®¹æãè¿ä¸¤ä¸ªåºç¨åºæ¯è¿æ¯æå·®å«çã
温馨提示:答案为网友推荐,仅供参考