Çë½Ì2¸öpythonµÄÎÊÌâ
delÓï¾äÊÇÓÃÀ´É¾³ý±äÁ¿ÒýÓõģ¬ÔÚʵ¼ÊÓ¦ÓÃÖÐʲô³¡ºÏÏ»áÓõ½£¨python²»ÊÇ×Ô¶¯ÓÐÀ¬»øÊÕ¼¯Â𣿣©
getattrºÍsetattrÓÐʲôÌØÊâÓÃ;Â𣬻¹ÊÇÖ»¸újavaÖеÄgetter ºÍsettterÏàͬ£¬Ã»ÓÐÌØÊ⹦ÄÜÉϵÄÓô¦£¿
Õâ2¸öÎÊÌâÀ§ÈÅÎҺܳ¤Ê±¼äÁË
1. ±ÈÈ磺
Python code:
>>> a
[1, 66.6, 333, 333, 1234.5]
>>> del a[2:4]
>>> a
[1, 66.6, 1234.5]
2.ʹÓÃgetattrº¯Êý£¬¿ÉÒԵõ½Ò»¸öÖ±µ½ÔËÐÐʱ²ÅÖªµÀÃû³ÆµÄº¯ÊýµÄÒýÓÃ
1. python¶ÔÏóÒýÊýΪÁãÂíÉÏ»ØÊÕ£¬
2. del ²»Ò»¶¨±£Õý»ØÊÕ£¬Èç¶ÔÏó¼äÓÐcyclic reference
ÊÜÓ㬺Ǻǣ¡£¡£¡
лл¸÷λ¡£Ìرð¸Ðлlgg201£¬ºÇºÇ¡£
Ïà¹ØÎÊ´ð£º
×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½
ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º
python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......
¸÷λ¸ßÊÖ£¬ÄÄλÄÜд¸ö¼òµ¥µÄͨѶ¼£¬Ö»±£´æÐÕÃûºÍÊÖ»úºÅ£¬Äܱ£´æµ½Ó²Å̲¢¿É¶Á»Ø£¬ÓÐÌí¼Ó£¬É¾³ý£¬Ð޸ģ¬²éѯ¹¦ÄÜ£¬ÃüÁîÐÐʽµÄ¾ÍÐÐ
ÕâÖÖ»îÄãµÃ×Ô¼º¸É£¬ÓÐÎÊÌâ¿ÉÒÔÎÊ£¬µ«²»»áÓÐÈË°ïÄã×öµÄ¡£
¸øÄãÔ´Âë
http://dow ......
ÓźñµÄ¸å³ê£¬³ÏÕÐPython¼¼ÊõÈËÔ±²ÎÓë¸÷ÖÖ¼¼ÊõÊé¼®³ö°æ¡£
ͨ¹ý¸ÃÊé¼®£¬×÷Õß¿ÉÒԵõ½Èçϱ¨³ê£º
1¡¢·áºñµÄ¸å³ê¡£
2¡¢Êé¼®Öø×÷µÄÊðÃûȨ¡£
3¡¢¶Ô×÷ÕߺÍÊé½øÐÐÐû´«£¬Ìá¸ß×÷ÕßÔÚ¼¼ÊõȦ×ÓÀ ......
ÕâÊÇÒ»¸öÆÕͨµÄ»ìºÏʹÓ÷½Ê½, µ«ÕâÖÖ·½Ê½²»ÄÜ´ïµ½½Å±¾ÕæÕýµÄÁé»îÐÔ£¬ c++ÿ¸öÊôÐÔ±ØÐë°ó¶¨Ò»¸öΨһµÄsetºÍget½Ó¿ÚÌṩ¸øpythonÄÚ²¿·ÃÎÊÕâ¸öÊôÐÔ
C/C++ code:
class sample
{
public:
int m_obj ......
ÏëÎÊÁ½¸öÎÊÌ⣺
1¡¢Python¼ÈÈ»ÊǹéÊôÓڽű¾ÓïÑÔ£¬ÄÇôÔÚʲôƽ̨ÏÂÔËÐУ¿
£¨vb script£¬JAVA script£¬php¶¼ÊôÓڽű¾ÓïÑÔÖÖÀ࣬¶¼ÊÇÓÃÓÚÍøÒ³½Å±¾£¬ÄÇôPythonͨ³£ÓÃÔÚÄÄÀïÄØ£¿£©
2¡¢PythonÄÜ·ñÔÚÈû°àV3°æ±¾Ï ......