examining an initial, pristine python3 shell session
Robert P. J. Day
rpjday at crashcourse.ca
Wed Jan 20 06:59:19 EST 2010
still working my way through "dive into python 3" and i've already
been asked to give a newbie tutorial on it -- blind leading the blind,
as it were. that should be hilarious.
i'll be using python 3 and it occurred to me that it would be
educational (at least for me :-) to display what an initial p3 shell
session looks like before doing any imports whatsoever. as in, i run
"python3" on my fedora box and, at the ">>>" prompt, i want to show
what's already there for the new user.
from what little i know so far, i'd start with:
>>> __name__
'__main__'
>>>
to display the name of the current scope(?). backing up a bit, i
could run either of:
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__']
>>> globals()
{'__builtins__': <module 'builtins' (built-in)>, '__name__':
'__main__', '__doc__': None, '__package__': None}
>>>
then i might go a bit further to examine some of *those* objects. i
admit it might seem a bit dry, but i think it would be handy to have a
handle on what a clean shell session looks like before starting to
import things, then seeing how that importing changes the session
before getting down to actual programming.
what other useful commands might i run immediately after starting a
session whose output would be informative? i can certainly poke at
some of those objects to see them in more detail. i'm just curious
what others might recommend. thanks.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
More information about the Python-list
mailing list