[Edu-sig] Top 5 All Time Novice Obstacles => #2 Helping help
Arthur
ajs@ix.netcom.com
Fri, 20 Sep 2002 01:42:09 -0400
Title: ['Tough Love, or 'Are we paying attention yet?']
---Scenario: Socratic Genie {SG} is holding forth---
1. >>> import os
You rang,master
2. >>> os
SG:
Yo, my name is,my name is,my name
<module 'os' from 'C:\PYTHON22\lib\os.pyc'>
3. >>> dir(os)
['F_OK', 'O_APPEND', 'O_BINARY', 'O_CREAT', 'O_EXCL', 'O_RDONLY', 'O_RDWR',
'O_TEXT', 'O_TRUNC', 'O_WRONLY', 'P_DETACH', 'P_NOWAIT', 'P_NOWAITO',
'P_OVERLAY', 'P_WAIT', 'R_OK', 'TMP_MAX', 'UserDict', 'W_OK', 'X_OK',
'_Environ', '__all__', '__builtins__', '__doc__', '__file__', '__name__',
'_copy_reg', '_execvpe', '_exists', '_exit', '_get_exports_list',
'_make_stat_result', '_make_statvfs_result', '_notfound',
'_pickle_stat_result',
'_pickle_statvfs_result', 'abort', 'access', 'altsep', 'chdir', 'chmod',
'close', 'curdir', 'defpath', 'dup', 'dup2', 'environ', 'error', 'execl',
'execle', 'execlp', 'execlpe', 'execv', 'execve', 'execvp', 'execvpe',
'extsep',
'fdopen', 'fstat', 'getcwd', 'getenv', 'getpid', 'i', 'isatty', 'linesep',
'listdir', 'lseek', 'lstat', 'makedirs', 'mkdir', 'name', 'open', 'pardir',
'path', 'pathsep', 'pipe', 'popen', 'popen2', 'popen3', 'popen4', 'putenv',
'read', 'remove', 'removedirs', 'rename', 'renames', 'rmdir', 'sep',
'spawnl',
'spawnle', 'spawnv', 'spawnve', 'startfile', 'stat', 'stat_result',
'statvfs_result', 'strerror', 'sys', 'system', 'tempnam', 'times',
'tmpfile',
'tmpnam', 'umask', 'unlink', 'unsetenv', 'utime', 'write']
SG:
You're desire?
4. >>> os.lstat
SG:
Yo, my name is,my name is,my name
<built-in function lstat>
5. >>> os.lstat()
SG:
Happy to lstat for you. Lstat what?
6. >>> ? os.lstat()
SyntaxError: invalid syntax
SG:
Not even close. Why not try "ertjke;" for that matter?
7. >>> help
SG:
How hard did I make that?
>Type help() for interactive help, or help(object) for help about object.
Now you know what help is. Do you wish me to perform it? ["()", "perform" -
anything getting through yet?]
8. >>> help(os.lstat())
Traceback (most recent call last):
File "<pyshell#24>", line 1, in ?
help(os.lstat())
TypeError: lstat() takes exactly 1 argument (0 given)
Come on. help(object) was the incantation I suggested. Does ()
make an object a wish or a wish an object?
9. >>> help(os.lstat)
SG:
Are we learning something?
Help on built-in function lstat:
lstat(...)
lstat(path) -> (st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid,
st_size, st_atime, st_mtime, st_ctime)
Like stat(path), but do not follow symbolic links.
10. >>> os.lstat()__doc__
SyntaxError: invalid syntax
SG:
Now, do you *really* think a () belongs there? [patience, patience]
11. >>> os.lstat.__doc__
SG:
Had a problem with help(os.lstat)? And you were expecting maybe?
12. >>> print os.lstat.__doc__
SG:
Hey buddy you looking to lstat or are we just playing games here?
SG QUESTION
Have you enjoyed our session on the meaning of ()?
Oh yeah .. and something about lstat came up to, didn't it?