mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Clarify point in name mangling doc.
This commit is contained in:
		
							parent
							
								
									6eea818423
								
							
						
					
					
						commit
						dec3b3f704
					
				
					 1 changed files with 7 additions and 8 deletions
				
			
		| 
						 | 
					@ -84,14 +84,13 @@ exception.
 | 
				
			||||||
definition begins with two or more underscore characters and does not end in two
 | 
					definition begins with two or more underscore characters and does not end in two
 | 
				
			||||||
or more underscores, it is considered a :dfn:`private name` of that class.
 | 
					or more underscores, it is considered a :dfn:`private name` of that class.
 | 
				
			||||||
Private names are transformed to a longer form before code is generated for
 | 
					Private names are transformed to a longer form before code is generated for
 | 
				
			||||||
them.  The transformation inserts the class name in front of the name, with
 | 
					them.  The transformation inserts the class name, with leading underscores
 | 
				
			||||||
leading underscores removed, and a single underscore inserted in front of the
 | 
					removed and a single underscore inserted, in front of the name.  For example,
 | 
				
			||||||
class name.  For example, the identifier ``__spam`` occurring in a class named
 | 
					the identifier ``__spam`` occurring in a class named ``Ham`` will be transformed
 | 
				
			||||||
``Ham`` will be transformed to ``_Ham__spam``.  This transformation is
 | 
					to ``_Ham__spam``.  This transformation is independent of the syntactical
 | 
				
			||||||
independent of the syntactical context in which the identifier is used.  If the
 | 
					context in which the identifier is used.  If the transformed name is extremely
 | 
				
			||||||
transformed name is extremely long (longer than 255 characters), implementation
 | 
					long (longer than 255 characters), implementation defined truncation may happen.
 | 
				
			||||||
defined truncation may happen.  If the class name consists only of underscores,
 | 
					If the class name consists only of underscores, no transformation is done.
 | 
				
			||||||
no transformation is done.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. _atom-literals:
 | 
					.. _atom-literals:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue