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


Groups > comp.lang.python > #8784 > unrolled thread

Testing if a global is defined in a module

Started byTim Johnson <tim@johnsons-web.com>
First post2011-07-04 10:11 -0800
Last post2011-07-05 15:43 +0000
Articles 2 on this page of 22 — 8 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#8839

FromTim Johnson <tim@johnsons-web.com>
Date2011-07-05 07:30 -0800
Message-ID<mailman.637.1309879699.1164.python-list@python.org>
In reply to#8802
* Ian Kelly <ian.g.kelly@gmail.com> [110704 20:37]:
> 
> It sounds like what you really want is to detect the names *exported*
> by the module, then.  i
  Yes! 
> 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.

  :) Oh here we go again. Another python feature I didn't know about
  or have forgotten.

  Thanks very much for that.
  Good tip
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

[toc] | [prev] | [next] | [standalone]


#8841

FromGrant Edwards <invalid@invalid.invalid>
Date2011-07-05 15:43 +0000
Message-ID<iuvbe6$gst$1@reader1.panix.com>
In reply to#8839
On 2011-07-05, Tim Johnson <tim@johnsons-web.com> wrote:
> * Ian Kelly <ian.g.kelly@gmail.com> [110704 20:37]:
>> 
>> It sounds like what you really want is to detect the names *exported*
>> by the module, then.  i
>   Yes! 
>> 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.
>
>  :) Oh here we go again. Another python feature I didn't know about
>   or have forgotten.

You could probably implement at least two more languages using nothing
but Python features I don't know about or have forgotten.  :)

Yet I still manage to get a lot accomplished using Python.

-- 
Grant Edwards               grant.b.edwards        Yow! I don't know WHY I
                                  at               said that ... I think it
                              gmail.com            came from the FILLINGS in
                                                   my rear molars ...

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web