Beginner notes for Unni (coming from Java). New sections get added below.
Python mostly uses snake_case: all lowercase, words joined by underscores. The official style guide is PEP 8 (Python Enhancement Proposal 8).
| What | Convention | Example |
|---|---|---|
| File (module) names | lowercase_with_underscores | vector_search.py |
| Package (folder) names | short, lowercase, ideally no underscores | ragtools |
| Variables | snake_case | top_k = 5 |
| Functions | snake_case | def embed_text(): |
| Classes | PascalCase (also called CapWords) | class VectorStore: |
| Constants | UPPER_SNAKE_CASE | MAX_RESULTS = 10 |
| Internal ("private") names | leading underscore | _cache |
user_name, not userName. Classes look the same as in Java (VectorStore).pinecone.py or json.py. Python will import your file instead of the real library.list, dict, str, id as variable names.l, O, I; they look like 1 and 0.