3 ms·
Pro-tip: put things like this in your ~/.pythonrc so that they're loaded when you start the REPL. I have a few things in mine, like configuring readline, a coup
by kstrauser 2y ago
Pro-tip: put things like this in your ~/.pythonrc so that they're loaded when you start the REPL. I have a few things in mine, like configuring readline, a couple of functions to dump objects as JSON or YAML, and imports for pprint and datetime so that they're all there when I'm doing interactive stuff.
- setopt 2y agoDoes .pythonrc also apply to IPython? I’ve been using my .ipython configs to do this, but would prefer to move it to .pythonrc if that applies to all Python interpreters.
- ErikBjare 2y agoJust learned about this tool, also using ipython for this. Seems it is actually controlled by the `PYTHONSTARTUP` env var, which can be set to the path to your `.pythonrc`, so should work with ipython too!
- BiteCode_dev 2y agohttps://www.bitecode.dev/p/happiness-is-a-good-pythonstartup https://www.bitecode.dev/p/happiness-is-a-good-pythonstartup more generic won't work for pdb though
- kstrauser 2y agoI don’t have nearly so much in mine, but the motivations the same. There are certain tools I use all the time when I’m in the REPL, so I make it as comfy for myself as possible.