[Tutor] New to list & first steps in Python

Lance E Sloan lsloan-000002 at umich.edu
Fri Jun 4 07:37:17 EDT 2004


--On Thursday, June 3, 2004 11:57 AM -0700 Danny Yoo 
<dyoo at hkn.eecs.berkeley.edu> wrote:
> This looks fine.  You may want to avoid using the 'from foo import *'
> statement.  I agree that explicitely pulling out the 'choice' function is
> better:
>
> ###
> from random import choice
> ###

What I've been doing lately in cases like this is:

  import random
  x = random.choice( y )

What do you other experienced Pythonistas think of that style?

I admit that I don't like the length it adds to my lines of code, but I do 
like that it's clear and easy to see which module each function came from.

--
Lance E Sloan, Systems Research Programmer III
U-M WATS: Web Applications, Technologies, and Solutions
Full-service web and database design, development, and hosting.
http://www.itcs.umich.edu/wats/ - "Putting U on the Web"




More information about the Tutor mailing list