mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Clarify the dedent() example a bit by indenting the input lines unevenly.
This commit is contained in:
		
							parent
							
								
									8f6329c547
								
							
						
					
					
						commit
						86e1790cad
					
				
					 2 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
					@ -59,11 +59,11 @@ For example:
 | 
				
			||||||
def test():
 | 
					def test():
 | 
				
			||||||
    # end first line with \ to avoid the empty line!
 | 
					    # end first line with \ to avoid the empty line!
 | 
				
			||||||
    s = '''\
 | 
					    s = '''\
 | 
				
			||||||
    Hey
 | 
					    hello
 | 
				
			||||||
    there
 | 
					      world
 | 
				
			||||||
    '''
 | 
					    '''
 | 
				
			||||||
    print repr(s)          # prints '    Hey\n    there\n    '
 | 
					    print repr(s)          # prints '    hello\n      world\n    '
 | 
				
			||||||
    print repr(dedent(s))  # prints 'Hey\nthere\n'
 | 
					    print repr(dedent(s))  # prints 'hello\n  world\n'
 | 
				
			||||||
\end{verbatim}
 | 
					\end{verbatim}
 | 
				
			||||||
\end{funcdesc}
 | 
					\end{funcdesc}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -325,11 +325,11 @@ def dedent(text):
 | 
				
			||||||
        def test():
 | 
					        def test():
 | 
				
			||||||
            # end first line with \ to avoid the empty line!
 | 
					            # end first line with \ to avoid the empty line!
 | 
				
			||||||
            s = '''\
 | 
					            s = '''\
 | 
				
			||||||
            Hey
 | 
					            hello
 | 
				
			||||||
            there
 | 
					              world
 | 
				
			||||||
            '''
 | 
					            '''
 | 
				
			||||||
            print repr(s)          # prints '    Hey\n    there\n    '
 | 
					            print repr(s)          # prints '    hello\n      world\n    '
 | 
				
			||||||
            print repr(dedent(s))  # prints 'Hey\nthere\n'
 | 
					            print repr(dedent(s))  # prints 'hello\n  world\n'
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    lines = text.expandtabs().split('\n')
 | 
					    lines = text.expandtabs().split('\n')
 | 
				
			||||||
    margin = None
 | 
					    margin = None
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue