On Jul 5, 5:04 pm, Mark Dickinson <dicki...@gmail.com> wrote: > That's shocking. Everyone should be English. :-)
Yes, I'm trying :) > I'd pick one operation (e.g., addition), and trace through the > relevant functions in longobject.c. Look at the long_as_number > table to see where to get started. > > In the case of addition, that table shows that the nb_add slot is > given by long_add. long_add does any necessary type conversions > (CONVERT_BINOP) and then calls either x_sub or x_add to do the real > work. > x_add calls _PyLong_New to allocate space for a new PyLongObject, then > does the usual digit-by-digit-with-carry addition. Finally, it > normalizes > the result (removes any unnecessary zeros) and returns. > > As far as memory allocation goes: almost all operations call > _PyLong_New at some point. (Except in py3k, where it's a bit more > complicated because small integers are cached.) Oh, I didn't see long_as_number before. I'm reading it. That was very helpful, thanks. > If you have more specific questions I'll have a go at answering them. > > Mark Thank you a million. I will write your name in my "Specially thanks to" section of my article (In font size 72) ;) Pedram -- http://mail.python.org/mailman/listinfo/python-list