Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #2857

Re: Argument of the bool function

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bsk16@case.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'instance,': 0.05; '>>>>': 0.09; 'pm,': 0.11; '>>>': 0.12; 'wrote:': 0.14; '"x"': 0.16; 'subject:function': 0.16; 'argument': 0.16; 'invalid': 0.16; 'traceback': 0.16; '(most': 0.16; 'keyword': 0.19; 'header:In- Reply-To:1': 0.22; 'convert': 0.22; 'tells': 0.22; 'last):': 0.23; 'referring': 0.23; 'value.': 0.25; 'url:mailman': 0.27; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'testing': 0.28; 'fri,': 0.29; "python's": 0.29; 'context,': 0.31; 'typeerror:': 0.31; 'to:addr:python-list': 0.32; 'url:listinfo': 0.33; "isn't": 0.34; 'using': 0.34; 'file': 0.35; '"",': 0.35; 'constant': 0.35; 'function.': 0.35; 'doing': 0.36; 'assigned': 0.37; 'url:python': 0.37; 'exactly': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'url:org': 0.38; 'to.': 0.39; 'to:addr:python.org': 0.39; '2011': 0.62; 'truth': 0.65; 'candide': 0.84; 'received:129': 0.84
MIME-Version 1.0
In-Reply-To <4d9f374b$0$12803$426a34cc@news.free.fr>
References <4d9f374b$0$12803$426a34cc@news.free.fr>
Date Fri, 8 Apr 2011 12:41:50 -0400
Subject Re: Argument of the bool function
From Benjamin Kaplan <benjamin.kaplan@case.edu>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-Junkmail-Status score=10/49, host=mpv2.tis.cwru.edu
X-Junkmail-SD-Raw score=unknown, refid=str=0001.0A020205.4D9F3ACF.00CD,ss=1,fgs=0, ip=74.125.82.182, so=2010-02-10 23:06:36, dmn=2009-09-10 00:05:08, mode=single engine
X-Junkmail-IWF false
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.154.1302280920.9059.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 82.94.164.166
X-Trace 1302280920 news.xs4all.nl 65870 [::ffff:82.94.164.166]:56478
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2857

Show key headers only | View raw


On Fri, Apr 8, 2011 at 12:26 PM, candide <candide@free.invalid> 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
>>>>
>
>
> but _expression_ :
>
> x=42
>
>
> has no value.
>

That's because bool(x=5) isn't doing what you think.

>>> bool(y=5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'y' is an invalid keyword argument for this function

bool(x=5) is just passing the value 5 as the argument "x" to the function.

"value" means just what you'd think- any constant or any value that's
been assigned to.

>
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Argument of the bool function candide <candide@free.invalid> - 2011-04-08 18:26 +0200
  Re: Argument of the bool function Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-04-08 12:41 -0400
    Re: Argument of the bool function candide <candide@free.invalid> - 2011-04-10 14:54 +0200
      Re: Argument of the bool function Chris Angelico <rosuav@gmail.com> - 2011-04-10 23:02 +1000
        Re: Argument of the bool function Mel <mwilson@the-wire.com> - 2011-04-10 12:21 -0400
          Re: Argument of the bool function "Colin J. Williams" <cjw@ncf.ca> - 2011-04-10 13:51 -0400
          Re: Argument of the bool function Ben Finney <ben+python@benfinney.id.au> - 2011-04-11 09:46 +1000
          Re: Argument of the bool function Ethan Furman <ethan@stoneleaf.us> - 2011-04-11 16:00 -0700
  Re: Argument of the bool function Mel <mwilson@the-wire.com> - 2011-04-08 16:42 +0000
  Re: Argument of the bool function Ian Kelly <ian.g.kelly@gmail.com> - 2011-04-08 10:43 -0600
    Re: Argument of the bool function candide <candide@free.invalid> - 2011-04-08 23:32 +0200
      Re: Argument of the bool function Ethan Furman <ethan@stoneleaf.us> - 2011-04-08 15:03 -0700
        Re: Argument of the bool function candide <candide@free.invalid> - 2011-04-09 00:59 +0200
          Re: Argument of the bool function Lie Ryan <lie.1296@gmail.com> - 2011-04-09 15:45 +1000
            Re: Argument of the bool function Grant Edwards <invalid@invalid.invalid> - 2011-04-10 03:35 +0000
              Re: Argument of the bool function rusi <rustompmody@gmail.com> - 2011-04-09 21:15 -0700
                Re: Argument of the bool function Robert Kern <robert.kern@gmail.com> - 2011-04-10 01:22 -0500
          Re: Argument of the bool function Robert Kern <robert.kern@gmail.com> - 2011-04-09 18:22 -0500
            Re: Argument of the bool function candide <candide@free.invalid> - 2011-04-10 02:33 +0200
      Re: Argument of the bool function Ben Finney <ben+python@benfinney.id.au> - 2011-04-09 07:57 +1000

csiph-web