[Python-Dev] stackable ints [stupid idea (ignore) :v]

Aaron Watters arw at ifu.net
Fri Jun 11 15:05:17 CEST 1999

From: "Tim Peters" <tim_one at email.msn.com>
>Jumping in to opine that mixing tag/type bits with native pointers is a
>Really Bad Idea.  Put the bits on the low end and word-addressed machines
>are screwed.  Put the bits on the high end and you've made severe
>assumptions about how the platform parcels out address space.  In any case
>you're stuck with ugly macros everywhere.

Agreed.  Never ever mess with pointers.  This mistake has been made over
and over again by each new generation of computer hardware and software
and it's still a mistake.

I thought it would be good to be able to do the following loop with Numeric

    for x in array1:
         array2[x] = array3[x] + array4[x]

without any memory management being involved.  Right now, I think the
for loop has to continually dynamically
allocate each new x and intermediate sum
(and immediate deallocate them) and that makes the loop
piteously slow.  The idea replacing pyobject *'s with a struct [typedescr *, data
was a space/time tradeoff to speed up operations like the above
by eliminating any need for mallocs or other memory management..
I really can't say whether it'd be worth it or not without some sort of
real testing.  Just a thought.

   -- Aaron Watters

More information about the Python-Dev mailing list