Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105236

Re: from a module return a class

Newsgroups comp.lang.python
Date 2016-03-18 12:19 -0700
References <b4647f72-bf8a-4adb-ba1d-bd7d684ba350@googlegroups.com> <cc439011-f9b3-4837-ba3b-6703f99ae9be@googlegroups.com> <nch5lm$gva$1@reader1.panix.com> <mailman.332.1458315013.12893.python-list@python.org> <nch9k3$qqn$1@reader1.panix.com>
Message-ID <0302a065-ba45-4eaa-ab76-d3d319219479@googlegroups.com> (permalink)
Subject Re: from a module return a class
From kevind0718@gmail.com

Show all headers | View raw


On Friday, March 18, 2016 at 12:16:13 PM UTC-4, John Gordon wrote:
> In <mailman.332.1458315013.12893.python-list@python.org> Wolfgang Maier <wolfgang.maier@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@panix.com              B is for Basil, assaulted by bears
>                                 -- Edward Gorey, "The Gashlycrumb Tinies"

true I get the following:  
  File "H:\dev\eclipse\workspace\genXls\src\genXls\genXlswPrompt.py", line 11, in <module>
    import promptUser_PWord
  File "H:\dev\eclipse\workspace\genXls\src\genXls\promptUser_PWord.py", line 58
    return user_pword
SyntaxError: 'return' outside function

so what I get from the various postings is promptUser_PWord must be
converted to a class.  True?

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

from a module return a class kevind0718@gmail.com - 2016-03-17 09:19 -0700
  Re: from a module return a class Laurent Pointal <laurent.pointal@free.fr> - 2016-03-17 18:16 +0100
  Re: from a module return a class John Gordon <gordon@panix.com> - 2016-03-17 17:21 +0000
    Re: from a module return a class Laurent Pointal <laurent.pointal@free.fr> - 2016-03-17 18:43 +0100
      Re: from a module return a class John Gordon <gordon@panix.com> - 2016-03-17 17:54 +0000
        Re: from a module return a class Laurent Pointal <laurent.pointal@free.fr> - 2016-03-17 19:24 +0100
          Re: from a module return a class Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-17 13:56 -0700
          Re: from a module return a class Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-17 13:59 -0700
            Re: from a module return a class kevind0718@gmail.com - 2016-03-18 05:40 -0700
    Re: from a module return a class kevind0718@gmail.com - 2016-03-18 05:34 -0700
  Re: from a module return a class kevind0718@gmail.com - 2016-03-18 05:32 -0700
    Re: from a module return a class John Gordon <gordon@panix.com> - 2016-03-18 15:08 +0000
      Re: from a module return a class John Gordon <gordon@panix.com> - 2016-03-18 16:16 +0000
        Re: from a module return a class kevind0718@gmail.com - 2016-03-18 12:19 -0700

csiph-web