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

PythonÖØÔØÑ§Ï°ÊÖ¼Ç

½ñÌìѧϰÁËÒ»ÏÂPythonµÄ²Ù×÷·ûÖØÔØ£¬×ܽáÁ˼¸µã±È½ÏÉñÆæµÄ¶«¶«£º
------------------------------------------------------------------------------------------------------------
¹ØÓÚiter£º
Technically, iteration contexts work by calling the iter built-in function to try to
find an _ _iter_ _ method, which is expected to return an iterator object. If it’s
provided,Python then repeatedly calls this iterator object’s next method to produce
items until a StopIteration exception is raised. If no such _ _iter_ _ method is found,
Python falls back on the _ _getitem_ _ scheme, and repeatedly indexes by offsets as
before, until an IndexError exception is raised.
ËùÒÔΪÁËʹÓÃiter£¬ÎÒÃDZØÐëÖØÔØ__iter__£¬È»ºóÔÙ¶¨ÒåÒ»¸önext·½·¨£¬Àý×ÓÈçÏ£º
class Squares:
 def _ _init_ _(self, start, stop): # Save state when created
  self.value = start - 1
  self.stop = stop
 def _ _iter_ _(self): # Get iterator object on iter( )
  return self
 def next(self): # Return a square on each iteration
  if self.value == self.stop:
   raise StopIteration
  self.value += 1
  return self.value ** 2
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
ÀûÓÃ__setattr__µÄʱºò£¬×Ô¼º¸³Öµ²»¿ÉÒÔʹÓÃself.name = value£¬ÒòΪÕâ¸öÓï¾äÒ²ÊÇÓÃÁË__setattr__
£¬ÕâÑùÖØ¸´Ê¹Ó㬳ö´í¡£ÒªÊ¹ÓÃself.__dict__['name'] = value
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
ÀûÓÃ__getattr__½¨Á¢“˽ÓД³ÉÔ±±äÁ¿£º
ÀûÓÃÖØÔØµÄ__setattr__ÔÚÿ´Îȡ֮ǰÅжÏÒ»ÏÂ˽ÓгÉÔ±Ãû×Öµ±ÖÐÓÐûÓУ¬À´ÊµÏÖ˽ÓУ¬´úÂëÈçÏ£¨È¡×Ô
Learning Python£©
class PrivateExc(Exception): pass
class Privacy:
&nb


Ïà¹ØÎĵµ£º

CºÍPython³ÌÐòÔ±µÄJavaScriptѧϰָÄÏ£¨Ò룩


write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
 Ô­ÎÄÀ´×Ô£º¡¶JavaScript for C & Python programmers
¡·£¬¾­¹ý×÷ÕßCanisÔÊÐíºó·­Ò룬¼´Ê¹×ªÔØÇ븽´ø´ËÁ´½Ó¡£

ǰÑÔ£ººÜÉٸɷ­ÒëµÄÊÂÇ飬ÀÛ£¬ÐÁ¿à£¬²»ÄÜ·¢»Ó£¬µäÐ͵ķÑÁ¦²»Ìֺã¬×î½üÎÞÁÄ£¬ÏëÔÚÍøÒ³ÉÏÏÔʾ¶¯»­£¨ÒòΪCSDNÌ ......

ÅäÖÃvim Ìá¸ß±àдpython½Å±¾µÄЧÂÊ

ʹÓÃpython.vimʹpython´úÂë¸ßÁÁ
http://www.vim.org/scripts/script.php?script_id=790
ʹÓÃ
Pydiction²å¼þʹvimÔö¼Ótab´úÂëÌáʾ¹¦ÄÜ
http://www.vim.org/scripts/script.php?script_id=850
¾ßÌå°²×°·½·¨¿ÉÒÔ²ÎÕÕ°ïÖú»òÕßREADME£¬ÒòΪ°æ±¾±ä»¯»áµ¼Ö°²×°·½·¨ÉϲúÉú²îÒì
±à¼­~/.vimrcÎļþÔö¼ÓÏÂÃæÑ¡Ïî
set nu Ôö¼ÓÐÐ ......

¡¾zz¡¿Python³£ÓÃ×ÊÔ´ÍøÖ·

zz from ¡¶¿É°®µÄPython¡·
http://www.woodpecker.org.cn/
Python±ê×¼¿â http://www.woodpecker.org.cn:9081/doc/Python/_html/PythonStandardLib/
¼òÃ÷Python½Ì³Ì http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/index.html
Python¿ìËÙ½éÉÜ http://www.zoomquiet.org/share/s5/intropy/070322-intro ......

ÀûÓÃPythonץȡºÍ½âÎöÍøÒ³(ÉÏ)

¶ÔËÑË÷ÒýÇæ¡¢ÎļþË÷Òý¡¢Îĵµ×ª»»¡¢Êý¾Ý¼ìË÷¡¢Õ¾µã±¸·Ý»òÇ¨ÒÆµÈÓ¦ÓóÌÐòÀ´Ëµ£¬¾­³£Óõ½¶ÔÍøÒ³(¼´HTMLÎļþ)µÄ½âÎö´¦Àí¡£ÊÂʵÉÏ£¬Í¨¹ýPythonÓïÑÔÌṩµÄ¸÷ÖÖÄ£¿é£¬ÎÒÃÇÎÞÐè½èÖúWeb·þÎñÆ÷
»ò
ÕßWebä¯ÀÀÆ÷¾ÍÄܹ»½âÎöºÍ´¦ÀíHTMLÎĵµ¡£±¾ÎĽ«Ïêϸ½éÉÜÈçºÎÀûÓÃPythonץȡºÍ½âÎöÍøÒ³¡£Ê×ÏÈ£¬ÎÒÃǽéÉÜÒ»¸ö¿ÉÒÔ°ïÖú¼ò»¯´ò¿ªÎ»ÓÚ±¾µØºÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ