i come back to python; just some questions

Fredrik Lundh fredrik at pythonware.com
Sun Jul 14 12:27:26 EDT 2002


ppcdev wrote:
> i was working on an old pentium II and wanted to send a very long
> string in the USER parameter but it made my computer bug.. is it
> normal???
>
> str='a'; r=range(1024);
> for x in r[:]:
>     str=str+str
>
> but it even bugs with a value of 512 and 256 for r=range(..)

hint:

len = 1L
for x in range(1024):
    len = len + len
print len

prints

179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814
416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586
298239947245938479716304835356329624224137216

do you have that much memory?

(if you want to create a 1024-character string, use 'a'*1024)

</F>





More information about the Python-list mailing list