Next: Type Style Recommendations, Previous: The Freeze-Type Declaration, Up: More About Types in Python [Contents][Index]
Avoid use of the and
, not
and satisfies
types in
declarations, since type inference has problems with them. When these
types do appear in a declaration, they are still checked precisely,
but the type information is of limited use to the compiler.
and
types are effective as long as the intersection can be
canonicalized to a type that doesn’t use and
. For example:
(and fixnum unsigned-byte)
is fine, since it is the same as:
(integer 0 most-positive-fixnum)
but this type:
(and symbol (not (member :end)))
will not be fully understood by type interference since the and
can’t be removed by canonicalization.
Using any of these type specifiers in a type test with typep
or
typecase
is fine, since as tests, these types can be translated
into the and
macro, the not
function or a call to the
satisfies predicate.
Next: Type Style Recommendations, Previous: The Freeze-Type Declaration, Up: More About Types in Python [Contents][Index]