Beginning Python: From Novice to Professional is the most comprehensive book on the Python ever written. Based on Practical Python, this newly revised book is both an introduction and practical reference for a swath of Python-related programming topics, including addressing language internals, database integration, network programming, and web services. Advanced topics, such as extending Python and packaging/distributing Python applications, are also covered. Ten different projects illustrate the concepts introduced in the book. You will learn how to create a P2P file-sharing application and a web-based bulletin board, and how to remotely edit web-based documents and create games. Author Magnus Lie Hetland is an authority on Python and previously authored Practical Python. He also authored the popular online guide, Instant Python Hacking, on which both books are based.
......(更多)
Magnus Lie Hetland是挪威科技大学副教授,教授算法。喜欢钻研新的编程语言,是Python语言的坚定支持者。他写过很多Python方面的书和在线教程,比如深受大家欢迎的网上教程Instant Python。
......(更多)
......(更多)
这就在于它不是像returen那样返回值,而是每次产生多个值。每次产生一个值(使用yield),函数就会冻结:即函数停在那里等待被激活。函数被激活后就从停止的那点开始执行。
换句话说,生成器是由两部分组成:生成器的函数和生成器的迭代器。生成器的函数是用def语句定义的,包含yield部分,生成器的迭代器是这个函数返回的部分。
......(更多)