Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
symtable.Symbol Class Reference
Inheritance diagram for symtable.Symbol:
Inheritance graph
[legend]
Collaboration diagram for symtable.Symbol:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def get_name
def is_referenced
def is_parameter
def is_global
def is_declared_global
def is_local
def is_free
def is_imported
def is_assigned
def is_namespace
def get_namespaces
def get_namespace

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 __name
 __flags
 __scope
 __namespaces

Detailed Description

Definition at line 172 of file symtable.py.


Constructor & Destructor Documentation

def symtable.Symbol.__init__ (   self,
  name,
  flags,
  namespaces = None 
)

Definition at line 174 of file symtable.py.

00174 
00175     def __init__(self, name, flags, namespaces=None):
00176         self.__name = name
00177         self.__flags = flags
00178         self.__scope = (flags >> SCOPE_OFF) & SCOPE_MASK # like PyST_GetScope()
00179         self.__namespaces = namespaces or ()

Here is the caller graph for this function:


Member Function Documentation

def symtable.Symbol.__repr__ (   self)

Definition at line 180 of file symtable.py.

00180 
00181     def __repr__(self):
00182         return "<symbol {0!r}>".format(self.__name)

def symtable.Symbol.get_name (   self)

Definition at line 183 of file symtable.py.

00183 
00184     def get_name(self):
00185         return self.__name

Returns the single namespace bound to this name.

Raises ValueError if the name is bound to multiple namespaces.

Definition at line 227 of file symtable.py.

00227 
00228     def get_namespace(self):
00229         """Returns the single namespace bound to this name.
00230 
00231         Raises ValueError if the name is bound to multiple namespaces.
00232         """
00233         if len(self.__namespaces) != 1:
00234             raise ValueError("name is bound to multiple namespaces")
00235         return self.__namespaces[0]

Return a list of namespaces bound to this name

Definition at line 223 of file symtable.py.

00223 
00224     def get_namespaces(self):
00225         """Return a list of namespaces bound to this name"""
00226         return self.__namespaces

Definition at line 207 of file symtable.py.

00207 
00208     def is_assigned(self):
00209         return bool(self.__flags & DEF_LOCAL)

Definition at line 195 of file symtable.py.

00195 
00196     def is_declared_global(self):
00197         return bool(self.__scope == GLOBAL_EXPLICIT)

def symtable.Symbol.is_free (   self)

Definition at line 201 of file symtable.py.

00201 
00202     def is_free(self):
00203         return bool(self.__scope == FREE)

def symtable.Symbol.is_global (   self)

Definition at line 192 of file symtable.py.

00192 
00193     def is_global(self):
00194         return bool(self.__scope in (GLOBAL_IMPLICIT, GLOBAL_EXPLICIT))

Definition at line 204 of file symtable.py.

00204 
00205     def is_imported(self):
00206         return bool(self.__flags & DEF_IMPORT)

def symtable.Symbol.is_local (   self)

Definition at line 198 of file symtable.py.

00198 
00199     def is_local(self):
00200         return bool(self.__flags & DEF_BOUND)

Returns true if name binding introduces new namespace.

If the name is used as the target of a function or class
statement, this will be true.

Note that a single name can be bound to multiple objects.  If
is_namespace() is true, the name may also be bound to other
objects, like an int or list, that does not introduce a new
namespace.

Definition at line 210 of file symtable.py.

00210 
00211     def is_namespace(self):
00212         """Returns true if name binding introduces new namespace.
00213 
00214         If the name is used as the target of a function or class
00215         statement, this will be true.
00216 
00217         Note that a single name can be bound to multiple objects.  If
00218         is_namespace() is true, the name may also be bound to other
00219         objects, like an int or list, that does not introduce a new
00220         namespace.
00221         """
00222         return bool(self.__namespaces)

Definition at line 189 of file symtable.py.

00189 
00190     def is_parameter(self):
00191         return bool(self.__flags & DEF_PARAM)

Definition at line 186 of file symtable.py.

00186 
00187     def is_referenced(self):
00188         return bool(self.__flags & _symtable.USE)


Member Data Documentation

Definition at line 176 of file symtable.py.

Definition at line 175 of file symtable.py.

Definition at line 178 of file symtable.py.

Definition at line 177 of file symtable.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: