Avoiding local variable declarations?

Paul McGuire ptmcg at austin.rr.com
Fri Nov 14 22:09:58 CET 2008

On Nov 14, 12:08 pm, Mark Wooding <m... at distorted.org.uk> wrote:
> Chris Mellon <arka... at gmail.com> wrote:
> > Any time you port between languages, it's rarely a good idea to just
> > convert code verbatim. For example:
> > import random, string
> > def random_char():
> >     return random.choice(string.ascii_letters + string.digits)
> Note that this code doesn't preserve the output distribution of the
> original, for which once expects half the characters to be numeric.  I
> don't know if that's relevant; in fact I suspect that the original was
> buggy.
> -- [mdw]

I couldn't have said it better myself.  Well, if not better, at least

-- Paul

More information about the Python-list mailing list