On 28/08/2010 14:41, Peter Otten wrote:
BTW, I didn't expect it but I get different results on different
runs.
Clever code. I will give it a go soonest. Elec off for the next 24 hours
in my neck of the woods. Urgh. Python can't "import electricity" just yet :)
\d
--
http://mail.python.org/mail
donn wrote:
> On 28/08/2010 12:03, Peter Otten wrote:
>> But be warned that if you set the limit too high instead of giving you a
>> RuntimeError your program will segfault.
> Silly question: is there any way to tell the future in this case? I
> mean, ask for X recursion limit, and catch an error
On 28/08/2010 12:03, Peter Otten wrote:
But be warned that if you set the limit too high instead of giving you a
RuntimeError your program will segfault.
Silly question: is there any way to tell the future in this case? I
mean, ask for X recursion limit, and catch an error (or something) if
tha
On 28/08/2010 11:17, Carl Banks wrote:
It's simple. Copy the object to flatten onto your stack. Pop one item
off the stack. If the item you popped is a list, push each item of
that list onto the stack. Otherwise yield the value. Loop until stack
is empty.
Nice. The reversed thing was throwing me,
On Aug 28, 3:03 am, Peter Otten <__pete...@web.de> wrote:
> donn wrote:
> > On 28/08/2010 08:43, Peter Otten wrote:
> >> If you call functions within functions (or methods, it doesn't matter)
> >> they consume stack space
>
> > Right, got it. Darn, but at least there's that setrecursionlimit call.
donn wrote:
> On 28/08/2010 08:43, Peter Otten wrote:
>> If you call functions within functions (or methods, it doesn't matter)
>> they consume stack space
>
> Right, got it. Darn, but at least there's that setrecursionlimit call.
But be warned that if you set the limit too high instead of givin
On Aug 27, 8:21 pm, donn wrote:
> Each Tag has a flatwalk() method. The return from that is a list which
> can be deeply nested. As an example, something like this:
> L=[1, [2, 3, [4, [5, 6], 7], 8], [9, 10] ]
>
> (The numbers in the example would actually be Tag Instances.)
>
> Aim 1
> ---
> I'm
On 28/08/2010 09:21, Arnaud Delobelle wrote:
This flattens the list in the flatwalk method (which IMHO it should
do given its name!):
Heh, I often name things ahead of my actual capacity to implement them!
el is child.flatwalk():
Ah, I see what you mean. I think 'is' is 'in', but I kind of g
On 28/08/2010 08:43, Peter Otten wrote:
If you call functions within functions (or methods, it doesn't matter) they
consume stack space
Right, got it. Darn, but at least there's that setrecursionlimit call.
Thanks,
\e
--
http://mail.python.org/mailman/listinfo/python-list
donn writes:
> This is all about walking trees, recursion and generators. None of
> which fit my brain at all!
>
> From an XML tree (an SVG file) I build a bunch of Tag objects.
>
> [I use lxml, but I am combining multiple svg files into a 'forest' of
> trees, so I can't use the lxml walking meth
donn wrote:
> * If an Instance calls a method on another Instance of the same
> class, is this still recursion? And how does this 'stack up'? I mean,
> literally, on the stack. Does each instance get its own stack, or does
> all the push, call, pop stuff happen in one main stack?
> (I worry about
11 matches
Mail list logo