How to get time.strptime()?

Chris Angelico rosuav at
Thu Dec 27 06:41:36 CET 2012

On Thu, Dec 27, 2012 at 4:06 PM, Mitya Sirenef <msirenef at> wrote:
> On 12/26/2012 10:09 PM, Gnarlodious wrote:
>> This is problem that has unduly vexed me. When you start learning Python
>> they don't tell you about these sharp edges. Someone needs to explain. --
>> Gnarlie
> In fact, if there were no bugs, there would be no need to explain nor to
> pick the
> right time / place for explanations. Why doesn't Python warn that it's not
> 100% perfect? Are people just supposed to "know" this, magically?

People are supposed to know that Python is not 100% perfect because
there's no such thing as a 100% perfect language. The problem here is
that Python doesn't have any magical way to deal with messy imports in
multiple threads; the solution is to sort out the import before the
multiple threads get going (meaning that when each thread attempts the
import, it's resolved trivially by simply binding the existing module
to a new name).

Threads are fairly messy in the best of times. The only thing I could
imagine Python doing here would be a brutal global lock - as soon as
one thread starts any import, all other threads get locked out of
execution (or at least of other imports). And I'm not sure that'd
solve everything - plus it brings the risk that one thread can stall
the entire system with a failed or faulty import. If you can think of
of any way to improve this, I'm sure python-ideas will happily discuss


More information about the Python-list mailing list