random.gauss vs. random.normalvariate

John Haggerty bouncyinc at gmail.com
Sat Aug 15 23:59:09 EDT 2009


On Sat, Aug 15, 2009 at 7:23 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com>wrote:

> On Sat, 15 Aug 2009 14:34:36 -0600, John Haggerty <bouncyinc at gmail.com>
> declaimed the following in gmane.comp.python.general:
>
> > What does the term "thread safe" mean exactly. I never had to program
> with
> > "threads" before
>
>         That, part way through the logic of the function, control could be
> switched to a different thread which call the same function... This
> second call would change some of the internal values and may then be
> preempted and control returned to the first thread, which continues the
> rest of the function with different values then it had when first
> preempted.
>
>        A very contrived example, untested of course, consider it
> pseudo-code...
>
> startt = None
>
> def atimer():
>        global startt
>        startt = time.time()
>        time.sleep(5)
>        print time.time() - startt
>
> t1 = threading.thread(atimer)
> t2 = threading.thread(atimer)
> t1.start()
> t2.start()
>
> Say t1 gets all the way up to the sleep call, and (since sleep is a
> releasing call), t2 then starts. t2 changes the value of startt; and
> sleeps... both sleep and presuming the resolution is fine enough, t1
> resumes, and  prints a delta time that is incorrect -- it is printing
> the time difference from when t2 started to sleep, not from when t1
> started to sleep.
> --
>        Wulfraed         Dennis Lee Bieber               KD6MOG
>        wlfraed at ix.netcom.com   HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Interesting so it seems that the compiler(c/c++)interpreter(perl,
python)/vm(java) doesn't do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090815/4206168a/attachment-0001.html>


More information about the Python-list mailing list