[Zope] convert #var sequence-item to integer?

Tim Potter Tim.Potter@anu.edu.au
Tue, 10 Aug 1999 20:28:15 +1000 (EST)


Andreas Kostyrka writes:

> > The error I get is "sequence index must be an integer".  Zope doesn't
> > seem to be converting the sequence-item variable into an integer
>
> Where are you coming from, that you expect a language to convert a string
> to an integer automatically? *wonder*
>
> Try:
> _.string.atoi(i)

Are you serious?  There isn't a smiley so I guess so.  

I think my Perl mindset may be what is confusing here.  The following
two statements bits of perl produce the same result: 43.

$ perl -e 'print(42 + 1)'
$ perl -e 'print("42" + "1")'

Perl automatically converts between strings and integers as the need
arises so in my mind, trying to index an array with a string makes
perfect sense to a Perl programmer.  Since DTML expressions are Python
based and [quickly checks through my copy of Learning Python] Python
seems to have a stricter typing system than Perl.

I'm sure people who speak Python as a second language (-: may be
similarly confused.


Regards,

Tim.

> 
> Andreas
> --
> Andreas Kostyrka                     | andreas@mtg.co.at
> phone: +43/1/7070750                 | phone: +43/676/4091256   
> MTG Handelsges.m.b.H.                | fax:   +43/1/7065299
> Raiffeisenstr. 16/9                  | 2320 Zwoelfaxing AUSTRIA        
> 

-- 
Tim Potter, System Admin/Programmer              "Disco Stu doesn't advertise"
Advanced Computational Systems CRC, RSISE Bldg Australian National University,
Canberra 0200, AUSTRALIA Ph: +61 2 62798813 Fax: +61 2 62798602