Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Mel Newsgroups: comp.lang.python Subject: Re: Argument of the bool function Date: Fri, 8 Apr 2011 16:42:22 +0000 (UTC) Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <4d9f374b$0$12803$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Fri, 8 Apr 2011 16:42:22 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="vQeBgNEmUBRlsrjdW42Q2g"; logging-data="23992"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RSLFswK+7mVz1WxLSkoq2" User-Agent: XPN/1.2.6 (Street Spirit ; Linux) Cancel-Lock: sha1:Th71SYOBjK8RfPzMEuQp0IIwlpc= Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2858 candide wrote: > About the standard function bool(), Python's official documentation > tells us the following : > > bool([x]) > Convert a value to a Boolean, using the standard truth testing procedure. > > In this context, what exactly a "value" is referring to ? > > For instance, > >>> x=42 > >>> bool(x=5) > True > >>> Cute. What's happening here is that `x=5` isn't really an expression. It's passing a value to the named parameter `x`, specified in the definition of `bool`. Try it with something else: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> bool(y=5) Traceback (most recent call last): File "", line 1, in TypeError: 'y' is an invalid keyword argument for this function Mel.