Important Notice:

Course Content
Scope & Module in Python (Chapter-12) M3-R5
About Lesson

LEGB Rule:-

                Legb का पूरा नाम local, enclosed, global, built in है यह पायथन में एक variable के scope का सम्भावित scope है।

      LEGB का role name space को define करने के लिए करते हैं जो variable name, function name और value को store करते हैं LEGB scope resolution के लिए precedency का order है LEGB rules उस sequence को define करता है जिसमें python names (variable, function, module etc) search करता है।

जैसे- किसी variable को दिए गए नाम का reference python को देते हैं तो python उस name को local, enclosing, global, built in के scope में sequence से देखेगा।

      जैसे- module name, function name, variable name, class name etc.

 

LEGB Rule:-

                The full name of LEGB is local, enclosed, global, built in. This is the possible scope of the scope of a variable in Python.

The role of LEGB is to define the name space that stores variable names, function names, and values. LEGB has an order of precedence for scope resolution. LEGB rules define the sequence in which python names (variable, function, module etc) searches.

For example, if we give reference of the name given to any variable to python, then python will see that name in sequence in the scope of local, enclosing, global, built in.

Like- module name, function name, variable name, class name etc.

error: Content is protected !!