Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-17 Thread Steven D'Aprano
On Sun, Mar 18, 2018 at 02:04:43AM +0100, Mikhail V wrote: > So with the TAB separator, just think of replacement TAB->comma, > this should support all Python expressions automatically. > At least seems to me so, but if I am delusional - please correct me. It is still ambiguous: py> eval("10\t-2

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-17 Thread Mikhail V
On Thu, Mar 15, 2018 at 6:15 AM, Steven D'Aprano wrote: > On Thu, Mar 15, 2018 at 01:32:35AM +0100, Mikhail V wrote: > > > Using spaces to separate items has the fatal flaw that it cannot > distinguish > > x - y 0 # two items, the expression `x - y` and the integer 0 > > from: > >x - y 0

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-15 Thread Mikhail V
On Thu, Mar 15, 2018 at 6:15 AM, Steven D'Aprano wrote: > On Thu, Mar 15, 2018 at 01:32:35AM +0100, Mikhail V wrote: > > Using spaces to separate items has the fatal flaw that it cannot > distinguish > > x - y 0 # two items, the expression `x - y` and the integer 0 > > from: > >x - y 0

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-15 Thread Stephan Houben
I'd just do this, which works today: == import numpy import io ar = numpy.loadtxt(io.StringIO(""" 1 5 9 155 53 44 44 34 """)) == Of course, this is only worth the trouble if you are somehow loading a very large matrix. (And then, are you sure you want to

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-14 Thread Steven D'Aprano
On Thu, Mar 15, 2018 at 01:32:35AM +0100, Mikhail V wrote: > Idea is a concept for 2D arrays/lists syntax, which should simplify > some editing boilerplate while working with arrays and improve > readability for bigger arrays. I don't understand; we already have perfectly good syntax for working

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-14 Thread Mikhail V
On Thu, Mar 15, 2018 at 2:10 AM, Terry Reedy wrote: > On 3/14/2018 8:32 PM, Mikhail V wrote: >> >> ... >> >> Also in 1d case one might omit the line continuation \: >> >> L ===* >> "msg1" >> "msg2" >> "error" >> >> returns: >> ["msg1", "msg2", "error"] > > > No, this would return "m

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-14 Thread Terry Reedy
On 3/14/2018 8:32 PM, Mikhail V wrote: Once there was a discussion about alternative list and arrays creation and assignment syntaxes. I think this is one of things with room for ideas and has frequent usage. I've had some ideas for syntax long ago, and now I remembered it because of the recent t

[Python-ideas] Syntax idea for 2D lists\arrays

2018-03-14 Thread Mikhail V
Once there was a discussion about alternative list and arrays creation and assignment syntaxes. I think this is one of things with room for ideas and has frequent usage. I've had some ideas for syntax long ago, and now I remembered it because of the recent topic "Descouraging the implicit string co