[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Paul Moore
On Wed, 16 Feb 2022 at 10:23, Chris Angelico wrote: > > On Wed, 16 Feb 2022 at 21:01, Stephen J. Turnbull > wrote: > > What I think is more interesting than simpler (but more robust for > > what they can do) facilities is better parser support in standard > > libraries (not just Python's), and

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Stephen J. Turnbull
Chris Angelico writes: > On Wed, 16 Feb 2022 at 01:54, Stephen J. Turnbull > wrote: > > That is, all regexp implementations support the same basic > > language which is sufficient for most tasks most programmers want > > regexps for. > > The problem is that that's an illusion. It isn't

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Chris Angelico
On Wed, 16 Feb 2022 at 21:01, Stephen J. Turnbull wrote: > > Chris Angelico writes: > > On Wed, 16 Feb 2022 at 01:54, Stephen J. Turnbull > > wrote: > > > > That is, all regexp implementations support the same basic > > > language which is sufficient for most tasks most programmers want > >

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread Soni L.
On 2022-02-16 10:45, Steven D'Aprano wrote: > On Wed, Feb 16, 2022 at 09:44:07AM -0300, Soni L. wrote: > > This might be a silly idea but, would it be a good idea to have > > ...[a:b:c] return a range(a, b, c)? > > Similar ideas have been suggested before: > >

[Python-ideas] Re: Regex pattern matching

2022-02-16 Thread Paul Moore
On Wed, 16 Feb 2022 at 14:47, Valentin Berlier wrote: > > Hi, > > I've been thinking that it would be nice if regex match objects could be > deconstructed with pattern matching. For example, a simple .obj parser could > use it like this: > > match re.match(r"(v|f) (\d+) (\d+) (\d+)", line):

[Python-ideas] Re: Regex pattern matching

2022-02-16 Thread Eric V. Smith
See https://bugs.python.org/issue46692. It's not so easy to make match objects mappings or sequences because of the len() problem. Eric On 2/16/2022 9:46 AM, Valentin Berlier wrote: Hi, I've been thinking that it would be nice if regex match objects could be deconstructed with pattern

[Python-ideas] Re: Creating a class template file generator inside Python language

2022-02-16 Thread Avanish Gupta
Thanks for the previous mail. I would like to highlight the value my thought offers to the developers. They often have to write classes while writing a module. In the class, they are supposed to write classes and objects. In a class, typically the attributes are private, and we have getters and

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread Serhiy Storchaka
16.02.22 14:44, Soni L. пише: > This might be a silly idea but, would it be a good idea to have > ...[a:b:c] return a range(a, b, c)? See PEP 204. https://www.python.org/dev/peps/pep-0204/ ___ Python-ideas mailing list -- python-ideas@python.org To

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread David Lowry-Duda
> This might be a silly idea but, would it be a good idea to have > ...[a:b:c] return a range(a, b, c)? This sort of highly-subjective syntactic sugar makes me wonder whether there would be support for a standard python preprocessor, like what was suggested in PEP 638 [1]. [1]:

[Python-ideas] Re: Creating a class template file generator inside Python language

2022-02-16 Thread Chris Angelico
On Thu, 17 Feb 2022 at 00:18, Avanish Gupta wrote: > > Thanks for the previous mail. > I would like to highlight the value my thought offers to the developers. They > often have to write classes while writing a module. In the class, they are > supposed to write classes and objects. In a class,

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Ricky Teachey
On Wed, Feb 16, 2022, 5:46 AM Paul Moore wrote: > On Wed, 16 Feb 2022 at 10:23, Chris Angelico wrote: > > > > On Wed, 16 Feb 2022 at 21:01, Stephen J. Turnbull > > wrote: > > > > What I think is more interesting than simpler (but more robust for > > > what they can do) facilities is better

[Python-ideas] Regex pattern matching

2022-02-16 Thread Valentin Berlier
Hi, I've been thinking that it would be nice if regex match objects could be deconstructed with pattern matching. For example, a simple .obj parser could use it like this: match re.match(r"(v|f) (\d+) (\d+) (\d+)", line): case ["v", x, y, z]: print("Handle vertex")

[Python-ideas] Creating ranges with ellipsis

2022-02-16 Thread Soni L.
This might be a silly idea but, would it be a good idea to have ...[a:b:c] return a range(a, b, c)? ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread Steven D'Aprano
On Wed, Feb 16, 2022 at 09:44:07AM -0300, Soni L. wrote: > This might be a silly idea but, would it be a good idea to have > ...[a:b:c] return a range(a, b, c)? Similar ideas have been suggested before:

[Python-ideas] Re: Creating a class template file generator inside Python language

2022-02-16 Thread Jelle Zijlstra
Are you aware of https://docs.python.org/3.10/library/dataclasses.html? That essentially provides a way to generate the boilerplate without having to put it all in your code. El mié, 16 feb 2022 a las 5:20, Avanish Gupta () escribió: > Thanks for the previous mail. > I would like to highlight

[Python-ideas] Re: Creating a class template file generator inside Python language

2022-02-16 Thread Steven D'Aprano
On Tue, Feb 15, 2022 at 03:43:54PM +0530, Avanish Gupta wrote: > I would like to highlight the value my thought offers to the developers. > They often have to write classes while writing a module. In the class, they > are supposed to write classes and objects. In a class, typically the >

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Chris Angelico
On Thu, 17 Feb 2022 at 08:33, J.B. Langston wrote: > > Well, I certainly sparked a lot of interesting discussion, which I have quite > enjoyed reading. But to bring this thread back around to its original topic, > is there support among the Python maintainers for adding a timeout feature to >

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread J.B. Langston
Well, I certainly sparked a lot of interesting discussion, which I have quite enjoyed reading. But to bring this thread back around to its original topic, is there support among the Python maintainers for adding a timeout feature to the Python re library? I will look at the third-party regex

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Tim Peters
[J.B. Langston ] > Well, I certainly sparked a lot of interesting discussion, which I have > quite enjoyed reading. But to bring this thread back around to its > original topic, is there support among the Python maintainers for > adding a timeout feature to the Python re library? Buried in the

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread J.B. Langston
Thanks for the conclusive answer. I will checkout the regex library soon. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread MRAB
On 2022-02-16 22:13, Tim Peters wrote: [J.B. Langston ] Well, I certainly sparked a lot of interesting discussion, which I have quite enjoyed reading. But to bring this thread back around to its original topic, is there support among the Python maintainers for adding a timeout feature to the

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Tim Peters
[MRAB ] > I eventually decided against having it added to the standard library > because that would tie fixes and additions to Python's release cycle, > and there's that adage that Python has "batteries included", but not > nuclear reactors. PyPI is a better place for it, for those who need more >

[Python-ideas] Re: Creating ranges with ellipsis

2022-02-16 Thread Nick Timkovich
> > > This might be a silly idea but, would it be a good idea to have > > ...[a:b:c] return a range(a, b, c)? > If a 'thunderscore' is acceptable: import itertools class _ranger: @classmethod def __getitem__(self, key: slice): if isinstance(key, slice): if key.stop is

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Tim Peters
[J.B. Langston ] > Thanks for the conclusive answer. Not conclusive - just my opinion. Which is informed, but not infallible ;-) > I will checkout the regex library soon. You may not realize how easy this is? Just in case: go to a shell and type pip install regex (or, on Windows, "python -m

[Python-ideas] Re: Regex timeouts

2022-02-16 Thread Barry
> On 17 Feb 2022, at 01:04, Tim Peters wrote: > > [J.B. Langston ] >> Thanks for the conclusive answer. > > Not conclusive - just my opinion. Which is informed, but not infallible ;-) > >> I will checkout the regex library soon. > > You may not realize how easy this is? Just in case: go