Algorithms in Python, #n+1

2012-05-16 Thread Antti J Ylikoski
I have continued my research in literature algorithms in Python. The algorithms in Knuth's volumes 1 -- 3 either have been incorporated into Python, or they can be easily implemented with Python. Quite as John Nagle said here. However, the Fascicles in Vol. 4 to my opinion contain nontriv

Algorithms in Python, cont'd

2012-05-03 Thread Antti J Ylikoski
I wrote here about some straightforward ways to program D. E. Knuth in Python, and John Nagle answered that the value of Knuth's book series to the programmer has been significantly diminished by the fact that many functionalities such as sorting and hashing have either been built in the Python la

Re: Algorithms in Python

2012-01-26 Thread Chetan Harjani
On Thu, Jan 26, 2012 at 2:22 AM, Martin Schöön wrote: > On 2012-01-25, Chetan Harjani wrote: >> Thanks Alec for the link. U know I wanted to read this book by Simon >> Singh -> The Code Book, I hear its good. >> > It indeed is. I only remember one error, an error every Scandinavian > would have s

Re: Algorithms in Python

2012-01-25 Thread Martin Schöön
On 2012-01-25, Chetan Harjani wrote: > Thanks Alec for the link. U know I wanted to read this book by Simon > Singh -> The Code Book, I hear its good. > It indeed is. I only remember one error, an error every Scandinavian would have spotted. His book on Fermat's theorem is even better. /Martin -

Re: Algorithms in Python

2012-01-25 Thread Chetan Harjani
Thanks Alec for the link. U know I wanted to read this book by Simon Singh -> The Code Book, I hear its good. Thanks Nizamov for the link, I am really looking forward to join the class, and since its free, it is totally an asset. Yes Thijs I have seen this book, and since its such a big book, I a

Re: Algorithms in Python

2012-01-25 Thread Visgean Skeloru
There is this book (it´s free ebook) http://www.brpreiss.com/books/opus7/html/book.html , you can also check this list: http://programming-motherfucker.com/become.html#Python or if you want something more official then there is official wiki page: http://wiki.python.org/moin/PythonBooks ... 2012/1

Re: Algorithms in Python

2012-01-25 Thread Thijs Engels
I assume you have seen this book? http://www.apress.com/9781430232377 Thijs On Wed, Jan 25, 2012, at 15:36, Chetan Harjani wrote: > Is there any book or site on python algorithms which asks more and > teaches less, I don't want to get bored, and at the same time I want > to learn and act more. I

Re: Algorithms in Python

2012-01-25 Thread Nizamov Shawkat
2012/1/25 Chetan Harjani : > Is there any book or site on python algorithms which asks more and > teaches less, I don't want to get bored, and at the same time I want > to learn and act more. I use ubuntu. (just in case if its needed). > #ALGORITHMS There is a Stanford online class on Algorithms,

Re: Algorithms in Python

2012-01-25 Thread Alec Taylor
The thing about algorithms is they are applicable to many programming languages (in general). Read http://en.wikipedia.org/wiki/Turing_machine On Wed, Jan 25, 2012 at 9:06 PM, Chetan Harjani wrote: > Is there any book or site on python algorithms which asks more and > teaches less, I don't want

Algorithms in Python

2012-01-25 Thread Chetan Harjani
Is there any book or site on python algorithms which asks more and teaches less, I don't want to get bored, and at the same time I want to learn and act more. I use ubuntu. (just in case if its needed). #ALGORITHMS -- Chetan H Harjani IIT Delhi -- http://mail.python.org/mailman/listinfo/python-

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-07-06 Thread Zac Burns
I'm not an expert on this, but wouldn't it be more dependent on the platform than python version? Perhaps it is Windows 7 that is very slow. Perhaps my processor architecture. Not sure... Here are some for 3.1.2x64 >>> import timeit >>> timeit.timeit('Lock()', 'from threading import Lock') 1.4162

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-07-02 Thread Antoine Pitrou
On Mon, 28 Jun 2010 16:46:41 -0700 Zac Burns wrote: > In my experience it is far more expensive to allocate a lock in python then > it is the types that use them. Here are some examples: > > >>> timeit.timeit('Lock()', 'from threading import Lock') > 1.4449114807669048 > > >>> timeit.timeit('dic

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
On 29 Jun, 05:11, Ryan Kelly wrote: > Very interesting idea.  Will it work if accessed through ctypes? > >    ticker = ctypes.c_int.in_dll(ctypes.pythonapi,"_Py_Ticker") >    ticker.value = 0x7fff > > Or does ctypes muck with the GIL in a way that would break this idea? > >>> ctypes.pythonap

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 19:45 -0700, sturlamolden wrote: > > > Many lockless algorithms that I have looked at thusfar require a > > > "Compare and Swap" operation. Does python have an equivalent to this? > > > Is python high level enough that it has something better than this or > > > it simply doesn

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
> > Many lockless algorithms that I have looked at thusfar require a > > "Compare and Swap" operation. Does python have an equivalent to this? > > Is python high level enough that it has something better than this or > > it simply doesn't need it? Python does have a GIL, and contrary to the title

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread sturlamolden
> > Many lockless algorithms that I have looked at thusfar require a > > "Compare and Swap" operation. Does python have an equivalent to this? > > Is python high level enough that it has something better than this or > > it simply doesn't need it? Python does have a GIL, and contrary to the title

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 18:27 -0700, Zac Burns wrote: > > > > I've managed to avoid locking in some cases by using > dict.setdefault() as a kind of atomic test-and-set operation. > It's not a full compare-and-swap but you could implement a > simple locking sch

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Zac Burns
> > Sure, but I think you're timing the wrong thing here. You would only > allocate the lock relatively rarely - it's the overhead of *acquiring* > the lock that's the real problem. > > r...@durian:~$ python -m timeit -s "from threading import Lock; l = > Lock()" "l.acquire(); l.release()" > 1

Re: Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Ryan Kelly
On Mon, 2010-06-28 at 16:46 -0700, Zac Burns wrote: > In my experience it is far more expensive to allocate a lock in python > then it is the types that use them. Here are some examples: > > >>> timeit.timeit('Lock()', 'from threading import Lock') > 1.4449114807669048 > > >>> timeit.timeit('dict

Lockless algorithms in python (Nothing to do with GIL)

2010-06-28 Thread Zac Burns
In my experience it is far more expensive to allocate a lock in python then it is the types that use them. Here are some examples: >>> timeit.timeit('Lock()', 'from threading import Lock') 1.4449114807669048 >>> timeit.timeit('dict()') 0.2821554294221187 >>> timeit.timeit('list()') 0.17358153222

Re: genetic algorithms in Python?

2009-04-08 Thread Esmail
Terry Reedy wrote: Esmail wrote: Hello, Anyone using Python for coding up genetic algorithms? If so, would you share your favorite modules/libraries/tools? Search 'Python genetic algorithm' on Google or elsewhere. Hi Terry, I did that first, and I came up with a number of hits. The "proble

Re: genetic algorithms in Python??

2009-04-08 Thread Esmail
R. David Murray wrote: Esmail wrote: Hello Mohammed, Yes, that would great. While I am comfortable with GAs, I'm still rather inexperienced with Python so seeing some implementation examples would be very useful. A google for 'python genetic algorithms' turns up a number of interesting hits.

Re: genetic algorithms in Python?

2009-04-08 Thread Terry Reedy
Esmail wrote: Hello, Anyone using Python for coding up genetic algorithms? If so, would you share your favorite modules/libraries/tools? Search 'Python genetic algorithm' on Google or elsewhere. -- http://mail.python.org/mailman/listinfo/python-list

Re: genetic algorithms in Python??

2009-04-08 Thread R. David Murray
Esmail wrote: > Hello Mohammed, > > Yes, that would great. While I am comfortable with GAs, > I'm still rather inexperienced with Python so seeing some > implementation examples would be very useful. A google for 'python genetic algorithms' turns up a number of interesting hits. I also remember

Re: genetic algorithms in Python??

2009-04-08 Thread Esmail
Hello Mohammed, Yes, that would great. While I am comfortable with GAs, I'm still rather inexperienced with Python so seeing some implementation examples would be very useful. Thanks, Esmail -- Date: Wed, 8 Apr 2009 17:08:48 +0200 Subject: Re: genetic algorithms in Python? From: me

Re: genetic algorithms in Python?

2009-04-08 Thread Mohammed Mediani
I have done something in this direction. I will be happy to share my experience. However, my code is not generic and needs many things to be manually introduced. My GA is standard (selection by roulette wheel or tournament, single point cross). Let me know if you are interested! On Wed, Apr 8, 200

genetic algorithms in Python?

2009-04-08 Thread Esmail
Hello, Anyone using Python for coding up genetic algorithms? If so, would you share your favorite modules/libraries/tools? Thanks, Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: Optimal Control Algorithms in Python

2006-01-11 Thread [EMAIL PROTECTED]
Not exactly but I am aware of Python code for nonlinear optimization algorithms. Check the nlpy project at http://nlpy.sf.net It is specifically targeted at finite-dimensional problems. However the current trend in optimal control algorithms is to use grid-refinement and iteratively solve finite-di

Optimal Control Algorithms in Python

2006-01-11 Thread aprasad21k
Is anyone aware of Python code for Optimal Control Algorithms based on Pontryagin's Maximum Principle? Thanks in advance for any leads on this. -- http://mail.python.org/mailman/listinfo/python-list