Isvaliduri optimization · Pull Request #1779 · RDFLib/rdflib (original) (raw)

I think we need more documentation in namespace/__init__.py though. What is the purpose of __cache? Sure, it can be discovered by reading all the code but this is hard. This goes for trie also. I also don't see anything useful for cache or trie in the Sphinx docco either.

AIUI, both cache and trie were introduced purely for internal efficency/speed and never intended to be exposed in the public API. Blame/credit tgbugs for the Mar 2020 implementation in commit #ee5ffb9

Perhaps @gjhiggins you can point to where some documentation is and I can have a go at adding it to the NamespaceManager class alongside all the docco I've just written for the new bind_namespaces parameter I'm adding in PR #1686.

I don't know of any documentation other than the extant Namespaces and Bindings docco - and in the case of NamespaceManager.bind() the docstring (noting that override defaults to True):

def bind(self, prefix, namespace, override=True, replace=False):
    """bind a given namespace to the prefix

    if override, rebind, even if the given namespace is already
    bound to another prefix.

    if replace, replace any existing prefix with the new namespace
    """

(FWIW, I'm planning to contribute a complete overhaul and re-org of the docs to accompany 7.0, aucampia's recent adjustment enabling the building of PR docs will be enormously useful in that context.)