Repost: Suggestion - builtin module 'settings' and usage conventions

Kenneth Manheimer (klm@nist.gov)
Tue, 26 Jul 1994 19:46:27 GMT

I think it would be good for python to institute some sort of package-
default-values mechanism, for use by system, optional, and custom
packages.

I recently customized pdb/bdb so that the code line was printed on a
separate line, just after the file/frame data, rather than on the same
line. I wanted to parameterize the change, so anyone could set the
format to their own preference (and i could make the default the same
as the current setting, to promote acceptance of the change), rather
than having it hardcoded, as it currently is. I did so, but the
change isn't really very useful, because (1) i have to load the
package before i can set the defaults, and (2) there are no
conventions for implementing package defaults, so other people can't
generally take advantage of my changes. (Being a big emacs user, i'm
used to the somewhat bizarre defvar/setq-default stuff. It sometimes
seems arcane, and is probably much too elaborate for our needs, but at
least its something.)

One approach that occurs to me is to institute a builtin module, eg
'settings', specifically for registering customization settings.
Modules are particularly suitable for communicating this kind of
state, because you get the same one when you import it to different
contexts. I didn't think it would be a good idea to crowd an already
established module, like sys, with the default values, though perhaps
it would make sense to have settings be a dict in sys, for this
purpose. It may even be worth stipulating a specific structure to the
settings object, where eg package specific values are registered in
dictionaries keyed to the packages name, and generic settings occupy
the top level...

This is nothing very fancy. I mainly bring it up because i think that
it would be useful to have something for this purpose, and such a
thing would be valuable only if we come to some sort of widespread
agreements and conventions for its use.

Ken
ken.manheimer@nist.gov, 301 975-3539