[pypy-dev] IRC log: is list.append a RPython op?

Seo Sanghyeon tinuviel at sparcs.kaist.ac.kr
Thu Oct 16 15:04:22 CEST 2003


I asked Armin whether list.append is a RPython op, and had
a brief chat on the topic. Armin expressed his opinion, and
agreed to post IRC log to this list.

Any comment?
-------------- next part --------------
#pypy log

<sanxiyn> Am I correct in that translators are supposed to translate StdObjSpace?
<arigo> yes
<arigo> but not multimethod.py if that's what you are afraid of :-)
<sanxiyn> I started mapping list.append to vector-push-extend, etc, and realized
that it should be done by translating listobject.list_append__List_ANY.
<sanxiyn> (is my understanding correct?)
<arigo> no
<sanxiyn> Eh, you mean, "if it does the same thing, using host-functionality is fine"?
<sanxiyn> (eh, of course, it must be fine...?)
<arigo> the RPython operations should be translated directly as you did
<arigo> the list_append__List_ANY functions operate at another level
<sanxiyn> Then I ask, is list.append RPython op?
<arigo> ok, this one hasn't received a definitive answer yet
<sanxiyn> If it is RPython op, then _ins1, _list_resize, etc in listobject just
doesn't make sense at all.
<arigo> i think we should have "list + list" but not list.append
<arigo> in fact, for Lisp i think we should not use vectors with that extra "current
size" field
<arigo> i mean, arrays but not fill poitners
<sanxiyn> Adjustable array, but not vector-push?
<arigo> in other words only "simple arrays" in the Lisp sense, which are more or less
just C arrays
<sanxiyn> Ah, understood.
<arigo> yes, adjustable would be nice for list.extend or list +=
<arigo> the idea is that we want to avoid the complex logic that would be needed in C
to support efficient appends
<sanxiyn> So... make-array for malloc(), adjust-array for realloc(), etc?
<arigo> exactly
<sanxiyn> So list.append is apparently not a RPython op.
<arigo> so far i'd say it is not, though it may be implemented stupidly as list += [item]


More information about the Pypy-dev mailing list