Encapsulation, inheritance and polymorphism

Tim Chase python.list at tim.thechases.com
Thu Jul 19 20:20:28 CEST 2012


> If you think that people can routinely detect infinite loops, then 
> perhaps you would care to tell me whether this is an infinite loop or not:
> 
> i = 1
> while not is_perfect(i):
>     i += 2
> print "odd perfect number discovered"
> 
> 
> where is_perfect() returns True if the integer argument is perfect, and 
> False otherwise.

Sure it terminates...If you don't run out of RAM to represent the
number "i" in question, there's also this "heat death of the
universe" limit I keep hearing about ;-)

-tkc





More information about the Python-list mailing list