I have problems typing a lot of underscores because it's uncomfortable for my wrists and it risks a repetitive strain injury over time.

I would prefer to use Java-style camelcase everywhere - it's more ergonomic. Unfortunately the vast majority of Python libraries use underscores.

So I would like a tool or an IDE that auto-translates between camel case and underscores (sometimes called "snake case"). The tool has to be able to auto-convert references to objects of a given type (for example, a command could be: "Convert all function arguments from snake case to camel case" or "Convert all variables from camel case to snake case").

I'd prefer an IDE or a GUI tool, however command line tools are also acceptable. The best solution would be an IDE where I can set what types of objects should be camel case or snake case, type in either case, and have the IDE automatically recognize them in real-time and fix them.

1 Answer 1


Found something that works. This solution works best on Mac OS and probably Linux.

  • (Mac OS only) Go into System Preferences -> Keyboard, Shortcuts tab; click on Spotlight in the left menu list and disable "Show spotlight search" on the right menu list after that
  • Download the PyCharm IDE (https://www.jetbrains.com/pycharm/)
  • In Pycharm, open any file for writing, or a blank file.
  • Pycharm: Edit menu -> Macros -> Start Macro Recording
  • Type an underscore in the file.
  • Edit menu -> Macros -> Stop Macro Recording
  • Name the macro "underscore" or something similar
  • PyCharm menu -> Preferences -> Keymap, scroll down to Macros
  • Double click on the underscore macro, click "Add Keyboard Shortcut"
  • Record Command+Space as the shortcut. For reference, the command button is the same as the Windows button (if you're using a non-Apple external keyboard).

You can now ergonomically type underscores with either hand. On Windows, you might use Shift+Space or Control+Space, although I haven't tested those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.