We can use goto and :label in batch.
Is there anything like it in Python?
            Asked
            
        
        
            Active
            
        
            Viewed 1,075 times
        
    0
            
            
         
    
    
        Remi Guan
        
- 21,506
- 17
- 64
- 87
 
    
    
        Bhanu Kumar
        
- 9
- 1
- 
                    1@jonno Are you saying "Go To Considered Harmful"? :) http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html for those who don't know their history. – ChrisInEdmonton Jan 18 '16 at 14:16
- 
                    What does `goto` or `:label` do in batch? – Remi Guan Jan 19 '16 at 06:15
- 
                    Short answer: no. Long answer: nooooooooooooooo. – TigerhawkT3 Jan 19 '16 at 06:18
- 
                    1Never think about that again. – Anton Protopopov Jan 19 '16 at 06:18
- 
                    I wish the folks at superuser would make at least a cursory check for exact duplicates before migrating. – TigerhawkT3 Jan 19 '16 at 06:26
1 Answers
0
            
            
        No, there is no goto or label or other equivalent in vanilla python.  
Your best bet is to stick with regular control flow statements (e.g. if, else if, else, for, while, break, continue, ...) and functions (which add return to the list of control flow statements as well ...)
 
    
    
        mgilson
        
- 300,191
- 65
- 633
- 696
- 
                    `try`, `except`, `finally` are a few more . . . Python's got lots of options :-) – mgilson Jan 19 '16 at 06:20