On Feb 8, 3:28 pm, Chris Rebert <c...@rebertia.com> wrote: > This I disagree with as being unnecessarily clever; the dict literal > is just fine as-is and the zip() makes it less clear. However, I would > definitely rewrite the dict to use less lines, which, after removing > the capital dupes (as I mentioned in my post, just use .lower()), > looks like: > > LEET_LETTERS = {"e" : "3", "a" : "4", "i" : "1", "t" : "7", "s" : "5", > "o" : "0", "b" : "8"} >
Maybe so, I was trying to illustrate zip() and maybe this was getting too far ahead for a new Python user. I *do* find that when initializing a list of characters (and for some reason a string wont do), then instead of this: vowels = ["A", "E", "I", "O", "U"] using the list constructor is much easier: vowels = list("AEIOU") Or more non-deterministically, sometimes = lambda s : [s] if random.random() > 0.5 else [] vowels = list("AEIOU") + sometimes("Y") -- Paul -- http://mail.python.org/mailman/listinfo/python-list