Add dir to DefinedNamespaceMeta. by edmondchuc · Pull Request #1626 · RDFLib/rdflib (original) (raw)
Technically this breaks the interface, as anything that depended on the default dir implementation would break. Not sure if this is a serious concern, but something we should think about.
$ pipx run --spec rdflib==6.1.1 python3 -c 'from rdflib import RDF; print(dir(RDF))' ['_NS', 'annotations', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_fail', '_underscore_num']
I highly doubt that this would be a problem for anyone though.
I'm fine with this approach and think it is likely best, but as a note to other reviewers; it would be good to think about other options, like providing an explicit method for it, thought that raises same concerns as before with name conflicts so that is likely worse.