def value(selfh)return self exp(- /self in this classwe use the definition of the scale height from above and compute and store this value as an attribute inside the constructor the attribute self is then used inside the value method notice that the constants grand arein this caselocal variables in the constructorand neither these nor are stored as attributes they are only accessible inside the constructorwhile self and self are stored and can be accessed later from within other methods at this pointmany will be confused by the self variableand the fact thatwhen we define the methods __init__ and value they take two argumentsbutwhen calling themthey take only one the explanation for this behavior is that self represents the object itselfand it is automatically passed as the first argument when we call method bound to the object when we write value( it is equivalent to the call barometric value( , here we explicitly call the value method that belongs to the barometric class and pass the instance as the first argument inside the methodb then becomes the local variable selfas is usual when passing arguments to functionand we can access its attributes tgand so on exactly the same thing happens when we call value( )but now the object is automatically passed as the first argument to the method it looks as if we are calling the method with single argumentbut in reality it gets two the use of the self variable in python classes has been the subject of many discussions even experienced programmers find it confusingand many have questioned why the language was designed this way there are some obvious advantages to the approachfor instanceit very clearly distinguishes between instance attributes (prefixed with selfand local variables defined inside method howeverif one is struggling to see the reasoning behind the self variableit is sufficient to remember the following two rules(iself is always the first argument in method definitionbut is never inserted when the method is calledand (iito access an attribute inside methodthe attribute needs to be prefixed with self an advantage of creating class for our barometric function is that we can now send value as an argument to any other function that expects function argument that takes single argument considerfor instancethe following small examplewhere the function make_table prints table of the function values for any function passed to itfrom math import sinexppi