class documentation

class symbol(object):

View In Hierarchy

A constant symbol.

>>> symbol('foo') is symbol('foo')
True
>>> symbol('foo')
<symbol 'foo>

A slight refinement of the MAGICCOOKIE=object() pattern. The primary advantage of symbol() is its repr(). They are also singletons.

Repeated calls of symbol('name') will all return the same instance.

The optional doc argument assigns to __doc__. This is strictly so that Sphinx autoattr picks up the docstring we want (it doesn't appear to pick up the in-module docstring if the datamember is in a different module - autoattribute also blows up completely). If Sphinx fixes/improves this then we would no longer need doc here.

Class Method parse​_user​_argument Given a user parameter, parse the parameter into a chosen symbol.
Method __new__ Undocumented
Class Variable ​_lock Undocumented
Class Variable symbols Undocumented
@classmethod
def parse_user_argument(cls, arg, choices, name, resolve_symbol_names=False):

Given a user parameter, parse the parameter into a chosen symbol.

The user argument can be a string name that matches the name of a symbol, or the symbol object itself, or any number of alternate choices such as True/False/ None etc.

Parameters
argthe user argument.
choicesdictionary of symbol object to list of possible entries.
namename of the argument. Used in an .ArgumentError that is raised if the parameter doesn't match any available argument.
resolve​_symbol​_namesinclude the name of each symbol as a valid entry.
def __new__(cls, name, doc=None, canonical=None):

Undocumented

_lock =

Undocumented

symbols: dict =

Undocumented