Python language

LEGB

Name resolution order: Local, Enclosing, Global, Built-in.

Why interviewers ask about it

The consequence is what gets asked: assigning to a name anywhere in a function makes it local for the whole function, so reading it earlier raises UnboundLocalError rather than falling through to the global.

This term is part of the free Python Full-Stack interview preparation module - browse the full glossary for every definition.