[Python-Dev] Add __exports__ to modules

Greg Stein gstein@lyra.org
Mon, 8 Jan 2001 00:26:03 -0800


On Mon, Jan 08, 2001 at 03:17:59AM -0500, Tim Peters wrote:
> [Greg Stein]
> > Simple question: so what?
> >
> > "Oh, no! My module exposes mod.sys! Oh, woe is me!"  *snort*
> 
> Couldn't care less about the module author.  It's the module user who has to
> sort this stuff out.  "Don't use 'import *'" is good advice but not followed
> either, and after I do
> 
> from MyPackage import sys  # intentionally exports its own sys
> from GregSnort import *    # accidentally exports some other sys
> 
> madness ensues.  Like I said, it's inelegant, and at best.
> 
> Simple question for you:  what would __exports__ hurt?  "Oh, no!  Tim's
> module explicitly lists what it intended to export!  Oh, woe is me!".  Gimme
> a break.

hehe... adding __exports__ to your module is fine. Adding more crud to
Python, in opposition to the "we're all adults" motto, doesn't seem Right.

Somebody wants to use "from foo import *" on a module not designed for it?
Too bad for them. If you're suggesting __exports__ is to patch over problems
caused by "from foo import *", then I think you're barking up the wrong tree
:-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/