"Robert Kern" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In many, many fonts 'l' and '1' look close enough to be easily mistaken
> for one another
In the default font used by Outlook Express, displayed on my 1078x786
screen, the only difference I can see, using a magnifying g
James wrote:
[James Stroud wrote:]
>>Also, you shouldn't use "1", I mean "l", as a variable name. It gets confusing
>>because "l", I mean "1", looks a lot like "1", I mean "l".
>
> I have seen the same warnning above significantly several times.
> Is this problem originally came from the similari
Steve Holden wrote:
> Kay Schluehr wrote:
> > Mike Meyer wrote:
> >
> >
> >>Yes, but the function "sorted" is more useful than a list method
> >>"sorted" in a duck typing language.
> >
> >
> > I don't see what this has to do with "duck typing"? sorted() is simply
> > a generic function accepting d
> Also, you shouldn't use "1", I mean "l", as a variable name. It gets confusing
> because "l", I mean "1", looks a lot like "1", I mean "l".
I have seen the same warnning above significantly several times.
Is this problem originally came from the similarities between 'l' and
'1'
or from bad looki
Kay Schluehr wrote:
> Mike Meyer wrote:
>
>
>>Yes, but the function "sorted" is more useful than a list method
>>"sorted" in a duck typing language.
>
>
> I don't see what this has to do with "duck typing"? sorted() is simply
> a generic function accepting different types. I'm not aware that
>
Terry Reedy wrote:
> "Kay Schluehr" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > On the other hand there exists no sorted() method for tuples or lists
> > like join() for strings but it is implemented as a function in Python24
> > that returns a new sorted container. I consider
Mike Meyer wrote:
> Yes, but the function "sorted" is more useful than a list method
> "sorted" in a duck typing language.
I don't see what this has to do with "duck typing"? sorted() is simply
a generic function accepting different types. I'm not aware that
sorted() requires a specific interface
"Kay Schluehr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On the other hand there exists no sorted() method for tuples or lists
> like join() for strings but it is implemented as a function in Python24
> that returns a new sorted container. I consider this as an
> inconsistency
"Kay Schluehr" <[EMAIL PROTECTED]> writes:
> If you define
>
sep = ""
sep.join(["d","o","g"])
> "dog"
sep
> ''
>
> sep is preserved and a new "dog" string is generated. Since sep is
> immutable there is no way to manipulate it inplace.
>
> On the other hand there exists no sorted() m
Dave Benjamin <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>> Dave Benjamin <[EMAIL PROTECTED]> writes:
>>>Python is actually quite consistent in this regard: methods that
>>>modify an object in-place return None;
>> Um, no. list.pop comes to mind as an immediate counterexample. It may
>> be the
[EMAIL PROTECTED] wrote:
> Let's say I define a list of pairs as follows:
> >>l = [('d', 3), ('a', 2), ('b', 1)]
>
> Can anyone explain why this does not work?
> >>h = {}.update(l)
>
> and instead I have to go:
> >>h = {}
> >>h.update(l)
> to initialize a dictionary with the given list of pairs?
>
Dave Benjamin wrote:
> Mike Meyer wrote:
>> Dave Benjamin <[EMAIL PROTECTED]> writes:
>>
>>>Python is actually quite consistent in this regard: methods that
>>>modify an object in-place return None;
>>
>> Um, no. list.pop comes to mind as an immediate counterexample. It may
>> be the only one...
Mike Meyer wrote:
> Dave Benjamin <[EMAIL PROTECTED]> writes:
>
>>Python is actually quite consistent in this regard: methods that
>>modify an object in-place return None;
>
> Um, no. list.pop comes to mind as an immediate counterexample. It may
> be the only one...
I'm sure there are counterexa
Dave Benjamin <[EMAIL PROTECTED]> writes:
> Python is actually quite consistent in this regard: methods that
> modify an object in-place return None;
Um, no. list.pop comes to mind as an immediate counterexample. It may
be the only one...
http://www.mired.org/home/mwm/
Indepe
[EMAIL PROTECTED] wrote:
> Let's say I define a list of pairs as follows:
>
>>>l = [('d', 3), ('a', 2), ('b', 1)]
>
>
> Can anyone explain why this does not work?
>
>>>h = {}.update(l)
>
>
> and instead I have to go:
>
>>>h = {}
>>>h.update(l)
>
> to initialize a dictionary with the given l
On 8 Sep 2005 16:03:12 -0700, [EMAIL PROTECTED] wrote:
>Let's say I define a list of pairs as follows:
>>>l = [('d', 3), ('a', 2), ('b', 1)]
>
>Can anyone explain why this does not work?
>>>h = {}.update(l)
>
>and instead I have to go:
>>>h = {}
>>>h.update(l)
>to initialize a dictionary with the
update updates the dictionary in place - it actually returns None, not
the updated dict. However, you can construct a dictionary from a list
of (key, value) pairs using dict(list). Example:
>>>l = [('foo', 'bar'), ('baz', 'qig')]
>>>d = dict(l)
>>>print d
{'foo': 'bar', 'baz': 'qig'}
--
http://m
This is the difference between mutable and immutable types. In this sense it
is consistent.
If you want to do the former in one shot:
h = dict(l)
Also, you shouldn't use "1", I mean "l", as a variable name. It gets confusing
because "l", I mean "1", looks a lot like "1", I mean "l".
James
Let's say I define a list of pairs as follows:
>>l = [('d', 3), ('a', 2), ('b', 1)]
Can anyone explain why this does not work?
>>h = {}.update(l)
and instead I have to go:
>>h = {}
>>h.update(l)
to initialize a dictionary with the given list of pairs?
when an analagous operation on strings works
19 matches
Mail list logo