Code review comment for lp://qastaging/~jderose/desktopcouch/ctx-should-default-to-None

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

It's so that internal details (that ctx defaults to desktopcouch.local_files.DEFAULT_CONTEXT) don't leak into subclasses, other functions/classes using it. It's also best-practice in the Python standard library... optional/keyword args default to simple, predictable values, most often None, sometime True/False, etc.

For example, in dmedia I need to provide a custom context when testing (Chad help me with this so I can test the same way desktopcouch itself does), but I don't want to deal with the desktopcouch.local_files.DEFAULT_CONTEXT detail myself.

See the dmedia MetaStore.__init__() on line 109: http://bazaar.launchpad.net/~jderose/dmedia/trunk/annotate/head%3A/dmedialib/metastore.py?start_revid=104

« Back to merge proposal