On 03/05/2010 12:45 PM, Steven D'Aprano wrote:
> E.g. a trie needs six pointers just to represent the single
> key "python":
>
> '' -> 'p' -> 'y' -> 't' -> 'h' -> 'o' -> 'n'
>
> while a hash table uses just one:
>
> -> 'python'
You can argue that had trie beed used as the datatype, there will
spir wrote:
On Thu, 04 Mar 2010 09:22:52 -0500
Dave Angel wrote:
Still, slots are important, because I suspect
that's how built-ins are structured, to make the objects so small.
Sure, one cannot alter their structure. Not even of a direct instance of
:
o = object()
o.n=1
On Thu, 4 Mar 2010 06:47:04 pm spir wrote:
> Hello,
>
> In python like in most languages, I guess, objects (at least
> composite ones -- I don't know about ints, for instance -- someone
> knows?) are internally represented as associative arrays.
No.
You can consider a Python object to be someth
On Fri, 5 Mar 2010 01:22:52 am Dave Angel wrote:
> spir wrote:
[...]
> > PS: Would someone point me to typical hash funcs for string keys,
> > and the one used in python?
>
> http://effbot.org/zone/python-hash.htm
But note that this was written a few years ago, and so may have been
changed.
As f
spir wrote:
Hello,
In python like in most languages, I guess, objects (at least composite ones --
I don't know about ints, for instance -- someone knows?) are internally
represented as associative arrays. Python associative arrays are dicts, which
in turn are implemented as hash tables. Corre
"spir" wrote
Does this mean that the associative arrays representing objects are
implemented like python dicts, thus hash tables?
Yes, in fact I think they are Python dicts - although I've never actually
looked at the source to confirm that.
I was wondering about the question because I gue