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

ÓÃCÓïÑÔÀ©Õ¹PythonµÄ¹¦ÄÜ


Ô­ÎÄ
PythonºÍC·Ö±ðÓÐן÷×ÔµÄÓÅȱµã£¬ÓÃPython¿ª·¢³ÌÐòËٶȿ죬¿É¿¿ÐԸߣ¬²¢ÇÒÓÐÐí¶àÏÖ³ÉÄ£¿é¿É¹©Ê¹Ó㬵«Ö´ÐÐËÙ¶ÈÏà¶Ô½ÏÂý£»CÓïÑÔÔòÕýºÃÏà·´£¬ÆäÖ´ÐÐËٶȿ죬µ«¿ª·¢Ð§Âʵ͡£ÎªÁ˳ä·ÖÀûÓÃÁ½ÖÖÓïÑÔ¸÷×ÔµÄÓŵ㣬±È½ÏºÃµÄ×ö·¨ÊÇÓÃPython¿ª·¢Õû¸öÈí¼þ¿ò¼Ü£¬¶øÓÃCÓïÑÔʵÏ֯乨¼üÄ£¿é¡£±¾ÎĽéÉÜÈçºÎÀûÓÃCÓïÑÔÀ´À©Õ¹PythonµÄ¹¦ÄÜ£¬²¢¸¨ÒÔ¾ßÌåµÄʵÀý½²ÊöÈçºÎ±àдPythonµÄÀ©Õ¹Ä£¿é¡£
Ò»¡¢¼ò½é
PythonÊÇÒ»ÃŹ¦ÄÜÇ¿´óµÄ¸ß¼¶½Å±¾ÓïÑÔ£¬ËüµÄÇ¿´ó²»½ö±íÏÖÔÚÆä×ÔÉíµÄ¹¦ÄÜÉÏ£¬¶øÇÒ»¹±íÏÖÔÚÆäÁ¼ºÃµÄ¿ÉÀ©Õ¹ÐÔÉÏ£¬ÕýÒòÈç´Ë£¬PythonÒѾ­¿ªÊ¼Êܵ½Ô½À´Ô½¶àÈ˵ÄÇàíù£¬²¢ÇÒ±»ÂÅÂųɹ¦µØÓ¦ÓÃÓÚ¸÷Àà´óÐÍÈí¼þϵͳµÄ¿ª·¢¹ý³ÌÖС£
ÓëÆäËüÆÕͨ½Å±¾ÓïÑÔÓÐËù²»Í¬£¬Python³ÌÐòÔ±¿ÉÒÔ½èÖúPythonÓïÑÔÌṩµÄAPI£¬Ê¹ÓÃC»òÕßC++À´¶ÔPython½øÐй¦ÄÜÐÔÀ©Õ¹£¬´Ó¶ø¼´¿ÉÒÔÀûÓÃPython·½±ãÁé»îµÄÓï·¨ºÍ¹¦ÄÜ£¬ÓÖ¿ÉÒÔ»ñµÃÓëC»òÕßC++¼¸ºõÏàͬµÄÖ´ÐÐÐÔÄÜ¡£Ö´ÐÐËÙ¶ÈÂýÊǼ¸ºõËùÓнű¾ÓïÑÔ¶¼¾ßÓеĹ²ÐÔ£¬Ò²ÊDZ¶ÊÜÈËÃÇÖ¸ÔðµÄÒ»¸öÖØÒªÒòËØ£¬PythonÔòͨ¹ýÓëCÓïÑÔµÄÓлú½áºÏÇÉÃîµØ½â¾öÁËÕâÒ»ÎÊÌ⣬´Ó¶øÊ¹½Å±¾ÓïÑÔµÄÓ¦Ó÷¶Î§µÃµ½Á˺ܴóÀ©Õ¹¡£
ÔÚÓÃPython¿ª·¢Êµ¼ÊÈí¼þϵͳʱ£¬ºÜ¶àʱºò¶¼ÐèҪʹÓÃC/C++À´¶ÔPython½øÐÐÀ©Õ¹¡£×î³£¼ûµÄÇé¿öÊÇĿǰÒѾ­´æÔÚÒ»¸öÓÃC±àдµÄ¿â£¬ÐèÒªÔÚPythonÓïÑÔÖÐʹÓøÿâµÄijЩ¹¦ÄÜ£¬´Ëʱ¾Í¿ÉÒÔ½èÖúPythonÌṩµÄÀ©Õ¹¹¦ÄÜÀ´ÊµÏÖ¡£´ËÍ⣬ÓÉÓÚPython´Ó±¾ÖÊÉϽ²»¹ÊÇÒ»Öֽű¾ÓïÑÔ£¬Ä³Ð©¹¦ÄÜÓÃPythonʵÏÖ¿ÉÄܺÜÄÑÂú×ãʵ¼ÊÈí¼þϵͳ¶ÔÖ´ÐÐЧÂʵÄÒªÇ󣬴ËʱҲ¿ÉÒÔ½èÖúPythonÌṩµÄÀ©Õ¹¹¦ÄÜ£¬½«ÕâЩ¹Ø¼ü´úÂë¶ÎÓÃC»òÕßC++ʵÏÖ£¬´Ó¶øÌṩ³ÌÐòµÄÖ´ÐÐÐÔÄÜ¡£
±¾ÎÄÖ÷Òª½éÉÜPythonÌṩµÄCÓïÑÔÀ©Õ¹½Ó¿Ú£¬ÒÔ¼°ÈçºÎʹÓÃÕâЩ½Ó¿ÚºÍC/C++ÓïÑÔÀ´¶ÔPython½øÐй¦
ÄÜÐÔÀ©Õ¹£¬²¢¸¨ÒÔ¾ßÌåµÄʵÀý½²ÊöÈçºÎʵÏÖPythonµÄ¹¦ÄÜÀ©Õ¹¡£
»ØÒ³Ê×
¶þ¡¢PythonµÄCÓïÑÔ½Ó¿Ú
PythonÊÇÓÃCÓïÑÔʵÏÖµÄÒ»Öֽű¾ÓïÑÔ£¬±¾Éí¾ßÓÐÓÅÁ¼µÄ¿ª·ÅÐԺͿÉÀ©Õ¹ÐÔ£¬²¢ÌṩÁË·½±ãÁé»îµÄÓ¦ÓóÌÐò½Ó¿Ú(API)£¬´Ó¶øÊ¹µÃC/C++³ÌÐòÔ±Äܹ»ÔÚ¸÷¸ö¼¶±ðÉ϶ÔPython½âÊÍÆ÷µÄ¹¦ÄܽøÐÐÀ©Õ¹¡£ÔÚʹÓÃC/C++¶ÔPython½øÐй¦ÄÜÀ©Õ¹Ö®Ç°£¬±ØÐëÊ×ÏÈÕÆÎÕPython½âÊÍËùÌṩµÄCÓïÑÔ½Ó¿Ú¡£
2.1 Python¶ÔÏó(PyObject)
PythonÊÇÒ»ÃÅÃæÏò¶ÔÏóµÄ½Å±¾ÓïÑÔ£¬ËùÓеĶÔÏóÔÚPython½âÊÍÆ÷Öж¼±»±íʾ³ÉPyObject£¬PyObject½á¹¹°üº¬Python¶ÔÏóµÄËùÓгÉÔ±Ö¸Õ룬²¢ÇÒ¶ÔPython¶ÔÏóµÄÀàÐÍÐÅÏ¢ºÍÒýÓüÆÊý½øÐÐά»¤¡£ÔÚ½øÐÐPythonµÄÀ©Õ¹±à³Ìʱ£¬Ò»µ©ÒªÔÚC»òÕßC++ÖжÔPython¶ÔÏó½øÐд¦Àí£¬


Ïà¹ØÎĵµ£º

CÓïÑÔº¯Êý£¨¶þ£©

¡¾Àý8.6¡¿HanoiËþÎÊÌâ
    Ò»¿é°åÉÏÓÐÈý¸ùÕ룬A£¬B£¬C¡£AÕëÉÏÌ×ÓÐ64¸ö´óС²»µÈµÄÔ²ÅÌ£¬´óµÄÔÚÏ£¬Ð¡µÄÔÚÉÏ¡£Èçͼ5.4Ëùʾ¡£Òª°ÑÕâ64¸öÔ²ÅÌ´ÓAÕëÒÆ¶¯CÕëÉÏ£¬Ã¿´ÎÖ»ÄÜÒÆ¶¯Ò»¸öÔ²ÅÌ£¬Òƶ¯¿ÉÒÔ½èÖúBÕë½øÐС£µ«ÔÚÈκÎʱºò£¬ÈκÎÕëÉϵÄÔ²Å̶¼±ØÐë±£³Ö´óÅÌÔÚÏ£¬Ð¡ÅÌÔÚÉÏ¡£ÇóÒÆ¶¯µÄ²½Öè¡£
±¾ÌâËã·¨·ÖÎöÈçÏ£¬ÉèAÉÏ ......

CÓïÑÔÖ¸Õ루һ£©


Ö¸ÕëÊÇ£ÃÓïÑÔÖй㷺ʹÓõÄÒ»ÖÖÊý¾ÝÀàÐÍ¡£ÔËÓÃÖ¸Õë±à³ÌÊÇ£ÃÓïÑÔ×îÖ÷ÒªµÄ·ç¸ñÖ®Ò»¡£ÀûÓÃÖ¸Õë±äÁ¿¿ÉÒÔ±íʾ¸÷ÖÖÊý¾Ý½á¹¹£»Äܷܺ½±ãµØÊ¹ÓÃÊý×éºÍ×Ö·û´®£»²¢ÄÜÏó»ã±àÓïÑÔÒ»Ñù´¦ÀíÄÚ´æµØÖ·£¬´Ó¶ø±à³ö¾«Á·¶ø¸ßЧµÄ³ÌÐò¡£Ö¸Õ뼫´óµØ·á¸»ÁË£ÃÓïÑԵŦÄÜ¡£Ñ§Ï°Ö¸ÕëÊÇѧϰ£ÃÓïÑÔÖÐ×îÖØÒªµÄÒ»»·£¬ÄÜ·ñÕýÈ·Àí½âºÍʹÓÃÖ¸ÕëÊÇÎÒÃÇÊÇ·ñÕÆÎÕ ......

CÓïÑÔλÔËËã

Ç°Ãæ½éÉܵĸ÷ÖÖÔËËã¶¼ÊÇÒÔ×Ö½Ú×÷Ϊ×î»ù±¾Î»½øÐеġ£ µ«Ôںܶàϵͳ³ÌÐòÖг£ÒªÇóÔÚλ(bit)Ò»¼¶½øÐÐÔËËã»ò´¦Àí¡££ÃÓïÑÔÌṩÁËλÔËËãµÄ¹¦ÄÜ£¬ÕâʹµÃ£ÃÓïÑÔÒ²ÄÜÏñ»ã±àÓïÑÔÒ»ÑùÓÃÀ´±àдϵͳ³ÌÐò¡£
12.1 λÔËËã·û£ÃÓïÑÔÌṩÁËÁùÖÖλÔËËã·û£º
    &          °´ ......

Êý¾Ý½á¹¹ÔÚCÓïÑÔÖеÄÓ¦ÓÃ


     ÎÒÊÇÒ»¸ö¼ÆËã»úרҵµÄ±¾¿ÆÉú£¬ÏÖÔÚÎÒÃǸոÕѧÍêÁËÊý¾Ý½á¹¹¡£¾Ý˵Êý¾Ý½á¹¹¶ÔÓÚÎÒÃDZà³ÌºÜÖØÒª£¬¿ÉÊÇÎÒÏÖÔÚ²»ÖªÔõô°ÑÊý¾Ý½á¹¹ºÍCÓïÑÔ½áºÏÆðÀ´£¬ÒÔ±ã¸üºÃµÄ½øÐÐcÓïÑÔ±à³Ì¡£ÓÐÄÄλ¸ßÊÖÖ¸µãÒ»¶þ£¬ÔÚÏ¸м¤²»¾¡£¡
......

Õ»µÄCʵÏÖ(stack)

rows="2" cols="20" id="ctl00_ctl00_cphContent_cphDoc_EntryEditor1_richTextEditor" class="mceEditor" style="height:450px;width:100%;">
Õ»ÊÇÊý¾Ý½á¹¹ÖÐ×î»ù´¡Ò²ÊÇ×î¾­µäµÄÊý¾Ý½á¹¹£¬ÎÞÂÛÔÚÓ¦Óû¹ÊDzÙ×÷ϵͳÖоù¿ÉÒÔ¿´µ½ÆäÉíÓ°¡£Õ»ÊÇÒ»ÖÖÌØÊâµÄ
ÏßÐÔ±í£¬¼´ÏÞÖÆÔÚ±íµÄÒ»¶Ë½øÐвåÈ롢ɾ³ýÔËË㡣ͨ³£²åÈ롢ɾ³ýµÄÒ»¶Ë³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ