[Python-Dev] ConfigParser patches

Raymond Hettinger python at rcn.com
Fri Oct 1 22:07:44 CEST 2004


[David Goodger]
> In Python 2.3 and earlier,
> ConfigParser implicitly allowed non-string values to be set.
> http://python.org/sf/810843 asked for clarification, and in rev 1.65
> an explicit type check was added that raises TypeError.

Instead of an explicit type check, it may be better to wrap the
interpolation step in a try/except.  For non-string objects, raise a
TypeError with an informative error message.  This would meet the OP's
need for an informative error message while leaving the module backwards
compatible for internal uses of ConfigParser.  

Ideally, the docs should discourage further non-string uses and advise
that ConfigParser will be string only for Py3.0.



Raymond



More information about the Python-Dev mailing list