mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 02:15:10 +00:00 
			
		
		
		
	merge with 3.4
This commit is contained in:
		
						commit
						fe98180bce
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -869,7 +869,7 @@ Generators | ||||||
| :term:`Generator`\s are a simple and powerful tool for creating iterators.  They | :term:`Generator`\s are a simple and powerful tool for creating iterators.  They | ||||||
| are written like regular functions but use the :keyword:`yield` statement | are written like regular functions but use the :keyword:`yield` statement | ||||||
| whenever they want to return data.  Each time :func:`next` is called on it, the | whenever they want to return data.  Each time :func:`next` is called on it, the | ||||||
| generator resumes where it left-off (it remembers all the data values and which | generator resumes where it left off (it remembers all the data values and which | ||||||
| statement was last executed).  An example shows that generators can be trivially | statement was last executed).  An example shows that generators can be trivially | ||||||
| easy to create:: | easy to create:: | ||||||
| 
 | 
 | ||||||
|  | @ -887,7 +887,7 @@ easy to create:: | ||||||
|    o |    o | ||||||
|    g |    g | ||||||
| 
 | 
 | ||||||
| Anything that can be done with generators can also be done with class based | Anything that can be done with generators can also be done with class-based | ||||||
| iterators as described in the previous section.  What makes generators so | iterators as described in the previous section.  What makes generators so | ||||||
| compact is that the :meth:`__iter__` and :meth:`~generator.__next__` methods | compact is that the :meth:`__iter__` and :meth:`~generator.__next__` methods | ||||||
| are created automatically. | are created automatically. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Brandl
						Georg Brandl