[issue13592] repr(regex) doesn't include actual regex

2016-06-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks weird, but is not a bug. See issue26090. After implementing that feature truncating a pattern would look more explicit. -- ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2016-06-20 Thread Adam Bartoš
Adam Bartoš added the comment: Isn't the trucation of long patterns too rough? Currently, repr(re.compile("a" * 1000)) returns something like "re.compile('a)", i.e. no ending quote and no indication that something was truncated (besides the missing quote). It looked like a bug to m

[issue13592] repr(regex) doesn't include actual regex

2013-11-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4ba7a29fe02c by Ezio Melotti in branch 'default': #13592, #17087: add whatsnew entry about regex/match object repr improvements. http://hg.python.org/cpython/rev/4ba7a29fe02c -- ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2013-11-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___ ___

[issue13592] repr(regex) doesn't include actual regex

2013-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Hugo for your contribution. Thank you Thomas and Ezio for your reviews and suggestions. -- ___ Python tracker ___ _

[issue13592] repr(regex) doesn't include actual regex

2013-11-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8c00677da6c0 by Serhiy Storchaka in branch 'default': Issue #13592: Improved the repr for regular expression pattern objects. http://hg.python.org/cpython/rev/8c00677da6c0 -- nosy: +python-dev ___ Python

[issue13592] repr(regex) doesn't include actual regex

2013-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: * re.UNICODE omitted for string patterns. * Long patterns are truncated. -- Added file: http://bugs.python.org/file32807/issue13592_add_repr_to_regex_v4.patch ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2013-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is fixed and simplified patch. -- Added file: http://bugs.python.org/file32806/issue13592_add_repr_to_regex_v3.patch ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2013-10-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list ma

[issue13592] repr(regex) doesn't include actual regex

2013-01-31 Thread Chris Jerdonek
Chris Jerdonek added the comment: See also issue 17087 which is essentially the same issue but for match objects. -- nosy: +chris.jerdonek ___ Python tracker ___

[issue13592] repr(regex) doesn't include actual regex

2012-08-28 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue13592] repr(regex) doesn't include actual regex

2012-08-23 Thread Hugo Lopes Tavares
Hugo Lopes Tavares added the comment: Any news about this patch? Is it going to be merged? When is next CPython release? -- ___ Python tracker ___ __

[issue13592] repr(regex) doesn't include actual regex

2012-07-20 Thread Hugo Lopes Tavares
Hugo Lopes Tavares added the comment: Changed two test names to avoid misunderstanding. -- Added file: http://bugs.python.org/file26454/issue13592_add_repr_to_regex_v2_1.patch ___ Python tracker _

[issue13592] repr(regex) doesn't include actual regex

2012-07-20 Thread Hugo Lopes Tavares
Hugo Lopes Tavares added the comment: Thanks for the review ezio.melotti. He has notice a few things in my patch: * assertEquals is deprecated; should use assertEqual * the convention is assertEqual(result, expected), not assertEqual(expected, result) * it should handle quotes correctly * some

[issue13592] repr(regex) doesn't include actual regex

2012-07-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: 2.7 is on extended maintenance for normal bugs, but does not get new features/enhancements. It is too late for 3.3 also. -- versions: +Python 3.4 -Python 3.3 ___ Python tracker _

[issue13592] repr(regex) doesn't include actual regex

2012-07-19 Thread Matthew Barnett
Matthew Barnett added the comment: Python 2.7 is the end of the Python 2 line, and it's closed except for security fixes. -- ___ Python tracker ___

[issue13592] repr(regex) doesn't include actual regex

2012-07-19 Thread Hugo Lopes Tavares
Hugo Lopes Tavares added the comment: Hey, I started the patch under `default` branch, and get the following working: >>> import re >>> re.compile("foo") re.compile("foo", re.UNICODE) >>> re.compile("foo", re.DOTALL) re.compile("foo", re.DOTALL|re.UNICODE) >>> re.compile

[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > But it only takes one committer who doesn't care about evalable reprs > to permanently break the pattern for everyone :-( So 95% of our datatypes were committed by a single person? :) -- ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Alex Gaynor
Alex Gaynor added the comment: Raymond, Antoine: I don't see your claims as contradictory, it's definitely true that the Python standardlib has historically tried to keep reprs as being eval-able, I think Antoine's correct that the vast majority of 3rd-party code does not keep with that trend

[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: "I don't see how eval()able repr is a big deal. Most reprs aren't, ..." Sometimes, I wonder if we're even talking about the same programming language. Historically, a good deal of effort has gone into creating evalable reprs, if only because they accurate

[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I'm just adding this to the regex module and I've come up against a > possible issue. The regex module supports named lists, which could be > very big. Should the entire contents of those lists also be shown in > the repr?They would have to be if the repr is t

[issue13592] repr(regex) doesn't include actual regex

2011-12-22 Thread Matthew Barnett
Matthew Barnett added the comment: I'm just adding this to the regex module and I've come up against a possible issue. The regex module supports named lists, which could be very big. Should the entire contents of those lists also be shown in the repr?They would have to be if the repr is to be

[issue13592] repr(regex) doesn't include actual regex

2011-12-16 Thread Terry J. Reedy
Terry J. Reedy added the comment: > but if #11957 is fixed, the result will look like re.Regex('abc', re.I|re.S) That is what I would like to see. -- nosy: +terry.reedy ___ Python tracker __

[issue13592] repr(regex) doesn't include actual regex

2011-12-15 Thread Eric Snow
Changes by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue13592] repr(regex) doesn't include actual regex

2011-12-15 Thread Ezio Melotti
Ezio Melotti added the comment: If an eval-able re.Regex is used, the flags can be showed as second arg, like: re.Regex('a', re.I|re.S) instead of being added to the pattern as in re.Regex('(?is)a') The repr can be generated with something like 're.Regex({r.pattern!r}, {r.flags})'.format(

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Matthew Barnett
Matthew Barnett added the comment: Actually, one possibility that occurs to me is to provide the flags within the pattern. The .pattern attribute gives the original pattern, but repr could give the flags in-line at the start of the pattern: >>> # Assuming Python 3. >>> r = re.compile("a", re.

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: If you change the repr, it should at least eval-able, so be sure to capture the flags and whatnot. -- ___ Python tracker ___ __

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > ISTM that .pattern is the one way to do it. To me this is like saying the repr() of functions should not show their name since .__name__ is the one way to do it. repr() is useful for debugging and logging, why not make it more useful? -- ___

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: ISTM that .pattern is the one way to do it. -- nosy: +rhettinger ___ Python tracker ___ ___ Pyth

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Matthew Barnett
Matthew Barnett added the comment: In reply to Ezio, the repr of a large string, list, tuple or dict is also long. The repr of a compiled regex should probably also show the flags, but should it just be the numeric value? -- ___ Python tracker

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +Regular Expressions nosy: +mrabarnett ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I'm not sure having the pattern in the repr will make it more readable, > since the regex might even be very long. Hmm, I think it's a reasonable feature request myself. Oops, I meant "enhancement", not "feature request" :) -- nosy: +pitrou stage:

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Ezio Melotti
Ezio Melotti added the comment: I'm not sure having the pattern in the repr will make it more readable, since the regex might even be very long. You can use the .pattern attribute if you want to see the pattern. -- nosy: +ezio.melotti status: open -> pending versions: +Python 3.2, Py

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Martin Häcker
New submission from Martin Häcker : When calling repr() on a compiled regex pattern like this: > import re > repr(re.compile('foo')) you don't get the pattern of the regex out of the compiled form. Also all my research has shown no getter to allow this. I noticed this in my application becaus