On Sun, Sep 11, 2011 at 14:44, Travis Vaught <[email protected]> wrote: > > On Sep 11, 2011, at 2:58 AM, Robert Kern wrote: > >> On Sun, Sep 11, 2011 at 00:30, Travis Vaught <[email protected]> wrote: >>> Greetings, >>> >>> Is there a particular reason why a list of lists can't be passed in to >>> create a recarray given a particular dtype? >>> >>> A list of tuples works fine. I keep getting bitten by this and was >>> thinking it should be an easy check/convert for an allowance for a row to >>> be a list _or_ a tuple? >> >> As a rule, tuples are considered "scalar" records and lists are >> recursed upon. This rule helps numpy.array() figure out which >> sequences are records and which are other sequences to be recursed >> upon; i.e. which sequences create another dimension and which are the >> atomic elements. Otherwise, it has to make some guesses and do some >> intelligent backtracking. It's not that intelligent. >> >> -- >> Robert Kern > > Thanks for the explanation. It makes a bit of sense -- at least to answer > the question of what is being traded off here. Looks like simplicity and > performance, perhaps, is being chosen over my convenience.
Mostly unambiguity. numpy.array() has to figure out several interrelated things simultaneously, so there is an identifiability problem. Too many equations, not enough data points; the tuple/list distinction provides an additional data point that helps numpy.array() do what it needs to do. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
