Re: Looking for info on Python's memory allocation

2005-10-10 Thread R Toop
http://mail.python.org/pipermail/python-list/2003-December/198141.html

wherein Tim gently corrects my brash guess that Python lists are
pointer-linked.
The example's linearly-constructed list is allocated by doubling storage,
copying & freeing (cf realloc).
The result that the process virtual memory is twice the size of the list,
more or less, with the freed predecessor chunks on the process heap, but not
released to the operating system.
This only SEEMS to use as much memory as pointer-linked elements would do.
Hope this URL helps.

-Bob


"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can somebody help me please? I've spent a fruitless
> hour googling with no luck.
>
> I'm discussing memory allocation techniques with
> somebody, and I'm trying to find a quote from -- I
> think -- Tim Peters where he discusses the way Python
> allocates memory when you append to lists. In basic
> terms, he says that every time you try to append to a
> list that is already full, Python doubles the size of
> the list. This wastes no more than 50% of the memory
> needed for that list, but has various advantages -- and
> I'm damned if I can remember exactly what those
> advantages were.
>
> Can anyone point me in the right direction?
>
> Thanks,
>
>
> -- 
> Steven.
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Debugger Confusion

2005-07-16 Thread R Toop
By now, you have probably found an IDE that gives you satisfactory
debugging.
I think your original problem was trying to use an emacs shell (M-x shell)
to run Python interpreter.
But the emacs Python mode works a whole better than Python in a dumb
terminal.

Have you tried the following?
-- open Python source file in emacs
-- expect to see that the buffer is in Python mode, so when you select it,
"Python" appears on the modeline and the emacs menu bar, and describe-mode
gives mucho info.
-- from the emacs Python menu (or Xemacs right click to get Python popup),
select "Start interpreter", or just  C-c !  keys.
-- again from Python source buffer, selectPython "Execute buffer" or C-c C-c
keys.
-- if the source has pdb.set_trace() as previous post suggested, the
interpreter buffer will stop there, and in fact pdb.py will appear in
another emacs buffer.
-- in the interpreter, type n Enter
--now you'll see the desired pointer in a temp copy of your Python source or
whatever imported Python library you find yourself.

With emacs/Python syntax highlighting (M-x font-lock-fontify-buffer), it's
not bad.
The one true editor is always worth the effort :)
HTH.

"Rex Eastbourne" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> One thing: is it possible to go through the code within emacs? Doing it
> on the command line is useful, but it would be very helpful if I could
> have a little marker within the emacs buffer that showed me where I am.
>
> Rex
>

-- 
http://mail.python.org/mailman/listinfo/python-list