generating a liste of characters

Duncan Booth duncan.booth at invalid.invalid
Fri Dec 5 09:22:30 EST 2008


"Mark Tolonen" <metolone+gmane at gmail.com> wrote:

><bearophileHUGS at lycos.com> wrote in message 
> news:df7b75eb-97bf-4538-880b-f65b5ed992ff at u14g2000yqg.googlegroups.com.
> .. 
>>In Python ranges are open on the right, so I name cinterval such
>>function.
> 
> Yes, and that's fine when dealing with integers and slicing, but when 
> dealing with characters, it is non-obvious what character to use. 
> What "looks" correct?
> 
>    chars = crange('0','9') + crange('A','Z') + crange('a','z') #
>    inclusive 
> 

I think bearophile's point was that you had the parameters correct, 
(specifying 'a' and 'z' makes sense), but the function itself had the wrong 
name. If you call it 'crange' you are implying the wrong behaviour. Call it 
something like 'cinterval' instead.

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list