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


Groups > comp.lang.python > #2855 > unrolled thread

Argument of the bool function

Started bycandide <candide@free.invalid>
First post2011-04-08 18:26 +0200
Last post2011-04-09 07:57 +1000
Articles 6 on this page of 26 — 15 participants

Back to article view | Back to comp.lang.python


Contents

  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 Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-25 16:29 +0200
              Re: Argument of the bool function Chris Angelico <rosuav@gmail.com> - 2011-04-26 05:33 +1000
                Re: Argument of the bool function Paul Rubin <no.email@nospam.invalid> - 2011-04-25 16:26 -0700
                  Re: Argument of the bool function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-04-26 02:38 +0000
              Re: Argument of the bool function Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-04-25 23:28 +0200
                Re: Argument of the bool function Ian Kelly <ian.g.kelly@gmail.com> - 2011-04-25 17:44 -0600
    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

Page 2 of 2 — ← Prev page 1 [2]


#2928

FromGrant Edwards <invalid@invalid.invalid>
Date2011-04-10 03:35 +0000
Message-ID<inr8hg$brg$1@reader1.panix.com>
In reply to#2891
On 2011-04-09, Lie Ryan <lie.1296@gmail.com> wrote:
> On 04/09/11 08:59, candide wrote:
>> Le 09/04/2011 00:03, Ethan Furman a ?crit :
>> 
>>>  > bool([x])

>> dir([object])

>> Not very meaningful, isn't it ?
>
> The error says it unambiguously, dir() does not take *keyword*
> arguments; instead dir() takes *positional* argument:
>
>     dir("Explicit is better than implicit")

I think the point is that both cases are documented exactly the same.

-- 
Grant

[toc] | [prev] | [next] | [standalone]


#2929

Fromrusi <rustompmody@gmail.com>
Date2011-04-09 21:15 -0700
Message-ID<15933c45-806d-4e39-a971-64330881de71@l18g2000yqm.googlegroups.com>
In reply to#2928
On Apr 10, 8:35 am, Grant Edwards <inva...@invalid.invalid> wrote:
> On 2011-04-09, Lie Ryan <lie.1...@gmail.com> wrote:
>
> > On 04/09/11 08:59, candide wrote:
> >> Le 09/04/2011 00:03, Ethan Furman a ?crit :
>
> >>>  > bool([x])
> >> dir([object])
> >> Not very meaningful, isn't it ?
>
> > The error says it unambiguously, dir() does not take *keyword*
> > arguments; instead dir() takes *positional* argument:
>
> >     dir("Explicit is better than implicit")
>
> I think the point is that both cases are documented exactly the same.

In what case(s) would a keyword arg to bool be reasonable?

[toc] | [prev] | [next] | [standalone]


#2932

FromRobert Kern <robert.kern@gmail.com>
Date2011-04-10 01:22 -0500
Message-ID<mailman.185.1302416709.9059.python-list@python.org>
In reply to#2929
On 2011-04-09 23:15 , rusi wrote:
> On Apr 10, 8:35 am, Grant Edwards<inva...@invalid.invalid>  wrote:
>> On 2011-04-09, Lie Ryan<lie.1...@gmail.com>  wrote:
>>
>>> On 04/09/11 08:59, candide wrote:
>>>> Le 09/04/2011 00:03, Ethan Furman a ?crit :
>>
>>>>>   >  bool([x])
>>>> dir([object])
>>>> Not very meaningful, isn't it ?
>>
>>> The error says it unambiguously, dir() does not take *keyword*
>>> arguments; instead dir() takes *positional* argument:
>>
>>>      dir("Explicit is better than implicit")
>>
>> I think the point is that both cases are documented exactly the same.
>
> In what case(s) would a keyword arg to bool be reasonable?

It's just an implementation detail. It's not worth the electrons wasted in this 
thread already.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

[toc] | [prev] | [next] | [standalone]


#2918

FromRobert Kern <robert.kern@gmail.com>
Date2011-04-09 18:22 -0500
Message-ID<mailman.180.1302391392.9059.python-list@python.org>
In reply to#2885
On 2011-04-08 17:59 , candide wrote:
> Le 09/04/2011 00:03, Ethan Furman a écrit :
>
>> > bool([x])
>> > Convert a value to a Boolean, using the standard truth testing
>> > procedure.
>> >
>>
>> As you can see, the parameter name is 'x'.
>
>
> OK, your response is clarifying my point ;)
>
>
> I didn't realize that in the bool([x]) syntax, identifier x refers to a
> "genuine" argument [I was considering x as referring to a "generic" object
> having a boolean value].
>
>
> Nevertheless, compare with the definition the doc provides for the builtin
> function dir():
>
> dir([object])
> [definition omited, just observe the declaration syntax]
>
> Now, lets make a try
>
>  >>> dir(object="Explicit is better than implicit")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: dir() takes no keyword arguments
>  >>>
>
> Not very meaningful, isn't it ?

No one is saying that every instance of "foo([arg])" in the docs means that the 
given argument is named such that it is available for keyword arguments. What 
people are saying is that for bool(), *that happens to be the case*.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

[toc] | [prev] | [next] | [standalone]


#2921

Fromcandide <candide@free.invalid>
Date2011-04-10 02:33 +0200
Message-ID<4da0faf3$0$6277$426a74cc@news.free.fr>
In reply to#2918
Le 10/04/2011 01:22, Robert Kern a écrit :

> No one is saying that every instance of "foo([arg])" in the docs means
> that the given argument is named such that it is available for keyword
> arguments. What people are saying is that for bool(), *that happens to
> be the case*.
>


what a piece of luck! ;)

[toc] | [prev] | [next] | [standalone]


#2880

FromBen Finney <ben+python@benfinney.id.au>
Date2011-04-09 07:57 +1000
Message-ID<87k4f4e78j.fsf@benfinney.id.au>
In reply to#2877
candide <candide@free.invalid> writes:

> Le 08/04/2011 18:43, Ian Kelly a écrit :

> > In "bool(x=5)", "x=5" is also not an expression. It's passing the
> > expression "5" in as the parameter x, using a keyword argument.
>
> You are probably right but how do you deduce this brilliant
> interpretation from the wording given in the documentation ?

By also learning the language syntax. ‘foo=bar’ within the parameters to
a function call will always mean binding a value to a keyword argument.

Just as the function docstring should not spend any space to explain
what the parens mean, it should not spend any space to explain how to
pass keyword arguments.

-- 
 \          “When [science] permits us to see the far side of some new |
  `\      horizon, we remember those who prepared the way – seeing for |
_o__)                          them also.” —Carl Sagan, _Cosmos_, 1980 |
Ben Finney

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web