Newbie: Datetime, "Prog. in Win32", and how Python thinks
Fredrik Lundh
fredrik at pythonware.com
Mon Sep 5 14:33:30 EDT 2005
Max Yaffe wrote:
> 1) H&R import a module "dates' which has been dropped. They use
> sec2asc which is also m.i.a. I assume that the code should be adapted
> to use module datetime. Is that correct?
the dates.py module is part of the financial modeling toolkit that is described
in chapter 6 of that book. it's not a standard component.
> 2) Is there any list of dead modules & names from previous revs? Is
> there any list of currently recommended modules?
the library reference should tell you if a module is no longer in use.
the various "what's new in python X.Y" documents tell you what's been
added and removed.
> 3) I was able to import datetime & get a dir(datetime) to work.
> Great. But where is the actual code to datetime? I can't find a
> module named datetime.py in the library. I grepped for datetime in
> the library & found plenty of references to it but no module
> definition. Where is it defined?
it's a C library. in recent versions of Python, it's linked to the core
interpreter. in earlier versions, you'll find it in the "datetime" extension
module (datetime.pyd on windows, datetimemodule.so or somesuch
on windows)
>>> import sys
>>> sys.builtin_module_names
> 4) How does the python interpreter resolve the statement "import
> datatime"?
http://effbot.org/zone/import-confusion.htm describes the general approach
for modules written in Python; built-in modules are handled before Python
scans for external modules.
</F>
More information about the Python-list
mailing list