Re: how many nested for can we utilize?

2008-08-18 Thread Patrol Sun
Thanks, I cannot utilize the String Class completely. I'm a newbie for python 2008/8/18 Gabriel Genellina <[EMAIL PROTECTED]> > En Sun, 17 Aug 2008 21:57:46 -0300, Patrol Sun <[EMAIL PROTECTED]> > escribió: > > > Of course We needn't 100 levels,but I use the exec function can concise > the > > co

Re: how many nested for can we utilize?

2008-08-18 Thread Patrol Sun
I test the exec function. As we all know, we can set the recursive levels. How to handle it? 2008/8/17 Fredrik Lundh <[EMAIL PROTECTED]> > Patrol Sun wrote: > > when I use 20 for ,"SystemError: too many statically nested blocks" >> When I use 100 for ,"IndentationError: too many levels of indent

RE: how many nested for can we utilize?

2008-08-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Lie > Sent: Monday, August 18, 2008 11:04 AM > To: python-list@python.org > Subject: Re: how many nested for can we utilize? > > On Aug 17, 4:23 pm, Fredrik Lundh &

Re: how many nested for can we utilize?

2008-08-18 Thread Lie
On Aug 17, 4:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Patrol Sun wrote: > > when I use 20 for ,"SystemError: too many statically nested blocks" > > When I use 100 for ,"IndentationError: too many levels of indentation" > > How to handle these errors? > > so why exactly are you trying to ne

Re: how many nested for can we utilize?

2008-08-18 Thread Gabriel Genellina
En Sun, 17 Aug 2008 21:57:46 -0300, Patrol Sun <[EMAIL PROTECTED]> escribió: > Of course We needn't 100 levels,but I use the exec function can concise the > code. See the attachment. Just a note on the attached code: def isPro52Num(n): s=[] for i in range(1,7): s.

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
I use the exec function. my code's levels are less than 3. BTW,Linus Torvalds is NOT always right. 2008/8/18 Roel Schroeven <[EMAIL PROTECTED]> > Nick Dumas schreef: > >> A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
Yes, I can solve the problem by recursive function. I guess Function Call consume more resources than nested For. So I use the nested For by using exec function. 2008/8/18 Paul Boddie <[EMAIL PROTECTED]> > On 17 Aug, 19:36, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > and functions will solve

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
I found that the recursive function run very slowly 2008/8/18 Paul Boddie <[EMAIL PROTECTED]> > On 17 Aug, 17:17, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > required reading: > > > >"The Effects of Moore's Law and Slacking on Large Computations" > >http://arxiv.org/abs/astro-ph/9912

Re: how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
Of course We needn't 100 levels,but I use the exec function can concise the code. See the attachment. 2008/8/17 Fredrik Lundh <[EMAIL PROTECTED]> > Nick Dumas wrote: > > A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then s

Re: how many nested for can we utilize?

2008-08-17 Thread Roel Schroeven
Nick Dumas schreef: A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Linus Torvalds in the Linux kernel coding style document: "[...] The answer to th

Re: how many nested for can we utilize?

2008-08-17 Thread Paul Boddie
On 17 Aug, 19:36, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > and functions will solve the 40-billion year computation problem exactly > how? I was thinking more about the need to nest "for" statements to a depth of 20 levels, which I imagine only arises on a "just in case" basis for the inquirer

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Paul Boddie wrote: required reading: "The Effects of Moore's Law and Slacking on Large Computations" http://arxiv.org/abs/astro-ph/9912202 Or maybe this...? http://docs.python.org/tut/node6.html#SECTION00660 and functions will solve the 40-billion year computation pro

Re: how many nested for can we utilize?

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 17:17:06 +0200, Fredrik Lundh wrote: >>> it'll take approx 40 billion years to run the program. >> >> I guess that's exactly why the OP asks the question. He just wants >> to start as soon as possible ;-) > > required reading: > >"The Effects of Moore's Law and Slacking on

Re: how many nested for can we utilize?

2008-08-17 Thread Paul Boddie
On 17 Aug, 17:17, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > required reading: > >"The Effects of Moore's Law and Slacking on Large Computations" >http://arxiv.org/abs/astro-ph/9912202 Or maybe this...? http://docs.python.org/tut/node6.html#SECTION00660 And this: http:

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Wojtek Walczak wrote: it'll take approx 40 billion years to run the program. I guess that's exactly why the OP asks the question. He just wants to start as soon as possible ;-) required reading: "The Effects of Moore's Law and Slacking on Large Computations" http://arxiv.org/abs/astro-p

Re: how many nested for can we utilize?

2008-08-17 Thread Wojtek Walczak
On Sun, 17 Aug 2008 16:39:26 +0200, Fredrik Lundh wrote: >> A good quote I read (I can't remember who it was from, though) is "If >> you need more than three levels of indentation, then something is >> seriously wrong with your code." Possibly Guido himself? Anyway. If >> you've got 100 levels of

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Nick Dumas wrote: A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Anyway. If you've got 100 levels of for, you're probably making things way harder tha

Re: how many nested for can we utilize?

2008-08-17 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 A good quote I read (I can't remember who it was from, though) is "If you need more than three levels of indentation, then something is seriously wrong with your code." Possibly Guido himself? Anyway. If you've got 100 levels of for, you're probably ma

Re: how many nested for can we utilize?

2008-08-17 Thread Fredrik Lundh
Patrol Sun wrote: when I use 20 for ,"SystemError: too many statically nested blocks" When I use 100 for ,"IndentationError: too many levels of indentation" How to handle these errors? so why exactly are you trying to nest 20 or 100 for-in loops? -- http://mail.python.org/mailman/listinfo/p

how many nested for can we utilize?

2008-08-17 Thread Patrol Sun
when I use 20 for ,"SystemError: too many statically nested blocks" When I use 100 for ,"IndentationError: too many levels of indentation" How to handle these errors? -- http://mail.python.org/mailman/listinfo/python-list