save dictionary to a file without brackets.

Chris Angelico rosuav at
Fri Aug 10 01:01:17 CEST 2012

On Fri, Aug 10, 2012 at 8:39 AM, Tim Chase
<python.list at> wrote:
> On 08/09/12 17:26, Dave Angel wrote:
>> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>> I'm glad you're wrong for CPython's dictionaries.  The only time the
>> lookup would degenerate to O[n] would be if the hash table had only one
>> slot.  CPython sensibly increases the hash table size when it becomes
>> too small for efficiency.
>> Where have you seen dictionaries so poorly implemented?
> PHP?

That's the same hash collision attack that I alluded to above, and it
strikes *many* language implementations. Most released a patch fairly
quickly and quietly (Pike, Lua, V8 (JavaScript/ECMAScript), PHP), but
CPython dared not, on account of various applications depending on
hash order (at least for tests). It's not (for once) an indictment of
PHP (maybe that should be an "inarrayment"?), it's a consequence of a
hashing algorithm that favored simplicity over cryptographic

(It feels weird to be defending PHP...)


More information about the Python-list mailing list