[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Greg Ewing
Rhodri James wrote: scanf (or rather sscanf) always looks like a brilliant idea right up until I come to use it, at which point I almost always do something else that gives me better control. My experience is similar, but that's largely because error detection and reporting with the C version

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 9:41 AM Andrew Barnert wrote: > > On Jun 28, 2019, at 16:10, Chris Angelico wrote: > > > > The %s marker would accept everything up to the next literal text. So > > if you say "%s@%s", it would read up to the at sign. The second part > > of the proposal would be doing

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Andrew Barnert via Python-ideas
On Jun 28, 2019, at 16:10, Chris Angelico wrote: > > The %s marker would accept everything up to the next literal text. So > if you say "%s@%s", it would read up to the at sign. The second part > of the proposal would be doing that, though; the "%s" handler would > simply accept everything and

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 9:02 AM Andrew Barnert wrote: > > On Jun 28, 2019, at 12:09, Chris Angelico wrote: > > > > 1) For all the different types of object that can be read (integer, > > string, JSON blob, etc), have a function that will read one, stop when > > it's done, and report both the

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Andrew Barnert via Python-ideas
On Jun 28, 2019, at 12:09, Chris Angelico wrote: > > 1) For all the different types of object that can be read (integer, > string, JSON blob, etc), have a function that will read one, stop when > it's done, and report both the parsed object and the point where it > stopped parsing. For a

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Ned Batchelder
On 6/27/19 1:58 PM, James Lu wrote: On Jun 26, 2019, at 7:13 PM, Chris Angelico wrote: The main advantage of sscanf over a regular expression is that it performs a single left-to-right pass over the format string and the target string simultaneously, with no backtracking. (This is also its

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Chris Angelico
On Sat, Jun 29, 2019 at 3:24 AM Anders Hovmöller wrote: > > > > > On 28 Jun 2019, at 19:01, Rhodri James wrote: > > > > On 27/06/2019 18:58, James Lu wrote: > >>> On Jun 26, 2019, at 7:13 PM, Chris Angelico wrote: > >>> > >>> The main advantage of sscanf over a regular expression is that it >

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Anders Hovmöller
> On 28 Jun 2019, at 19:01, Rhodri James wrote: > > On 27/06/2019 18:58, James Lu wrote: >>> On Jun 26, 2019, at 7:13 PM, Chris Angelico wrote: >>> >>> The main advantage of sscanf over a regular expression is that it >>> performs a single left-to-right pass over the format string and the

[Python-ideas] Re: something like sscanf for Python

2019-06-28 Thread Rhodri James
On 27/06/2019 18:58, James Lu wrote: On Jun 26, 2019, at 7:13 PM, Chris Angelico wrote: The main advantage of sscanf over a regular expression is that it performs a single left-to-right pass over the format string and the target string simultaneously, with no backtracking. (This is also its

[Python-ideas] something like sscanf for Python

2019-06-28 Thread James Lu
> On Jun 26, 2019, at 7:13 PM, Chris Angelico wrote: > > The main advantage of sscanf over a regular expression is that it > performs a single left-to-right pass over the format string and the > target string simultaneously, with no backtracking. (This is also its > main DISadvantage compared

[Python-ideas] Re: A proposal (and implementation) to add assignment and LOAD overloading

2019-06-28 Thread Stephen J. Turnbull
Andrew Barnert writes: > On Jun 26, 2019, at 21:45, Stephen J. Turnbull > wrote: > > > > Chris Angelico writes: > > > >> Then I completely don't understand getself. Can you give an example > >> of how it would be used? So far, it just seems like an utter total > >> mess. > > > >