hiding modules in __init__.py

Chris Rebert clp at rebertia.com
Mon Oct 20 15:35:30 EDT 2008


On Sat, Oct 18, 2008 at 12:03 PM, Brendan Miller <catphive at catphive.net> wrote:
> How would I implement something equivalent to java's package private in
> python?
>
> Say if I have
>
> package/__init__.py
> package/utility_module.py
>
> and utility_module.py is an implementation detail subject to change.
>
> Is there some way to use __init__.py to hide modules that I don't want
> clients to see? Or is the best practice just to name the module you don't
> want clients to use _utility_module and have it private by convention?

Generally the latter on account of Python's "we are all consenting
adults here" philosophy.

Cheers,
Chris
-- 
Follow the path of the Iguana...
http://rebertia.com

>
> Thanks,
> Brendan
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list