Python for philosophers

88888 Dihedral dihedral88888 at googlemail.com
Sat May 18 22:30:43 EDT 2013


Chris Angelico於 2013年5月19日星期日UTC+8上午8時04分45秒寫道:
> On Sun, May 19, 2013 at 9:56 AM, 88888 Dihedral
> 
> <dihedral88888 at googlemail.com> wrote:
> 
> > Hey, ChisA, are you delibrately to write a recursive version
> 
> > to demonstrate the stack depth problem in Python?
> 
> >
> 
> > def fact(n):
> 
> >    ret=1
> 
> >    if n>1: # integer checking is not used but can be added
> 
> >       for x in xrange(n): ret*=x
> 
> >    #print ret # debugging only for long integers
> 
> >    return ret
> 
> >
> 
> >
> 
> >
> 
> > In a 32 or 64 bit system, this non-recursive verssion
> 
> > will be limited by the heap space not by the stack limit.
> 
> 
> 
> And just when we're sure Dihedral's a bot, a post like this comes through.
> 
> 
> 
> Dihedral, are you intelligent? I'm still in two minds about this...
> 
> which may be why you so often appear to have no minds. I dunno.
> 
> Mathematics somewhere I fancy.
> 
> 
> 
> ChrisA

I am too lazy to write a factorial computations with primes
here.



More information about the Python-list mailing list