[Zope3-dev] PyCon DC 2003: Call For Papers

Shane Hathaway shane@zope.com
Thu, 05 Dec 2002 10:57:08 -0500


Barry A. Warsaw wrote:
>>>>>>"SH" == Shane Hathaway <shane@zope.com> writes:
>>>>>
> 
>     SH> I've been trying out a complementary convention in
>     SH> AdaptableStorage: all public classes are available through a
>     SH> special module called "public".
> 
> Nice!

Thanks.

>     
>     SH> ... which are essentially equivalent and easy to translate.
>     SH> But what if you want to import a lot of classes from another
>     SH> Package?  Java:
> 
>     | import jobboard.JobBoard;
>     | import jobboard.HTMLJobBoardRenderer;
>     | import jobboard.XMLRPCJobBoardRenderer;
> 
>     SH> In Python you can shorten this to:
> 
>     | from jobboard.public import JobBoard, HTMLJobBoardRenderer,\
>     |      XMLRPCJobBoardRenderer
> 
> I'll court heresy and say that
> 
> from jobboard.public import *
> 
> isn't that horrible.  Using your convention, you /know/ you won't get
> any names not intended for public consumption, which is one big
> downside of import-*.  It also avoids conflict with Jim's "no
> backslash" law :).

Yes, that is an option.  It corresponds with Java's "import jobboard.*".

I always liked Java's import statement, and when I moved to Python I 
lost its simplicity.  The "public" module restores the nirvana of just 
importing classes from packages.

Shane