mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Fix compiler.ast.flatten function so that it works on lists.
This commit is contained in:
		
							parent
							
								
									76276177de
								
							
						
					
					
						commit
						f36947032f
					
				
					 3 changed files with 13 additions and 8 deletions
				
			
		|  | @ -234,9 +234,9 @@ def main(): | |||
| """ | ||||
| from consts import CO_VARARGS, CO_VARKEYWORDS | ||||
| 
 | ||||
| def flatten(list): | ||||
| def flatten(seq): | ||||
|     l = [] | ||||
|     for elt in list: | ||||
|     for elt in seq: | ||||
|         t = type(elt) | ||||
|         if t is tuple or t is list: | ||||
|             for elt2 in flatten(elt): | ||||
|  | @ -245,8 +245,8 @@ def flatten(list): | |||
|             l.append(elt) | ||||
|     return l | ||||
| 
 | ||||
| def flatten_nodes(list): | ||||
|     return [n for n in flatten(list) if isinstance(n, Node)] | ||||
| def flatten_nodes(seq): | ||||
|     return [n for n in flatten(seq) if isinstance(n, Node)] | ||||
| 
 | ||||
| nodes = {} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neil Schemenauer
						Neil Schemenauer