Question regarding naming convention
spam.trap at btinternet.com
Tue Jul 1 14:28:02 CEST 2003
Sean Ross wrote:
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:
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 c.l.py 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:
would dynamically import the MyClass class from MyClass.py ?
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