Module tp.client.pyscheme.symbol
A simple "symbol" class for Python. Symbols are like strings,
except that symbols should only be comparable to other symbols. This
module is designed so that one should be able to do a "from symbol
import *" on this.
To create a new Symbol, use the Symbol() function, like this:
hello = Symbol("hello")
All symbols are interned so that comparison using 'is' will work. For
example,
Symbol("hello") is Symbol("h" + "ello")
should work.
By default, all symbols are case insensitive, but if the module
variable CASE_SENSITIVE is set to a true value, symbols will become
case sensitive.
Also, we use the UserString to make sure that symbols are of a
different "class" than Strings. isSymbol() depends on this
representation, so be careful about changing it.
| Classes |
__Symbol |
Support class for symbols. |
| Function Summary |
| |
isSymbol(x)
Returns True if x is already a symbol. |
| |
Symbol(s)
Generates a new Symbol that we guarantee can be compared in
constant time to any other symbol. |
| |
makeUniqueTemporary(_counter)
Constructs a symbol that does not collide with any other
symbol. |
isSymbol(x)
Returns True if x is already a symbol.
-
|
Symbol(s)
Generates a new Symbol that we guarantee can be compared in
constant time to any other symbol.
-
|
makeUniqueTemporary(_counter=[0])
Constructs a symbol that does not collide with any other
symbol. I'll use this to help with the macro-expansion.
NOTE/FIXME: we do this by making an "illegal" symbol which starts
with a number and contains a space. The parser module doesn't
allow such symbols to exist... although it's possible to subvert this
by calling STRING->SYMBOL. So this mechanism is not perfect.
-
|
__interned_symbols
-
- Type:
-
WeakValueDictionary
- Value:
<WeakValueDictionary at -1214362580>
|
|
__license__
-
- Type:
-
str
- Value:
|
CASE_SENSITIVE
-
- Type:
-
int
- Value:
|