ANN: Pure Python strptime()

Brett C. drifty at
Mon Jun 3 23:54:10 CEST 2002

Out of frustration of not always having strptime() available and not
liking something in the standard library saying something is only
available on "Most modern Unix systems" when it does not have to be
this way, I wrote strptime() in pure Python (requires Python 2.2 or
higher; if there is enough demand I could back-port to older versions
since most of the 2.2 capabilities used were for convenience of
performance issues).

The module can be found at the Python Cookbook at .

I wrote strptime() before (over a year ago), but I got around to
rewriting it finally and removing any dependence on the programmer
knowing any locale-specific info ahead of time.  Now you do not need
to enter any locale-specific information; you can use the function
just like the version that is in the time module.  There is some extra
functionality, though, so look at the recipe to see what extras are
available (performance and locale abilities).

I personally would like to see this included in the standard library
since it is a nice function to have.  How should I go about this? 
Since the time module is a C extension, I realize that this can't just
be pasted into it.  Does this mean that I am going to have to write a
PEP to request that this be added as a module in the standard library?
 Do I just need to convince Guido to include it?  Do I need to push to
change the time module into a Python module with the current module
renamed _time and then just have a stub module to globally import the
_time module?

I have posted this as a patch at SF (patch #474274), but I am
wondering if I have to do anything that I just previously mentioned on
top of this.  Any guidance on this would be helpful.  Thanks.

-Brett C.

More information about the Python-list mailing list