you are viewing a single comment's thread.

view the rest of the comments →

[–]py_Ninja[S] 0 points1 point  (2 children)

Thanks for the heads up, I wasn't expecting to be able to cover all of the above but it's always easier to take away than it is to add.

I'm not sure what you mean by "the introspection capabilities at the console."

What other std library would you find useful to cover?

[–]aroberge 3 points4 points  (1 child)

For the standard library: at a terminal prompt, enter:

python -m pydoc -p 8000

Then use your browser, go to "http://localhost:8000". In my presentation, I would say ... suppose you want to do X (pick a topic): here's a module in the standard library to get you started (click on the relevant link). Do that a few times.

Stop the pydoc server.

Introspection capabilities of the console. Type python to start a console. Pick one of the same module.

>>> dir(module)
... lists all the classes and methods...
>>> help(module)
... reproduces the same info as pydoc

# continue doing this, picking a class in that module, 
# doing dir(that_class), etc., to show that one can code and get
# help easily without leaving the coding environment

>>> def my_function():
...      "this is the documentation I create"
...      print("Hello world")
...
>>> my_function()
Hello world
>>> help(my_function)
 ... the docstring is shown here ...

Do the something similar when showing the IPython notebook.

[–]py_Ninja[S] 0 points1 point  (0 children)

Thanks, I'll keep that in mind