From: Alan G I. <ai...@am...> - 2006-06-02 17:34:15
|
On Fri, 02 Jun 2006, Sven Schreiber apparently wrote:=20 > why doesn't rand accept a shape tuple as argument? I find=20 > the difference between the argument types of rand and (for=20 > example) zeros somewhat confusing. ... Can anybody offer=20 > an intuition/explanation?=20 Backward compatability, I believe. You are not alone in=20 finding this odd and inconsistent. I am hoping for a change=20 by 1.0, but I am not very hopeful. Robert always points out that if you want the consistent=20 interface, you can always import functions from the 'random'=20 module. I have never been able to understand this as=20 a response to the point you are making. I take it the core argument goes something like this: - rand and randn are convenience functions * if you do not find them convenient, don't use them - they are in wide use, so it is too late to change them - testing the first argument to see whether it is a tuple or=20 an int so aesthetically objectionable that its ugliness=20 outweighs the benefits users might get from access to=20 a more consistent interface This is one place where I believe a forward looking (i.e.,=20 think about new users) vision would force a small change in=20 these *convenience* functions that will have payoffs both in=20 ease of use and in eliminating this recurrent question from=20 discussion lists. Cheers, Alan Isaac |