data size

Jeff Shannon jeff at ccvcorp.com
Fri Nov 9 19:26:28 EST 2001


harry wrote:

> > He is probably asking you which C library your version of Python was
> > compiled with. But you don't need to know that, either.
> >
> > All Python dictionaries are a standard 2.5 cm by 3.6cm. Integers have no
> > width and are all 1.2 cm in length. Strings are all 2 mm times the number
> of
> > characters, except Unicode strings, which are 4 mm times the number of
> > characters.
>
> could you explain further about the metric standard you're using. this is
> the first time a size of data structure is measured using meters instead of
> byte/bit.
> i need the information for my post-mortem of my assignment to explain why
> using python data structure would be efficient. yes, i'm only a studemt who
> is still need to learn lots of stuffs.
> thanks.

Aha!  We finally have the reason that you need to know the size.  :)  Steve's
metric measurements were (unless I'm seriously mistaken) a sarcastic attempt to
point out that 99.9% of the time, the amount of space taken up by a dict is
totally irrelevant.  And indeed, in your case, it makes *no* difference to the
program, it's only important in justifying it to an outside individual (in this
case, your instructor).  The point that everyone was trying to make is, there
are *very* few instances when it will matter whether a given dict takes up 100
bytes, or 1000 bytes.  In a day when computer memory typically measures in the
hundreds of millions of bytes (and if that runs out, there's always virtual
memory...), a few hundred bytes here and there are insignificant.  The real
efficiency gain in using a python data structure, is that you've got a very
flexible and reliable component that took you all of about 5 minutes to use
(compared with how many hours to code a C++ object that'll do the same?).
Unless you're working in embedded systems and the like, developer time is *far*
more important than memory size or even (in most cases) execution speed.

Jeff Shannon
Technician/Programmer
Credit International






More information about the Python-list mailing list