what does "unqualified on right hand side" mean in OOPs (Python)? -
i came across "unqualified on right hand side" phrase while reading oops concept in python usage self._customer = customer. phrase trying explain? complete statement is
for example, command,
self._customer = customer, assigns instance variableself._customerparametercustomer; note becausecustomerunqualified on right-hand side, refers parameter in local namespace. --data structures , algorithms in python p. 72
according python docs
qualified name
a dotted name showing “path” module’s global scope class, function or method defined in module, defined in pep 3155. top-level functions , classes, qualified name same object’s name:
...
when used refer modules, qualified name means entire dotted path module, including parent packages, e.g. email.mime.text:
put more simply, qualifying name in python means explicitly define scope. self._customer qualified name (it identifies instance variable customer enclosing class) whereas bare customerreference not specify scope qualifications.
when name unqualified, python applies lexical scoping rules try , find variable, searching (in order)
- local variables (including function parameters)
- variables local outer functions, if we're dealing nested function definition
- global variables
- built-in variables
Comments
Post a Comment