Reusing Built-in Names
What this preview is
Reusing Built-in Names is a cooked quant interview question on language knowledge in Python.
- Difficulty
- Cooked
- Topic
- Language Knowledge
- Discipline
- Quant development
- Language
- Python
- Companies
- 0
Understanding Python built-in name shadowing
This is a foundational Python language-knowledge question that tests whether you understand how variable scope and name resolution work in Python. It's the kind of gotcha that catches careless coders and reveals whether you've actually debugged Python code or just skimmed syntax.
The core issue revolves around how Python's name-lookup order prioritizes local and global scope over the built-in namespace. When you assign a name at module level or within a function, you create a binding that shadows—or temporarily hides—any built-in with the same name. This is legal Python, but it has immediate and sometimes subtle consequences for any code that tries to use the standard library function or type.
- Python's name-resolution order (LEGB rule)
- Built-in namespace vs. local/global scope
- How shadowing affects subsequent calls and imports
- Common debugging scenarios and best practices
Related practice
Unlock full access to getcracked
Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.