Python 'for' loop is memory inefficient

sturlamolden sturlamolden at yahoo.no
Mon Aug 17 00:35:26 CEST 2009


On 16 Aug, 14:57, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:

>         Well, the alternative would be to have two keywords for looping: one
> for your "simple" incrementing integer loop, and another for a loop that
> operates over the elements of some collection type.

A compiler could easily recognise a statement like

   for i in range(n):

as a simple integer loop. In fact, Cython is able to do this.









More information about the Python-list mailing list