from a module return a class

John Gordon gordon at panix.com
Fri Mar 18 12:16:03 EDT 2016


In <mailman.332.1458315013.12893.python-list at python.org> Wolfgang Maier <wolfgang.maier at biologie.uni-freiburg.de> writes:

> > So promptUser_PWord is a module?  Well, I'm confused.  You gave us this
> > bit of code:
> >
> >      user_pword = promptUser_PWord()
> >
> > But that can't work if promptUser_PWord is a module; modules aren't
> > callable.  promptUser_PWord() has to be a function or a class.
> >

> Yes, but I guess the OP's program will run into the SyntaxError when 
> trying to import the module, i.e., before it ever encounters the 
> TypeError: 'module' object is not callable.

Good point; I hadn't thought of that.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list