A weakref cache factory

class sage.misc.cache.Cache(factory_function)

A weakref cache for arbitrary objects via an arbitrary function.

format_names(names, n=1)

Many objects have a names argument. This function formats it, i.e., if it is a list it turns it into a tuple, and if it is a string and the number of names needed is bigger than 1, it makes each letter of the string an element of a tuple.

has_object(*args, **kwds)

Returns true if cache has object defined by the given args.

key(*args, **kwds)

Return the key associated to the given args. Note that the values must be hashable.