mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	bpo-37765: Add keywords to IDLE tab completions (GH-15138)
Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.
Rewrite Completions doc.
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
(cherry picked from commit bce2eb4646)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
			
			
This commit is contained in:
		
							parent
							
								
									c65ee55512
								
							
						
					
					
						commit
						fd27fb7f3d
					
				
					 6 changed files with 104 additions and 77 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| pop up a list of candidates. | ||||
| """ | ||||
| import __main__ | ||||
| import keyword | ||||
| import os | ||||
| import string | ||||
| import sys | ||||
|  | @ -171,10 +172,13 @@ def fetch_completions(self, what, mode): | |||
|                                      (what, mode), {}) | ||||
|         else: | ||||
|             if mode == ATTRS: | ||||
|                 if what == "": | ||||
|                 if what == "":  # Main module names. | ||||
|                     namespace = {**__main__.__builtins__.__dict__, | ||||
|                                  **__main__.__dict__} | ||||
|                     bigl = eval("dir()", namespace) | ||||
|                     kwds = (s for s in keyword.kwlist | ||||
|                             if s not in {'True', 'False', 'None'}) | ||||
|                     bigl.extend(kwds) | ||||
|                     bigl.sort() | ||||
|                     if "__all__" in bigl: | ||||
|                         smalll = sorted(eval("__all__", namespace)) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)