En Tue, 30 Oct 2007 14:43:48 -0300, Duncan Booth
<[EMAIL PROTECTED]> escribió:
> "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
>
>>> >>> help(int)
>>> Help on class int in module __builtin__:
>>>
>>> class int(object)
>>> | int(x[, base]) -> integer
>>> ...
>>>
>> OK, good point. Perhaps it's
"J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
>> How do you interpret:
>>
>> >>> help(__import__)
>> Help on built-in function __import__ in module __builtin__:
>>
>> __import__(...)
>> __import__(name, globals={}, locals={}, fromlist=[], level=-1) ->
>> module
>> ...
>> >>> help(int)
>> Hel
On Tue, 30 Oct 2007 07:28:07 +0200, Hendrik van Rooyen wrote:
> yes - the point I am trying to make is that the intention of the OP
> was to use an assignment as an argument, and you can't do that,
> as the interpreter thinks its a keyword. Hence the gotcha.
Then you must have misunderstand his
"Jean-Paul Calderone" <[EMAIL PROTECTED]> wrote:
> On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen <[EMAIL PROTECTED]>
wrote:
> >Looks like a gotcha to me - its the difference between a keyword
> >(master = 42) and an assignment (s='I am a string')
> >
>
> But it's not a keyword:
>
> >
On Mon, Oct 29, 2007 at 06:45:22PM +, Duncan Booth wrote regarding Re:
Built-in functions and keyword arguments:
>
> "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
>
> >> I think you are being a little bit unfair here: help(len) says:
> >>
&g
"J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
>> I think you are being a little bit unfair here: help(len) says:
>>
>> len(...)
>> len(object) -> integer
>>
>> Return the number of items of a sequence or mapping.
>>
>> which implies that the argument to len has the name 'object'
>>
On Mon, Oct 29, 2007 at 02:27:50PM +, Duncan Booth wrote regarding Re:
Built-in functions and keyword arguments:
>
> Bruno Desthuilliers <[EMAIL PROTECTED]>
> wrote:
>
> > In the second case, the name of the argument *is* 'object'. Which is not
>
On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen <[EMAIL PROTECTED]>
wrote:
>"Tim Chase" <[EMAIL PROTECTED]>
>
>> > I think you are being a little bit unfair here: help(len) says:
>> >
>> > len(...)
>> > len(object) -> integer
>> >
>> > Return the number of items of a sequence or map
Armando Serrano Lombillo a écrit :
> On Oct 29, 3:20 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote:
>> Armando Serrano Lombillo a écrit :
>>
>>> Why does Python give an error when I try to do this:
>> len(object=[1,2])
>>> Traceback (most recent call last):
>>> File "", line 1, in
>>>
"Tim Chase" <[EMAIL PROTECTED]>
> > I think you are being a little bit unfair here: help(len) says:
> >
> > len(...)
> > len(object) -> integer
> >
> > Return the number of items of a sequence or mapping.
> >
> > which implies that the argument to len has the name 'object' (although
On Mon, 29 Oct 2007 08:34:58 -0700, Armando Serrano Lombillo wrote:
> On Oct 29, 3:10 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
>>
>> I don't know if the reason that most builtin functions don't accept
>> keywords is just historical (someone would have to go through a lot of
>> code and add keyw
On Oct 29, 3:20 pm, Bruno Desthuilliers wrote:
> Armando Serrano Lombillo a écrit :
>
> > Why does Python give an error when I try to do this:
>
> len(object=[1,2])
> > Traceback (most recent call last):
> > File "", line 1, in
> > len(object=[1,2])
> > TypeError: len() takes no keywor
On Oct 29, 3:10 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Armando Serrano Lombillo <[EMAIL PROTECTED]> wrote:
>
>
>
> > Why does Python give an error when I try to do this:
>
> len(object=[1,2])
> > Traceback (most recent call last):
> > File "", line 1, in
> > len(object=[1,2])
> >
>>
>> While we're at it, you should avoid using builtin's names for
>> identifiers - here, using 'object' as the arg name shadows the builtin
>> 'object' class).
>>
>
> I think you are being a little bit unfair here: help(len) says:
>
> len(...)
> len(object) -> integer
>
> Retur
Bruno Desthuilliers <[EMAIL PROTECTED]>
wrote:
> In the second case, the name of the argument *is* 'object'. Which is not
> the case for the builtin len (which, fwiw, has type
> 'builtin_function_or_method', not 'function', so inspect.getargspec
> couldn't tell me more).
>
>
> While we're at
On Mon, 29 Oct 2007 13:52:04 +, Armando Serrano Lombillo wrote:
> Why does Python give an error when I try to do this:
>
len(object=[1,2])
> Traceback (most recent call last):
> File "", line 1, in
> len(object=[1,2])
> TypeError: len() takes no keyword arguments
>
> but not when
Armando Serrano Lombillo a écrit :
> Why does Python give an error when I try to do this:
>
len(object=[1,2])
> Traceback (most recent call last):
> File "", line 1, in
> len(object=[1,2])
> TypeError: len() takes no keyword arguments
>
> but not when I use a "normal" function:
>
>>>
Armando Serrano Lombillo <[EMAIL PROTECTED]> wrote:
> Why does Python give an error when I try to do this:
>
len(object=[1,2])
> Traceback (most recent call last):
> File "", line 1, in
> len(object=[1,2])
> TypeError: len() takes no keyword arguments
>
> but not when I use a "normal
Why does Python give an error when I try to do this:
>>> len(object=[1,2])
Traceback (most recent call last):
File "", line 1, in
len(object=[1,2])
TypeError: len() takes no keyword arguments
but not when I use a "normal" function:
>>> def my_len(object):
return len(object)
>>> m
19 matches
Mail list logo