[BangPypers] Favorite tips/techniques
Noufal Ibrahim
noufal at nibrahim.net.in
Tue Sep 10 13:24:55 CEST 2013
Saju M <sajuptpm at gmail.com> writes:
> Hi,
> I have couple of doubts
>
>
> * How do you find "json" has module named "tool" ?.
I look at the code/docs.
>
>
> * Why dir(json) not showing "tool" ??
Because of the __all__ variable in the module. http://docs.python.org/2/tutorial/modules.html
>>>> import json
>>>> dir(json)
> ['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__',
> '__doc__', '__file__', '__name__', '__package__', '__path__',
> '__version__', '_default_decoder', '_default_encoder', 'decoder', 'dump',
> 'dumps', 'encoder', 'load', 'loads', 'scanner']
>>>>
>
>
> * How to list all modules of a package in python console ?.
I don't think that's possible. If you import a package, only what the
__init__.py in the package decides to show you is available directly.
> * Is this what you guys are using to check modules of a package ?.
Sort of.
[...]
--
Cordially,
Noufal
http://nibrahim.net.in
More information about the BangPypers
mailing list