Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbie: Datetime, "Prog. in Win32", and how Python thinks

Reply
Thread Tools

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

 
 
Max Yaffe
Guest
Posts: n/a
 
      09-05-2005
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.

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      09-05-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>



 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      09-06-2005
On Mon, 05 Sep 2005 12:42:39 -0400, Max Yaffe <(E-Mail Removed)>
declaimed the following in comp.lang.python:

>
> 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...


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

Probably with an error message <G> {look at your spelling}
--
> ================================================== ============ <
> http://www.velocityreviews.com/forums/(E-Mail Removed) | Wulfraed Dennis Lee Bieber KD6MOG <
> (E-Mail Removed) | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Python thinks file is empty loial Python 4 11-06-2007 05:32 AM
PIX520 thinks it's under Land Attack 1 Cisco 3 10-07-2005 01:01 PM
pyGoogle is fun and easy to use, and thinks Python is the best programming language rdsteph@mac.com Python 1 02-24-2005 10:26 PM
7960 thinks it is 7940?? Randy Berdan Cisco 0 08-03-2004 06:07 PM



Advertisments