python - Unable to tally help file with source (example: os module) -
i learning how read python docs , less reliant on internet examples. not easy, try.
in python cli,
import os
when help(os), following output returned
classes builtins.exception(builtins.baseexception) builtins.oserror builtins.object nt.direntry builtins.tuple(builtins.object) nt.times_result nt.uname_result stat_result statvfs_result terminal_size class direntry(builtins.object) | methods defined here:
i cannot find class direntry in os.py source file. can enlighten me why help(os) returns direntry
if print representation of os.direntry, , can see in help, object nt.direntry (because on windows system):
>>> import os >>> os.direntry <class 'nt.direntry'> >>> os.direntry.__module__ 'nt' >>> help(os.direntry) on class direntry in module nt: class direntry(builtins.object) ... >>> import nt >>> nt.direntry os.direntry true the place direntry imported nt in os module here:
elif 'nt' in _names: name = 'nt' linesep = '\r\n' nt import * the from nt import * imports (mostly) nt module, direntry added os module.
Comments
Post a Comment