<div dir="ltr"><div dir="ltr"><div>By the way, your reply isn't go to the list --bringing it back on.</div><div dir="ltr"><br></div><div dir="ltr">On Sat, Apr 6, 2019 at 5:03 AM Juancarlo Añez <<a href="mailto:apalala@gmail.com">apalala@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto">Or maybe there is one in PyPi — have you looked? </div></div></blockquote><div><br></div><div>There's a bunch of "matrix" packages in PyPi, none of them dealing with the simple use cases I'm talking about.</div></div></div></div></blockquote><div><br></div><div>Be careful about terminology -- "matrix" is a term from mathematics (linear algebra) that has a specific meaning -- I don't think that's what you mean. If it is what you mean, then what you want is numpy (though it fact, numpy is not a matrix system -- it is general purpose n-dimensional arrays designed for numerical computation that includes some features to support  linear algebra ).</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div>It could be static methods in `list`?</div><div><br></div><div>x = list.matrix(n, m, default=0.0)</div><div>y = list.matrix(n, m, o, p, default=False)</div><div>i = list.eye(n, False, True) </div></div></div></div></blockquote><div><br></div><div>If all you want are constructors for common 2-d or n-d arrays that would create lists of lists, then make a handful of utility functions, put them on PyPi, and see if anyone finds them useful -- if so, then offer it up as an addition the standard list object.</div><div><br></div><div>But for my part, I think simple constructors are of limited utility -- sure, it's an easy source of errors to do it "wrong", e.g.:</div><div><br></div><div>[[None] * 5] * 6 appears to create a 2 dimensional array, but really has all the rows as references to the same object. But users will discover this pretty quickly, and there is something to be said for folks needing to understand how python works with regard to multiple references to the same mutable object.</div><div><br></div><div>But what might be more useful is a 2D or ND array class that would provide more than just constructors, but would provide nifty things like 2-dimension indexing:</div><div><br></div><div>arr = NdArray((3,4), fill=None)</div><div><br></div><div>arr:</div><div><br></div><div>[[None, None, None, None],</div><div> [None, None, None, None],</div><div> [None, None, None, None]]<br></div><div><br></div><div>and nifty things like 2-d indexing:</div><div><br></div><div>arr[:, 2] to get columns, for instance.</div><div><br></div><div>Also some controls on resizing -- you really don't want folks able to append arbitrarily to  any of this.</div><div><br></div><div>THAT might gain some traction.</div><div><br></div><div>(or not, as you get this with numpy, and so much more, anyway.</div><div><br></div><div>But either way, write it and show its utility first.</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div></div>-- <br><div dir="ltr" class="gmail_signature">Christopher Barker, PhD<br><br> Python Language Consulting<br>  - Teaching<br>  - Scientific Software Development<br>  - Desktop GUI and Web Development<br>  - wxPython, numpy, scipy, Cython<br></div></div></div>