~ vs $HOME

~ is expanded to current user home directory by shell, just like the variable $HOME.

While $HOME is expanded in most places (except inside single quotes), ~ is expanded only in a few specific conditions.

Debug python c/c++ extensions

It’s common to use c/c++ extension in python program for better performance. But it’s hard to debug c/c++ code when it’s called from python.