[Python-ideas] FW: Idea: Compressing the stack on the fly

Westley Martínez anikom15 at gmail.com
Thu Sep 12 06:12:43 CEST 2013



-----Original Message-----
From: Westley Martínez [mailto:anikom15 at gmail.com] 
Sent: Wednesday, September 11, 2013 9:03 PM
To: 'Ram Rachum'; 'python-ideas at googlegroups.com'
Cc: 'Ram Rachum'
Subject: RE: [Python-ideas] Idea: Compressing the stack on the fly

> -----Original Message-----
> From: Python-ideas [mailto:python-ideas-
> bounces+anikom15=gmail.com at python.org] On Behalf Of Ram Rachum
> Sent: Sunday, May 26, 2013 5:00 AM
> To: python-ideas at googlegroups.com
> Cc: Ram Rachum
> Subject: [Python-ideas] Idea: Compressing the stack on the fly
> 
> So what I'm suggesting is an algorithm to compress that stack on the
> fly. An algorithm that would detect regularities in the stack and
> instead of saving each individual frame, save just the pattern. Then,
> there wouldn't be any problem with showing informative stack trace:
> Despite not storing every individual frame, each individual frame
> could still be accessed, similarly to how `xrange` allow access to
> each individual member without having to store each of them.
> 
> 
> Then, the stack could store a lot more items, and tasks that currently
> require recursion (like pickling using the standard library) will be
> able to handle much deeper recursions.
> 
> 
> What do you think?

I think this is an interesting idea.  It sounds possible, but the
question is whether or not it can be efficiently done with Python.

I'd heed Guido's advice in first implementing this.  It could probably
be done effectively with a compiled language like C, but I'd imagine
it'd be too difficult for Python.

The other question is usability.  What would this actually be used for.
I'm not a fan of recursion.  I think anything that uses recursion could
be restructured into something simpler.  A lot of people find recursion
to be elegant.  For me it just hurts my brain.




More information about the Python-ideas mailing list