[Python-ideas] Open parenthesis in REPL completion

Chris Angelico rosuav at gmail.com
Sat Apr 20 16:25:31 EDT 2019


On Sun, Apr 21, 2019 at 3:52 AM Danilo J. S. Bellini
<danilo.bellini at gmail.com> wrote:
> The solution I found from reading that code is this oneliner, which I'll copy and paste after loading the REPL (yes, it's monkeypatching a seemingly private method):
>
> __import__("rlcompleter").Completer._callable_postfix = lambda self, val, word: word
>
> Is there a default PYTHONSTARTUP file name in Python 3.7.3, or at least a single global configuration file for the REPL where I can put that oneliner or a file reference with that line? I strongly prefer not to mess around with ~/.bashrc, ~/.zshrc and scattered stuff like that, if possible.
>

I think it's probably cleaner to do this by subclassing Completer and
overriding something (dig around to see what actually *calls* that),
but either way, you can most certainly create yourself a config file.
Details are here:

https://docs.python.org/3/library/site.html

You should be able to do everything you want with sitecustomize or
usercustomize.

If you need detailed help, python-list has lots of people who know how
this works (way better than I do).

ChrisA


More information about the Python-ideas mailing list