Tom Ritchford
Jul 16, 2023

--

I want to add one more - read the Python source code to the standard library! It's right there in your computer with Python itself.

Years ago, I wrote the following tiny Bash alias to open a Python library in my editor:

openpy () 
{
if [[ -z "$1" ]]; then
echo "Usage: openpy <module>";
return 1;
fi;
$EDITOR -n `python -c "import $1; print($1.__file__)"`
}

I also use this every day! (If I were writing this today, I’d use $(...) instead of `…`.)

--

--

No responses yet