Python Notes

Beginner notes for Unni (coming from Java). New sections get added below.

1. Naming conventions

Python mostly uses snake_case: all lowercase, words joined by underscores. The official style guide is PEP 8 (Python Enhancement Proposal 8).

WhatConventionExample
File (module) nameslowercase_with_underscoresvector_search.py
Package (folder) namesshort, lowercase, ideally no underscoresragtools
Variablessnake_casetop_k = 5
Functionssnake_casedef embed_text():
ClassesPascalCase (also called CapWords)class VectorStore:
ConstantsUPPER_SNAKE_CASEMAX_RESULTS = 10
Internal ("private") namesleading underscore_cache
Coming from Java: variables and methods are user_name, not userName. Classes look the same as in Java (VectorStore).
Pitfalls