Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 5:20 PM, Tim Daneliuk wrote: On 12/23/19 7:52 PM, DL Neil wrote: WebRef: https://docs.python.org/3/reference/lexical_analysis.html Yep, that explains it, but it still feels non-regular to me. From a pointy headed academic POV, I'd like to see behavior consistent across types. A

Re: Lists And Missing Commas

2019-12-23 Thread Frank Millman
On 2019-12-24 6:20 AM, Tim Daneliuk wrote: On 12/23/19 7:52 PM, DL Neil wrote: WebRef: https://docs.python.org/3/reference/lexical_analysis.html Yep, that explains it, but it still feels non-regular to me. From a pointy headed academic POV, I'd like to see behavior consistent across types.

Re: Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
On 12/23/19 8:35 PM, Chris Angelico wrote: > On Tue, Dec 24, 2019 at 12:56 PM DL Neil via Python-list > wrote: >> However, your point involves the fact that whereas: >> >> 1 + 2 # 3 is *clearly* addition, and >> "a" + "b" # "ab" is *clearly* concatenation >> >> "a" "b" # al

Re: Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
On 12/23/19 7:52 PM, DL Neil wrote: > > WebRef: https://docs.python.org/3/reference/lexical_analysis.html Yep, that explains it, but it still feels non-regular to me. From a pointy headed academic POV, I'd like to see behavior consistent across types. Again ... what do I know? -- https://mai

Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 3:35 PM, Chris Angelico wrote: On Tue, Dec 24, 2019 at 12:56 PM DL Neil via Python-list wrote: However, your point involves the fact that whereas: 1 + 2 # 3 is *clearly* addition, and "a" + "b" # "ab" is *clearly* concatenation "a" "b" # also evaluates to "

Re: Lists And Missing Commas

2019-12-23 Thread Chris Angelico
On Tue, Dec 24, 2019 at 12:56 PM DL Neil via Python-list wrote: > However, your point involves the fact that whereas: > > 1 + 2 # 3 is *clearly* addition, and > "a" + "b" # "ab" is *clearly* concatenation > > "a" "b" # also evaluates to "ab" > > and is thus, concatenation w

RE: Most elegant way to do something N times

2019-12-23 Thread Avi Gross via Python-list
What others have answered is tangential. Nobody doubts there are places where you want to repeat something N times. Just to add an example, if you are parsing something nested by parentheses or perhaps HTML, and you reach a point where you have seen N opening symbols and start seeing a closing symb

Re: Lists And Missing Commas

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 1:48 PM, Tim Daneliuk wrote: If I do this: foo = [ "bar", "baz" "slop", "crud" ] Python silently accepts that and makes the middle term "bazslop". BUT, if I do this: foo = [ "bar", "baz" 1, "crud" ] or this: foo = [ "bar", 2 1, "crud" ] The interpreter throws a s

RE: Most elegant way to do something N times

2019-12-23 Thread Avi Gross via Python-list
I would like some examples of how one does what is requested in some other programming languages. I doubt there is much need of a shorter way to do anything N times and throw away any return values. Python has many ways to do just about anything. It has some features which suggest a particular way

Re: Lists And Missing Commas

2019-12-23 Thread Aaron Gray
On Tuesday, 24 December 2019, Tim Daneliuk wrote: > If I do this: > > foo = [ "bar", "baz" "slop", "crud" ] > > Python silently accepts that and makes the middle term "bazslop". Strings concatinate over line endings so this case is only sensible really. > > BUT, if I do this: > > foo

Lists And Missing Commas

2019-12-23 Thread Tim Daneliuk
If I do this: foo = [ "bar", "baz" "slop", "crud" ] Python silently accepts that and makes the middle term "bazslop". BUT, if I do this: foo = [ "bar", "baz" 1, "crud" ] or this: foo = [ "bar", 2 1, "crud" ] The interpreter throws a syntax error. This is more of an intellectual

Re: Most elegant way to do something N times

2019-12-23 Thread Chris Angelico
On Tue, Dec 24, 2019 at 11:34 AM DL Neil via Python-list wrote: > > On 24/12/19 1:04 PM, Chris Angelico wrote: > > File parsing. You read a section header and want to ignore that > > section, so you ignore the next 15 lines. > > (just to be cheeky to @Chris) > > Perhaps better as a Finite State Ma

Re: Most elegant way to do something N times

2019-12-23 Thread DL Neil via Python-list
On 24/12/19 1:04 PM, Chris Angelico wrote: On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla wrote: I encounter with cases like doing a function 6 time with no argument, or same arguments over and over or doing some structral thing N times and I dont know how elegant I can express that to the cod

Re: Most elegant way to do something N times

2019-12-23 Thread Morten W. Petersen
It depends on what's elegant, and beauty is in the eye of the beholder.. def recurse(n): print(”do be do be do”) if n>0: recurse(n-1) Regards, Morten søn. 22. des. 2019, 21:37 skrev Batuhan Taskaya : > I encounter with cases like doing a function 6 time with no argument, or > same argument

Re: Most elegant way to do something N times

2019-12-23 Thread Chris Angelico
On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla wrote: > > > > > I encounter with cases like doing a function 6 time with no argument, or > > same arguments over and over or doing some structral thing N times and I > > dont know how elegant I can express that to the code. > > > > ??? Excuse me, but w

Re: Most elegant way to do something N times

2019-12-23 Thread Marco Sulla
> > I encounter with cases like doing a function 6 time with no argument, or > same arguments over and over or doing some structral thing N times and I > dont know how elegant I can express that to the code. > ??? Excuse me, but why you needed to call the same function SIX times? This seems to me

Re: Transfer a file to httpserver via POST command from curl

2019-12-23 Thread Chris Angelico
On Tue, Dec 24, 2019 at 2:44 AM Peter J. Holzer wrote: > > On 2019-12-23 04:24:22 +1100, Chris Angelico wrote: > > On Mon, Dec 23, 2019 at 4:20 AM wrote: > > > On Wed, 18 Dec 2019 04:52:33 +1100 > > > Chris Angelico wrote: > > > > > > > On Wed, Dec 18, 2019 at 4:45 AM wrote: > > > > > BTW, the

Re: Transfer a file to httpserver via POST command from curl

2019-12-23 Thread Peter J. Holzer
On 2019-12-23 04:24:22 +1100, Chris Angelico wrote: > On Mon, Dec 23, 2019 at 4:20 AM wrote: > > On Wed, 18 Dec 2019 04:52:33 +1100 > > Chris Angelico wrote: > > > > > On Wed, Dec 18, 2019 at 4:45 AM wrote: > > > > BTW, the canonical way to upload files via http is PUT, not POST. > > > > You mig