Is there a boolean(somestring) equivalent of int(somestring). bool('false') -> True

Joe Mason joe at notcharles.ca
Mon Apr 12 02:53:53 EDT 2004


In article <mailman.536.1081742734.20120.python-list at python.org>, Paul Prescod wrote:
> Maybe in your mind. What about "true", "TRUE", "oui", "1.0", "positive" 
> and "yeah". How far do you intend to go? Name a single language or 
> system that treats "True", "on", "1" and "yes" as positive values and 
> "False", "off", "0" and "no" as negative values. If Python started 

UniConf

http://open.nit.ca/wiki/?page=UniConf

(The current list is "true", "yes", "on", and "enabled" evaluate to 1,
"false", "no", "off", and "disabled" to 0, anything else is passed
through strtol.  This is specifically a configuration system, where it
makes sense to be forgiving in what you accept, but you did ask for a
language *or system*.)

Joe



More information about the Python-list mailing list