add warning box to clarify Scope metadata only handles local variable

This commit is contained in:
Jimmy Lai 2019-10-07 10:26:36 -07:00 committed by jimmylai
parent 9f8e69b1b3
commit dea7c20794

View file

@ -282,8 +282,16 @@ class Scope(abc.ABC):
A scope has a parent scope which represents the inheritance relationship. That means
an assignment in parent scope is viewable to the child scope and the child scope may
overwrites the assignment by using the same name.
Use ``name in scope`` to check whether a name is viewable in the scope.
Use ``scope[name]`` to retrieve all viewable assignments in the scope.
.. warning::
This scope analysis module only analyzes local variable names and it doesn't handle
attribute names; for example, given a.b.c = 1, local variable name ``a`` is recorded
as an assignment instead of ``c`` or ``a.b.c``. To analyze the assignment/access of
arbitrary object attributes, we leave the the job to type inference metadata provider
coming in the future.
"""
#: Parent scope. Note the parent scope of a GlobalScope is itself.