Sujet : Re: Lengthy numbers
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 24. Dec 2024, 13:26:26
Autres entêtes
Organisation : Stefan Ram
Message-ID : <list-20241224132559@ram.dialup.fu-berlin.de>
References : 1 2 3 4
Paul Rubin <
no.email@nospam.invalid> wrote or quoted:
ram@zedat.fu-berlin.de (Stefan Ram) writes:
So in theory, this would crank out an infinite list that looks like
[0, 0, 0, 0, ...]. In the real world, though, if you try to print or
use this list, your program will probably freeze up faster than the
405 at rush hour.
The freeze-up happens as soon as you create the list.
I'm stoked you caught that! You hit the nail on the head -
that resource-hogging calculation goes down when the expression's
evaluated. No need to "print or use this list" to see it happen.