mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	
		
			
	
	
		
			13 lines
		
	
	
	
		
			301 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			13 lines
		
	
	
	
		
			301 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|   | # from more_itertools v8.13.0 | ||
|  | def always_iterable(obj, base_type=(str, bytes)): | ||
|  |     if obj is None: | ||
|  |         return iter(()) | ||
|  | 
 | ||
|  |     if (base_type is not None) and isinstance(obj, base_type): | ||
|  |         return iter((obj,)) | ||
|  | 
 | ||
|  |     try: | ||
|  |         return iter(obj) | ||
|  |     except TypeError: | ||
|  |         return iter((obj,)) |