ssecorp wrote:
In Haskell I can do [1..10] for range(1,11) and ['a'..'z'] for a list
of the alphabet.

Is there a way in Python to generate chars?

How about:

def haskellrange(sc,ec):
    if type(sc) is int:
        for ii in range(sc,ec):
            yield ii
    else:
        for ii in range(ord(sc),ord(ec)+1):
            yield chr(ii)


for jj in haskellrange(1,10): jj

for jj in haskellrange('a','z'): jj


Add salt to taste...

Emile

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to