Newbie: Datetime, "Prog. in Win32", and how Python thinks

M

Max Yaffe

Dear Group,

First of all, thanks for all the postings about Datetime. They've
helped alot.

I'm a newbie to Python (albeit very experienced in programming C & OO)
and trying to use "Programming in Win32" by Hammond & Robinson [H&R]
to learn it. This may be a mistake since I think it refers to Python
1.5.2 while I'm trying to use Python 2.4.x. Anyway...

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?

2) Is there any list of dead modules & names from previous revs? Is
there any list of currently recommended modules?

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?

4) How does the python interpreter resolve the statement "import
datatime"?

Thanks,
Max


Code don't lie. Manuals Lie. I'm highly suspicious of browsers.
 
F

Fredrik Lundh

Max said:
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)
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>
 
D

Dennis Lee Bieber

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?
Looking at a search for "datetime", it is a .pyd file -- that's a
Python specific DLL (on Windows, at least). Hence, it is compiled C
language stuff... This is reinforced by finding a datetime.h file
floating around too...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top