Message138161
Hi Nick: Thanks for your additional points. Comments inline:
> __all__ only affects import *, and may also affect documentation tools (e.g. pydoc will respect __all__ when deciding what to display). It has no effect on attribute retrieval from modules.
That's indeed my understanding. So the doc (6. Simple statements) which says that __all__ determines the list of "public names" is a bit of a red herring. Attributes are accessible (ie: public) regardless of whether on the __all__ list. Instead the __all__ list establishes the list of names imported by *, and makes those names reference-able without a module prefix. (Plus gives hints about intent to doc tools.)
> pkgutil.extend_path() is used to modify pkg.__path__ attributes, *not* sys.path.
Understood, and perhaps my point was obtuse. I was pointing out that the doc for extend_path discusses .pkg entries which point to package dirs, and that this, it says, is like .pth files. I claim that an entry in a .pth files should NOT point to a package dir, but rather to one level up: to a dir that *contains* package dirs. (Pointing a .pth entry directly at a package dir will break package behavior by exposing the constituent modules to sys.path.) Hence the doc for extend_path is misleadingly suggesting a wrong idea about .pth files. |
|
Date |
User |
Action |
Args |
2011-06-11 15:32:37 | gwideman | set | recipients:
+ gwideman, brett.cannon, pje, ncoghlan, eric.araujo, docs@python, Greg.Slodkowicz |
2011-06-11 15:32:36 | gwideman | set | messageid: <1307806356.98.0.910923288986.issue11553@psf.upfronthosting.co.za> |
2011-06-11 15:32:36 | gwideman | link | issue11553 messages |
2011-06-11 15:32:35 | gwideman | create | |
|