Infinitely nested containers

Chris Angelico rosuav at gmail.com
Sat Nov 22 06:09:57 CET 2014


On Sat, Nov 22, 2014 at 4:02 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> Thats not a single expression; which is possible with a lazy
> evaluation language like Haskell.
> Prelude> let ones = 1 : ones

I'm not sure "lazy evaluation" is the key here, unless it also does
name lookups lazily. What happens if you do this:

let foo = 1 : bar
let bar = 2 : 3
foo

Will that show 1, 2, 3? If so, then sure, lazy eval is what achieved
that - but it's also going to make it hard to track down name errors.

ChrisA



More information about the Python-list mailing list