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

Discussion in 'Python' started by Max Yaffe, Sep 5, 2005.

  1. Max Yaffe

    Max Yaffe Guest

    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.
     
    Max Yaffe, Sep 5, 2005
    #1
    1. Advertising

  2. 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>
     
    Fredrik Lundh, Sep 5, 2005
    #2
    1. Advertising

  3. On Mon, 05 Sep 2005 12:42:39 -0400, Max Yaffe <>
    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}
    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
     
    Dennis Lee Bieber, Sep 6, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    744
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    580
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    419
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    363
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    789
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page