[Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc. (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 10 04:40:34 CEST 2007


Phillip J. Eby wrote:

For example, objects to be documented with pydoc currently have to reverse engineer a bunch of inspection code, while in a GF-based design they'd just add methods.

There's a problem with this that I haven't seen a good answer to yet. To add a method to a generic function, you have to import the module that defines the base function. So any module that wants its objects documented in a custom way ends up depending on pydoc.

This problem doesn't arise if a protocol-based approach is used, e.g. having pydoc look for a document method or some such.

There's also the possibility that other documentation systems could make use of the same protocol if it's designed appropriately, whereas extending pydoc-defined generic functions benefits pydoc and nothing else.

-- Greg



More information about the Python-3000 mailing list