[Python-ideas] bool.from_config_str()

Steven D'Aprano steve at pearwood.info
Mon Jun 13 02:21:49 EDT 2016


On Mon, Jun 13, 2016 at 02:52:07PM +1000, Ben Finney wrote:

> (I am also a bit baffled to see some respondents in this thread
> expressing the notion there is no consensus on what input text should
> convert to a Boolean. The ‘configparser’ module is an obvious touchstone
> here for other Python behaviour, IMO.)

To be honest, I had forgotten about configparser. But I stand by my 
earlier comments: in this 21st century globally-connected world, to 
expect all users to write "yes" in a config file when they mean "oui" or 
"ja" is unacceptable.

configparser works because the RawConfigParser class doesn't hard-code a 
list of strings, it sets an attribute BOOLEAN_STATES which can be 
overridden by instances.


-- 
Steve


More information about the Python-ideas mailing list