![]() |
Returns True
if py_object
might be a singleton value .
tfdocs.doc_generator_visitor.maybe_singleton(
py_object: Any
) -> bool
Many immutable values in python act like singletons: small ints, some strings, Bools, None, the empty tuple.
We can't rely on looking these up by their id()
to find their name or
duplicates.
This function checks if the object is one of those maybe singleton values.
Args | |
---|---|
py_object
|
the object to check. |
Returns | |
---|---|
A bool, True if the object might be a singleton. |