Replies

  • In software testing solutions, the term 'scope' in Python language is generally used for defining the hierarchy from where the value of any variable should come from.
    Generally, this scope resolution is defined using the LEGB protocol in web application testing services.

    LEGB stands for Local -> Enclosed -> Global -> Built-in where the arrows define the direction of the namespace-hierarchy search order.

    i) Local -> This kind of scope is defined for variables inside any function or class..
    ii) Enclosed -> This scope can be used inside its enclosing function.
    iii) Global -> This kind of scope refers to the upper-most level of the executing script.
    iv) Built-in -> Built-in scopes are special names that Python reserves for itself.

    For example:
    first = 100
    second = 200
     
    def outerMethod():
        third = 300
     
        def innerMethod():
            first = 300
            print('Local value is: {first}')
            print('Enclosed value is: {third}')
            print('Global value is: {second}')
         
        innerMethod();
     
    outerMethod();

    The result will be:
    Local value is: 300
    Enclosed value is: 300
    Global value is: 200

    The Best Software Testing Services Company - QASource
    Partner with the leading software testing company - QASource, and accomplish all your software testing services goals within strict deadlines and bud…
This reply was deleted.
    results->result as $result) { ?>
  1. jobtitle;?>
    company;?>(formattedRelativeTime;?>)city;?>, state;?>
    Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.