def addglobal(self, name):
'''Define a given entity as global.
Args:
name (str): Name of the entity to make global.
Raises:
FyppFatalError: If entity name is invalid or if the current scope is
a local scope and entity is already defined in it.
'''
varnames = self._get_variable_names(name)
for varname in varnames:
self._check_variable_name(varname)
if self._locals is not None:
if varname in self._locals:
msg = "variable '{0}' already defined in local scope"\
.format(varname)
raise FyppFatalError(msg)
self._globalrefs.add(varname)
评论列表
文章目录