[Zope] Anything like a for loop in DTML?

Martijn Pieters mj@antraciet.nl
Tue, 13 Apr 1999 09:42:02 +0200


At 03:40 13/04/99 , The Dragon De Monsyne wrote:
>On Mon, 12 Apr 1999, Bill Randle wrote:
>
>> Phil,
>> 
>> I asked this same question awhile back. The answer is to use an External
>> Method. The Python equivalent is the "range" operator, but "range" is not
>> included in Zope due to possible problems with runaway memory usage if a
>> really big number was used. [In the example below you'll see that a max
>> limit is set. If it were a standard feature, where would one set the upper
>> limit?]
>> 
>
>	Erm,  isn't this what xrange() is for??
>Zope _really_ should have xrange available. (don't know if it does)
>
>	-The Dragon De Monsyne

With xrange you can still create a loop that will run on for practically
ever. Remember that Python long integers are only limited by memory.

A limit to it's length is still needed. I already posted an implementation
to this list that accepts the same arguments as the builtin function
range(), and checks on excessively long ranges:

	http://www.zope.org/pipermail/zope/1999-March/005234.html


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------