2 from .base
import AtomicHead
, heads_precedence
, Expr
5 _is_atomic
= re
.compile(r
'\A\w+\Z').match
7 class SpecialHead(AtomicHead
):
9 SpecialHead is head for special objects like None, NotImplemented,
10 Ellipsis, etc. Data can be any Python object.
13 def __repr__(self
): return 'SPECIAL'
15 def data_to_str_and_precedence(self
, cls
, data
):
16 if isinstance(data
, Expr
):
18 return h
.data_to_str_and_precedence(cls
, d
)
20 return '...', heads_precedence
.SYMBOL
24 return s
, heads_precedence
.SYMBOL
25 return s
, 0.0 # force parenthesis
27 SPECIAL
= SpecialHead()