Range of characters?

Jeff Shannon jeff at ccvcorp.com
Thu Dec 27 19:16:00 CET 2001


Chris Dutton wrote:

> in article 3C2A074D.8214E5E0 at earthlink.net, Mari Mcdade at
> wurmy at earthlink.net wrote on 12/26/01 12:27 PM:
>
> > You don't need the string module, really, but using the literal
> > string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" seemed a bit ugly. ;-)
>
> Well, this is even less ugly then.
>
> from string import uppercase as u
> for c in u:
>     print "%sython" % c

I disagree that this is less ugly--it needlessly obfuscates the code,
since at the for-loop, it's totally opaque as to what it is that
you're iterating over.  I *much* prefer having it read the very
explicit 'string.uppercase' to having it only cryptically refer to
'u'.

Jeff Shannon
Technician/Programmer
Credit International






More information about the Python-list mailing list