Arithmetic sequences in Python

Paul Rubin http
Tue Jan 17 01:30:08 EST 2006


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> 	What would be expected from
> 	[1, 3, 6 .. 20]
> ???

In Haskell:

    Hugs.Base> [1,3,6..20]
    ERROR - Syntax error in expression (unexpected `..')
    Hugs.Base>

> 	Again, I see [1, 3, 6, 7, 8, 9, 10, ... , 18, 19] 

You'd write that in Haskell as 1:3:[6..19].  In Python I guess
you'd say [1,3]+[6..19].



More information about the Python-list mailing list