Question regarding naming convention

michael spam.trap at
Tue Jul 1 14:28:02 CEST 2003

Sean Ross wrote:

<snip quote>

Yeah, thanks for the quote. Unfortunately, this still leaves me with 
syntax that's a bit unfriendly. Taking the StringIO class as an example, 
I can either write:

     import StringIO
     s = StringIO.StringIO()


     from StringIO import StringIO
     s = StringIO()

Both of the above seem to overcomplicate the syntax. Of the two, I 
prefer the second, but I'm sure I've read on that the 
from..import.. version is not a preferred way of doing things.

Is there no way to write a class, such that the statement:

     import MyClass

would dynamically import the MyClass class from ?

It just surprises me that there isn't a neater way around this, as 
Python seems to encapsulate most everything else in a simple way.



More information about the Python-list mailing list