On Fri, May 23, 2008 at 12:55 AM, Daniele Varrazzo <[EMAIL PROTECTED]> wrote:
> xrange() restituisce un generatore, un piccolo oggetto che non necessita di
> tenere tutta la lista in memoria. Presenta l'interfaccia adatta per essere
> iterato, fornendo su richiesta i numeri: in questo modo può essere messo in un
> "for". In memoria però mantiene solo il proprio stato, ovvero a che numero è
> arrivato. Questo ovviamente è molto più efficiente della creazione della lista
> completa.


Aggiungo questo che magari può essere utile a chi vuole imparare ad
usare i generatori:
<http://www.dabeaz.com/generators/>

-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a