In a blog post analyzing Python PDF libraries, S.Lott makes the following comment:
Here’s one example of remarkably poor programming:
#Connect the parser and document objects.
parser.set_document(doc)
doc.set_parser(parser)
Only one of these two is needed; the other is trivially handled as part of the setter method.
What is the a Pythonic way of doing this via the setter method?
Though in practice, I would redesign the document and parser classes to avoid circular references. Not only do they add conceptual complexity, they interfere with garbage collection as well unless weak references are used.