Python Tips and Tricks

Beginning my repository of Python, Git, and VSC tips and tricks here.

VS Code Tips

Keybindings

Place the following code block into keybindings.json, located in CTRL+SHIFT+P > Preferences: Open Keyboard Shortcuts (JSON).

[
    {
        "key": "ctrl+tab",
        "command": "workbench.action.nextEditor"
    },
    {
        "key": "ctrl+shift+tab",
        "command": "workbench.action.previousEditor"
    }
]

Collapse Functions

  • To collapse all functions in VSC, run CTRL+K CTRL+0; to expand all functions, run CTRL+K CTRL+J.

Python Style Guides

Microsoft Edge

  • Microsoft Edge by default on Windows 10/11 changes tabs when you do ALT+TAB and want to change windows. To change this, go to Settings -> Multitasking -> Alt + Tab and set “Open Alt + Tab shows” to “open windows only”.

Git Tips

New Branches

  • Create a new branch using git checkout -b NewBranchName
  • To push the new branch use git push origin NewBranchName

Python Tips

Pytests on Jupyter

import ipytest
ipytest.autoconfig()
%%ipytest
% run -i myFile.py
  • For plotting on Jupyter
    import plotly.io as pio
    pio.renderers.default = "colab"
    
Written on March 19, 2026