mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	bpo-39431: Also mention nonlocal in assignment quirk (GH-17375)
This commit is contained in:
		
							parent
							
								
									99e6c260d6
								
							
						
					
					
						commit
						7142df5ea2
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -143,10 +143,10 @@ language definition is evolving towards static name resolution, at "compile"
 | 
				
			||||||
time, so don't rely on dynamic name resolution!  (In fact, local variables are
 | 
					time, so don't rely on dynamic name resolution!  (In fact, local variables are
 | 
				
			||||||
already determined statically.)
 | 
					already determined statically.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A special quirk of Python is that -- if no :keyword:`global` statement is in
 | 
					A special quirk of Python is that -- if no :keyword:`global` or :keyword:`nonlocal`
 | 
				
			||||||
effect -- assignments to names always go into the innermost scope.  Assignments
 | 
					statement is in effect -- assignments to names always go into the innermost scope.
 | 
				
			||||||
do not copy data --- they just bind names to objects.  The same is true for
 | 
					Assignments do not copy data --- they just bind names to objects.  The same is true
 | 
				
			||||||
deletions: the statement ``del x`` removes the binding of ``x`` from the
 | 
					for deletions: the statement ``del x`` removes the binding of ``x`` from the
 | 
				
			||||||
namespace referenced by the local scope.  In fact, all operations that introduce
 | 
					namespace referenced by the local scope.  In fact, all operations that introduce
 | 
				
			||||||
new names use the local scope: in particular, :keyword:`import` statements and
 | 
					new names use the local scope: in particular, :keyword:`import` statements and
 | 
				
			||||||
function definitions bind the module or function name in the local scope.
 | 
					function definitions bind the module or function name in the local scope.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue