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


Groups > comp.lang.python > #8811

Re: Testing if a global is defined in a module

References (2 earlier) <mailman.606.1309811314.1164.python-list@python.org> <4e124916$0$29970$c3e8da3$5496439d@news.astraweb.com> <mailman.611.1309821881.1164.python-list@python.org> <4e124db1$0$29973$c3e8da3$5496439d@news.astraweb.com> <20110705000131.GN1971@johnsons-web.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-07-04 22:28 -0600
Subject Re: Testing if a global is defined in a module
Newsgroups comp.lang.python
Message-ID <mailman.619.1309840154.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jul 4, 2011 at 6:01 PM, Tim Johnson <tim@johnsons-web.com> wrote:
>> Yes, but what are you actually *trying to do*? "Detecting data members" is
>> not an end in itself. Why do you think you need to detect data members?
>
>  Steven, I'm building a documentation system. I have my own MVC framework
>  and the goal is to have a documentation module for each project.

It sounds like what you really want is to detect the names *exported*
by the module, then.  Why not do it the same way Python does it?  If
the module defines an "__all__" attribute, then it is taken to be a
sequence of strings which are the exported names.  Otherwise, the
exported names are taken to be all the names in the module dict that
don't begin with an underscore.

Cheers,
Ian

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


Thread

Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 10:11 -0800
  Re: Testing if a global is defined in a module rantingrick <rantingrick@gmail.com> - 2011-07-04 12:40 -0700
    Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 12:30 -0800
      Re: Testing if a global is defined in a module rantingrick <rantingrick@gmail.com> - 2011-07-04 14:30 -0700
        Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 13:59 -0800
      Re: Testing if a global is defined in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-05 09:13 +1000
        Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 15:26 -0800
          Re: Testing if a global is defined in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-05 09:33 +1000
            Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 16:01 -0800
            Re: Testing if a global is defined in a module Chris Angelico <rosuav@gmail.com> - 2011-07-05 10:08 +1000
              Re: Testing if a global is defined in a module Grant Edwards <invalid@invalid.invalid> - 2011-07-05 14:11 +0000
                Re: Testing if a global is defined in a module "Waldek M." <wm@localhost.localdomain> - 2011-07-05 18:35 +0200
                Re: Testing if a global is defined in a module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-06 03:36 +1000
                Re: Testing if a global is defined in a module Chris Angelico <rosuav@gmail.com> - 2011-07-06 08:45 +1000
                Re: Testing if a global is defined in a module "Waldek M." <wm@localhost.localdomain> - 2011-07-06 08:00 +0200
                Re: Testing if a global is defined in a module Grant Edwards <invalid@invalid.invalid> - 2011-07-07 14:18 +0000
                Re: Testing if a global is defined in a module Chris Rebert <clp2@rebertia.com> - 2011-07-07 17:36 -0700
                Re: Testing if a global is defined in a module Grant Edwards <invalid@invalid.invalid> - 2011-07-05 22:39 +0000
            Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-04 18:01 -0800
            Re: Testing if a global is defined in a module Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-04 22:28 -0600
            Re: Testing if a global is defined in a module Tim Johnson <tim@johnsons-web.com> - 2011-07-05 07:30 -0800
              Re: Testing if a global is defined in a module Grant Edwards <invalid@invalid.invalid> - 2011-07-05 15:43 +0000

csiph-web