mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Remove a bare try/except completely -- it just did not make sense!
Add a comment elsewhere making clear an assumption in the code.
This commit is contained in:
		
							parent
							
								
									e8187615e2
								
							
						
					
					
						commit
						6f6a14f888
					
				
					 1 changed files with 12 additions and 12 deletions
				
			
		|  | @ -113,7 +113,6 @@ def add_label_data(self, format, counter, blankline = None): | ||||||
|     def format_counter(self, format, counter): |     def format_counter(self, format, counter): | ||||||
|         label = '' |         label = '' | ||||||
|         for c in format: |         for c in format: | ||||||
|             try: |  | ||||||
|             if c == '1': |             if c == '1': | ||||||
|                 label = label + ('%d' % counter) |                 label = label + ('%d' % counter) | ||||||
|             elif c in 'aA': |             elif c in 'aA': | ||||||
|  | @ -124,14 +123,15 @@ def format_counter(self, format, counter): | ||||||
|                     label = label + self.format_roman(c, counter) |                     label = label + self.format_roman(c, counter) | ||||||
|             else: |             else: | ||||||
|                 label = label + c |                 label = label + c | ||||||
|             except: |  | ||||||
|                 label = label + c |  | ||||||
|         return label |         return label | ||||||
| 
 | 
 | ||||||
|     def format_letter(self, case, counter): |     def format_letter(self, case, counter): | ||||||
|         label = '' |         label = '' | ||||||
|         while counter > 0: |         while counter > 0: | ||||||
|             counter, x = divmod(counter-1, 26) |             counter, x = divmod(counter-1, 26) | ||||||
|  |             # This makes a strong assumption that lowercase letters | ||||||
|  |             # and uppercase letters form two contiguous blocks, with | ||||||
|  |             # letters in order! | ||||||
|             s = chr(ord(case) + x) |             s = chr(ord(case) + x) | ||||||
|             label = s + label |             label = s + label | ||||||
|         return label |         return label | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake