On Sat, Oct 31, 2009 at 11:43 PM, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote: > On Sat, 31 Oct 2009 22:54:47 -0500, Peng Yu wrote: > >> So python would not be able to accommodate my preference one >> class/function per file? > > Of course it does! You can do that RIGHT NOW -- just put one class per > file. > >> I.e., I have to use something like 'from spam >> import spam' or 'spam.spam()', > > How else do you expect to use the class if you don't import it? > > >> or accept that the filename is not the >> same as the class/function name. > > So let me see... > > You don't want to write "import spam; spam.spam()" > You don't want to write "from spam import spam; spam()" > You don't want to write "from Spam import spam; spam()" > You don't want to write "from spam import Spam; Spam()" > > What exactly do you want?
When I define class spam in file spam.py, I want to call it by import spam spam() If spam.py is in dir/, then I want to call it by import dir.spam dir.spam() -- http://mail.python.org/mailman/listinfo/python-list