P.S. Re: Python newbie needs constructive suggestions

2006-07-24 Thread David G. Wonnacott
In response to my question, ``What is the idiomatically appropriate Python way to pass, as a "function-type parameter", code that is most clearly written with a local variable?'', a number of you made very helpful suggestions, including the use of a default argument; if one wanted to give a name to

Re: Python-list Digest, Vol 34, Issue 373

2006-07-24 Thread David G. Wonnacott
Subject: Re: random shuffles To: python-list@python.org Ross Ridge wrote: > David G. Wonnacott wrote: > > Couldn't we easily get an n*log(n) shuffle... > > Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle > algorithim is well known

Re: random shuffles

2006-07-22 Thread David G. Wonnacott
From: "danielx" <[EMAIL PROTECTED]> Date: 22 Jul 2006 01:43:30 -0700 Boris Borcic wrote: > does > > x.sort(cmp = lambda x,y : cmp(random.random(),0.5)) > > pick a random shuffle of x with uniform distribution ? ... Let e be the element which was in the first position t

Re: Python newbie needs constructive suggestions

2006-07-22 Thread David G. Wonnacott
Many thanks to those of you who responded to my question about anonymous functions with local variables, filling me in on e) do something else clever and Pythonic that I don't know about yet? by pointing out that I can use (among other good things) lambda with default arguments. That should sui