> Date: Wed, 27 Jan 2016 02:24:35 +1100
> From: st...@pearwood.info
> To: tutor@python.org
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> On Sun, Jan 24, 2016 at 07:47:47PM +, Albert-Jan Roskam wrote:
>
>>&
On Sun, Jan 24, 2016 at 07:47:47PM +, Albert-Jan Roskam wrote:
> > You appear to be confusing ordered and sorted.
>
> You are correct. Is there a difference in the way those terms are
> used colloquially vs. in the field of Computer Science (Note: English
> is not my mother tongue)?
In
On 24 January 2016 at 20:29, Albert-Jan Roskam wrote:
>> I guess that the authors of OrderedDict just didn't really consider
>> this to be very useful. Apart from having ordered iteration
>> OrderedDict is not really that deeply thought out. There's a thread on
>> python-ideas about the inconsiste
On 24 January 2016 at 19:47, Albert-Jan Roskam wrote:
>>
>> You appear to be confusing ordered and sorted.
> You are correct. Is there a difference in the way those terms are used
> colloquially vs. in the field of Computer Science (Note: English is not my
> mother tongue)? Anyway, this page
On 24/01/2016 20:23, Albert-Jan Roskam wrote:
I appear to have confused the terms "sorted" and "ordered" (see the email I just sent to Mark
Lawrence). My OrderedDict was sorted on its keys, because I defined the dict using the result of an SQL query that
ended with ORDER BY . So in that case
> From: oscar.j.benja...@gmail.com
> Date: Thu, 21 Jan 2016 11:02:40 +
> To: ben+pyt...@benfinney.id.au
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
> CC: tutor@python.org
>
> On 21 January 2016 at 09:19, Ben Finney wrote:
> > Albert-Jan Roskam
> To: tutor@python.org
> From: ben+pyt...@benfinney.id.au
> Date: Fri, 22 Jan 2016 04:12:08 +1100
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> Ben Finney writes:
>
> > Oscar Benjamin writes:
> >
> > > According to a narrow defi
> Date: Fri, 22 Jan 2016 11:00:00 +1100
> From: st...@pearwood.info
> To: tutor@python.org
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> Further thoughts on your question...
>
>
> On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Fri, 22 Jan 2016 00:12:18 +
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> On 22/01/16 00:00, Steven D'Aprano wrote:
>
> > Also, you have a problem -- what happens if the inc
> To: tutor@python.org
> From: breamore...@yahoo.co.uk
> Date: Thu, 21 Jan 2016 21:02:03 +
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> On 20/01/2016 13:33, Albert-Jan Roskam wrote:
> > Hi,
> >
> > Like the subject says: Why is an
On 20/01/2016 13:33, Albert-Jan Roskam wrote:
Hi,
Like the subject says: Why is an OrderedDict not sliceable? (From the
collections library). Was that an intentional omission, or a mistake? [1]
Plenty of answers on this all ready, but...
Background: I do not use OrderedDict very often, but
On 22/01/16 00:00, Steven D'Aprano wrote:
> Also, you have a problem -- what happens if the incomplete postcode is
> missing the first digit? (I suppose for that case, you just have to do a
> slow linear search.)
Which is why a different solution may be better suited.
What about an in-memory S
Further thoughts on your question...
On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote:
> Hi,
>
> Like the subject says: Why is an OrderedDict not sliceable? (From the
> collections library). Was that an intentional omission, or a mistake?
> [1]
>
> Background: I do not use Or
Ben Finney writes:
> Oscar Benjamin writes:
>
> > According to a narrow definition of indexed access. I would say that
> > d[k] is index access even if d is a dict and k a key.
The sense of “index” implied is used consistently throughout Python
https://docs.python.org/3/glossary.html> to refer
Oscar Benjamin writes:
> According to a narrow definition of indexed access. I would say that
> d[k] is index access even if d is a dict and k a key.
An index implies the ordinal position in a sequence. In a mapping, the
key is *not* referring to the position in a sequence, so is not a key.
So
On 21 January 2016 at 09:19, Ben Finney wrote:
> Albert-Jan Roskam writes:
>
>> Why is an OrderedDict not sliceable?
>
> Because slicing implies index access. The built-in ‘dict’ and
> ‘collections.OrderedDict’ both do not support indexed access::
According to a narrow definition of indexed acce
Albert-Jan Roskam writes:
> Why is an OrderedDict not sliceable?
Because slicing implies index access. The built-in ‘dict’ and
‘collections.OrderedDict’ both do not support indexed access::
>>> import collections
>>> foo = collections.OrderedDict([
... ('a', 1), ('b', 2), ('
> Date: Thu, 21 Jan 2016 12:00:29 +1100
> From: st...@pearwood.info
> To: tutor@python.org
> Subject: Re: [Tutor] Why is an OrderedDict not sliceable?
>
> On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote:
> > Hi,
> >
> > Like the sub
On Wed, Jan 20, 2016 at 01:33:17PM +, Albert-Jan Roskam wrote:
> Hi,
>
> Like the subject says: Why is an OrderedDict not sliceable? (From the
> collections library). Was that an intentional omission, or a mistake?
> [1]
Because slicing a dict makes no sense. A dict is a mapping, not a
seq
Hi,
Like the subject says: Why is an OrderedDict not sliceable? (From the
collections library). Was that an intentional omission, or a mistake? [1]
Background: I do not use OrderedDict very often, but I thought I could use it
to look up street and city names using postcodes ([0-9]{4} [a-z]{2} f
20 matches
Mail list logo