Skip to content

Instantly share code, notes, and snippets.

@D3MZ
Created February 27, 2025 15:44
Show Gist options
  • Save D3MZ/b5ea109e05e26690ef6844352bc69f34 to your computer and use it in GitHub Desktop.
Save D3MZ/b5ea109e05e26690ef6844352bc69f34 to your computer and use it in GitHub Desktop.
Idiosyncrasies in Python

you cannot reference folders with - in the name

from player-random.agent import Agent #player-random/agent.py won't work
from player_random.agent import Agent #player_random/agent.py does work

overly short and inconsistent naming are ideomatic

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scikit-learn as sklearn
import pyarrow as pa 
import lightgbm as lgb

generic extension naming is also ideomatic; causes non-obvious compatibility issues

python3.12 -m venv .venv #instead of  python3.12 -m venv .py312
touch myfile.py #instead of $touch myfile.py2 or $touch myfile.py312

venv breaks when there are spaces in the folder name

export PATH="/absolute/path/My Projects/my_env/bin:$PATH" #treated as two separate paths.

installation name != import name

pip install PyWavelets
import pywt #=> works
import PyWavelets #=> ModuleNotFoundError: No module named 'PyWavelets'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment