bearophileh...@lycos.com wrote:
I have missed another example: It may be possible to create a sorting
routine that's not stable but is faster than the current stable
timsort (for example in C++ STL you have both sorting routines, and
the unstable one is a variant of introsort that is faster
On 05Feb2009 01:47, bearophileh...@lycos.com bearophileh...@lycos.com wrote:
| [...] But even if the average performance becomes a
| little worse I think making the default Python dict as ordered is a
| positive change for Python too, because built-ins are meant to be as
| flexible as possible,
Cameron Simpson wrote:
On 05Feb2009 01:47, bearophileh...@lycos.com bearophileh...@lycos.com wrote:
| [...] But even if the average performance becomes a
| little worse I think making the default Python dict as ordered is a
| positive change for Python too, because built-ins are meant to be as
|
Cameron Simpson:
increases the unrealised assumptions about mappings in general which a newbie
may acquire, causing them pain/complaint later with other mappings
This is wrong in several different ways.
I would much rather keep dictionaries as performant as possible, as a
bare mapping, and
bearophile:
In Python 3 strings are all unicode, integral numbers are all
multiprecision, chars in Python 2.x+ are strings, lists are arrays
that can grow dynamically, and so on because the Purpose of Python
isn't to be as fast as possible, but to be first of all flexible,
safe, easy, not
bearophileh...@lycos.com wrote:
Cameron Simpson:
increases the unrealised assumptions about mappings in general
which a newbie may acquire, causing them pain/complaint later with
other mappings
This is wrong in several different ways.
I would much rather keep dictionaries as performant as
bearophileh...@lycos.com wrote:
[a somewhat feeble case for ordered dicts]
Once the default dicts are ordered, it can be possible to add an
unordereddict to the collections module to be used by programmers when
max performance or low memory usage is very important :-)
I have no real idea why
Steve Holden st...@holdenweb.com writes:
In mathematics mappings aren't ordered either, and a pure dict is pretty
much a mapping. So leave them alone, they are fine as they are!
Ehhh, an ordered dict has to support a comparison operation on the
keys, while a Python dict has to support a hashing
Paul Rubin http://phr...@nospam.invalid wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in
Duncan Booth duncan.bo...@invalid.invalid writes:
If you want to write doctests then any stable order in the default dict
type would be helpful no matter whether it means that keys are in original
insertion or latest insertion order or sorted.
Just use sorted in the test code:
print
Paul Rubin http://phr...@nospam.invalid wrote:
Duncan Booth duncan.bo...@invalid.invalid writes:
If you want to write doctests then any stable order in the default
dict type would be helpful no matter whether it means that keys are
in original insertion or latest insertion order or sorted.
so what is happening with pep 372?
http://www.python.org/dev/peps/pep-0372/
--
http://mail.python.org/mailman/listinfo/python-list
andrew cooke schrieb:
so what is happening with pep 372?
http://www.python.org/dev/peps/pep-0372/
It's still a draft and hasn't been implemented yet. Now is the time to
get it ready for Python 3.1 and 2.7.
Christian
--
http://mail.python.org/mailman/listinfo/python-list
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you inserted them
in. That is if you
That page about Ruby dicts show a higher traversal speed (probably
just because the CPU has to scan less memory, but I am not sure,
because mordern CPUs are very complex) but lower insertion speed (I
think mostly not because the added management of two pointers, but
because the memory used
Now, I also do recognize the utility of ordered dictionaries in some cases,
but
exactly what you mean by ordered varies. I have two cases where ordered
has the keys are in a specific custom order. I have four cases where ordered
means maintaining insertion order. For the former I do
Paul Rubin wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you inserted them
MRAB wrote:
Paul Rubin wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you
Stephen Hansen wrote:
Ooh, as an addendum... I found one case where I want insertion-and-update
order: meaning that its an ordered dictionary that maintains insertion
order, but
an update to a particular item moves that item to the back so an update behaves
like del d[key]; d[key] = value in
Bryan Olson:
A few bits fuzzy. Is the following True or False if dict is insert-ordered?
dict(a=6, b=7) == dict(b=7, a=6)
In my odict implementation I have disallowed that syntax because if
you want to define a mydict(**kwds) function that allows a syntax
like:
mydict(a=6, b=7)
it takes a
bearophileh...@lycos.com wrote:
Bryan Olson:
A few bits fuzzy. Is the following True or False if dict is insert-ordered?
dict(a=6, b=7) == dict(b=7, a=6)
In my odict implementation I have disallowed that syntax because if
you want to define a mydict(**kwds) function that allows a syntax
Paul Rubin wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you inserted them
andrew cooke wrote:
so what is happening with pep 372?
http://www.python.org/dev/peps/pep-0372/
There seems to be a number of unanswered questions as to the exact
behavior (see Q and A section). The author needs to promote more
discussion by those interested, including here, and make a
23 matches
Mail list logo