Re: Fwd: Problem with writing a long line in a text file

2008-11-20 Thread Matthew Barnett
Steve Holden wrote: Mohsen Akbari wrote: Dear guys, I'm a newbie in python and I have this problem with the code that I'm writing. There is a very long line which I wish to output it to a text file.But when I do this, in the output file, the result appears in two lines. I thought maybe that's

Re: KeyboardInterrupt

2009-12-10 Thread Matthew Barnett
mattia wrote: Il Thu, 10 Dec 2009 04:56:33 +, Brad Harms ha scritto: On Thu, 10 Dec 2009 00:29:45 +, mattia wrote: Il Wed, 09 Dec 2009 16:19:24 -0800, Jon Clements ha scritto: On Dec 9, 11:53 pm, mattia ger...@gmail.com wrote: Hi all, can you provide me a simple code snippet to

Re: 3 byte network ordered int, How To ?

2010-01-06 Thread Matthew Barnett
mudit tuli wrote: For a single byte, struct.pack('B',int) For two bytes, struct.pack('H',int) what if I want three bytes ? Four bytes and then discard the most-significant byte: struct.pack('I', int)[ : -1] -- http://mail.python.org/mailman/listinfo/python-list

Re: What is built-in method sub

2010-01-11 Thread Matthew Barnett
Jeremy wrote: I just profiled one of my Python scripts and discovered that 99% of the time was spent in {built-in method sub} What is this function and is there a way to optimize it? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax

2010-01-18 Thread Matthew Barnett
marlowe wrote: I wrote this program, but i have a feeling like there might be a more practical way of writing it. Can someone give me an idea of how to simplify this? Here is an example of the csv file i am using. This program calculates the exponential moving average of the 20 day range.

Re: EAFP gone wrong

2010-02-09 Thread Matthew Barnett
Arnaud Delobelle wrote: Hi all, Hi have a set of classes that represent mathematical objects which can be represented as a string using a 'latex' method (after Knuth's famous typesetting system). As I want to be able to typeset some builtin types as well, I have a generic function, latex(), as

Re: ANN: obfuscate

2010-02-11 Thread Matthew Barnett
Paul Rubin wrote: Gregory Ewing greg.ew...@canterbury.ac.nz writes: Actually I gather it had a lot to do with the fact that the Germans made some blunders in the way they used the Enigma that seriously compromised its security. There was reportedly a branch of the German forces that used their

Re: Download unnamed web image?

2010-02-16 Thread Matthew Barnett
galileo228 wrote: On Feb 16, 9:40 pm, galileo228 mattbar...@gmail.com wrote: On Feb 16, 8:48 pm, John Bokma j...@castleamber.com wrote: galileo228 mattbar...@gmail.com writes: Using BeautifulSoup, mechanize, and urllib, I've constructed the following:

Re: An assessment of the Unicode standard

2009-09-01 Thread Matthew Barnett
Kurt Mueller wrote: Am 01.09.2009 um 09:39 schrieb Terry Reedy: But this same problem also extends into monies, nation states, units of measure, etc. There is, of course, an international system of measure. The US is the only major holdout. (I recall Burma, or somesuch, is another.) An

Re: Einstein summation notation

2009-07-17 Thread Matthew Barnett
Steven D'Aprano wrote: On Fri, 17 Jul 2009 16:09:03 +0100, MRAB wrote: Python did always have True and False. Oops! I meant didn't, of course. $ python1.5 Python 1.5.2 (#1, Apr 1 2009, 22:55:54) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Copyright 1991-1995 Stichting

Re: off topic but please forgive me me and answer

2010-04-03 Thread Matthew Barnett
superpollo wrote: Steve Holden ha scritto: superpollo wrote: Patrick Maupin ha scritto: On Apr 2, 2:41 pm, Andreas Waldenburger use...@geekmail.invalid wrote: While everyone else is mocking you: Can you please elaborate on why you want to know and what kind of problem you're trying to solve

Re: Getting started with IDLE and Python - no highlighting and no execution

2012-08-05 Thread Matthew Barnett
On 06/08/2012 01:58, MRAB wrote: On 06/08/2012 01:09, Rotwang wrote: On 06/08/2012 00:46, PeterSo wrote: I am just starting to learn Python, and I like to use the editor instead of the interactive shell. So I wrote the following little program in IDLE # calculating the mean data1=[49, 66,

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Matthew Barnett
On 2014-04-25 18:53, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-19 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101120.zip is a new version of the regex module. The match object now supports additional methods which return information on all the successful matches of a repeated capture group. The API was inspired by that of .Net

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-20 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101121.zip is a new version of the regex module. The captures didn't work properly with lookarounds or atomic groups. -- Added file: http://bugs.python.org/file19723/issue2636-20101121.zip

[issue1859] textwrap doesn't linebreak on \n

2010-11-22 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I'd be interested in having a go if I knew what the desired behaviour was, ie unit tests to confirm what was 'correct'. How should it handle line breaks? Should it treat them like any other whitespace as at present, should

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-23 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101123.zip is a new version of the regex module. Oops, sorry, the weird behaviour of msg11 was a bug. :-( -- Added file: http://bugs.python.org/file19786/issue2636-20101123.zip

[issue1859] textwrap doesn't linebreak on \n

2010-11-23 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: textwrap_2010-11-23.diff is my attempt to provide a fix, if it's wanted/needed. -- Added file: http://bugs.python.org/file19791/textwrap_2010-11-23.diff ___ Python tracker rep

[issue10532] A bug related to matching the empty string

2010-11-25 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: The spans say this: for m in re.finditer('((.d.)*)*', 'adb'): print(m.span()) (0, 3) (3, 3) There's an non-empty match followed by an empty match. IHMO, not a bug. -- nosy: +mrabarnett

[issue2650] re.escape should not escape underscore

2010-11-25 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Re the regex module (issue #2636), would a good compromise be: regex.escape(user_input, special_only=True) to maintain compatibility? -- nosy: +mrabarnett ___ Python tracker rep

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-29 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101130.zip is a new version of the regex module. Added 'special_only' keyword parameter (default False) to regex.escape. When True, regex.escape escapes only 'special' characters, such as '?'. -- Added file

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101207.zip is a new version of the regex module. It includes additional checks against pathological regexes. -- Added file: http://bugs.python.org/file19965/issue2636-20101207.zip

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-10 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101210.zip is a new version of the regex module. I've extended the additional checks of the previous version. It has been tested with Python 2.5 to Python 3.2b1. -- Added file: http://bugs.python.org/file20001

[issue10704] Regex 0.1.20101210 Python 3.1 install problem Mac OS X 10.6.5

2010-12-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I use Windows XP, so I can't help with MacOS X. From the error log it looks like it doesn't like the sources for Python either! -- ___ Python tracker rep...@bugs.python.org http

[issue10703] Regex 0.1.20101210

2010-12-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: The regex module is intended to replace the re module, so its default behaviour is the same: in Python 2, regexes default to matching ASCII, and in Python 3, they default to matching Unicode. If you want to use a regex on a Unicode

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-23 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101224.zip is a new version of the regex module. Case-insensitive matching is now faster. The matching functions and methods now accept a keyword argument to release the GIL during matching to enable other Python

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-24 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I've been trying to push the history to Launchpad, completely without success; it just won't authenticate (no such account, even though I can log in!). I doubt that the history would be much use to you anyway

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-24 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: It does have an SSH key. It's probably something simple that I'm missing. I think that the only change I'm likely to make is to a support script I use; it currently uses hard-coded paths, etc, to do its magic

[issue6210] Exception Chaining missing method for suppressing context

2010-12-27 Thread Matthew Barnett
Changes by Matthew Barnett pyt...@mrabarnett.plus.com: -- nosy: +mrabarnett ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6210 ___ ___ Python-bugs

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-27 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101228.zip is a new version of the regex module. Sorry for the delay, the fix took me a bit longer than I expected. :-) -- Added file: http://bugs.python.org/file20176/issue2636-20101228.zip

[issue6210] Exception Chaining missing method for suppressing context

2010-12-27 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Regarding syntax, I'm undecided between: raise with new_exception and: raise new_exception with caught_exception I think that the second form is clearer: try: ... exception SomeException as ex

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-28 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101228a.zip is a new version of the regex module. It now compiles the pattern quickly. -- Added file: http://bugs.python.org/file20182/issue2636-20101228a.zip ___ Python

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-28 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101229.zip is a new version of the regex module. It now compiles the pattern quickly. -- Added file: http://bugs.python.org/file20185/issue2636-20101229.zip ___ Python tracker

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-29 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101230.zip is a new version of the regex module. I've delayed the building of the tables for fast searching until their first use, which, hopefully, will mean that fewer will be actually built. -- Added file

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-30 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: The project is now at: https://code.google.com/p/mrab-regex/ Unfortunately it doesn't have the revision history. I don't know why not. -- ___ Python tracker rep...@bugs.python.org

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-30 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: msg124904: It would, of course, be slower on first use, but I'm surprised that it's (that much) slower afterwards. msg124905, msg124906: I have those matching now. msg124931: The sources are in TortoiseBzr, but I couldn't upload

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-30 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Even after much uninstalling and reinstalling (and reboots) I never got TortoiseSVN to work properly, so I switched to TortoiseHg. The sources are now at: https://code.google.com/p/mrab-regex-hg

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Why not? :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636 ___ ___ Python

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Just to check, does this still work with your changes of msg124959? regex.search(r'\d{4}(\s*\w)?\W*((?!\d)\w){2}', XX) For me it fails to match! -- ___ Python tracker rep

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2011-01-03 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I've just done a bug fix. The issue is at: https://code.google.com/p/mrab-regex-hg/ BTW, Jacques, I trust that your regression tests don't test how long a regex takes to fail to match, because a bug could cause such a non-match

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2011-01-16 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: That line crept in somehow. As it's been there since the 2010-12-24 release and you're the first one to have a problem with it (and you've already fixed it), it looks like a new upload isn't urgently needed (I don't have any other

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2011-01-25 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I've reduced the size of some internal tables. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue11198] re sub subn backreferrence too few replacements

2011-02-11 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Argument 4 of re.subn(...) is 'count', the maximum number of replacements to perform, but you're passing in the MULTILINE flag, which happens to have the integer value 8, hence you're limiting the maximum number of replacements to 8

[issue11307] re engine exhaustively explores more than necessary

2011-02-24 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: It's a known issue (see issue #1662581, for example). There's a new implementation at PyPI which doesn't have this problem: http://pypi.python.org/pypi/regex -- nosy: +mrabarnett

[issue8847] crash appending list and namedtuple

2010-06-05 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I've just found that: [1] + foo() crashes, but: [1].__add__(foo()) gives: Traceback (most recent call last): File pyshell#25, line 1, in module [1].__add__(foo()) TypeError: can only concatenate list

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-06-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Re: msg107776. If it looks like an integer (ie, can be converted to an integer by 'int') then it's positional, otherwise it's a key. An optimisation is to perform a quick check upfront to see whether it starts like an integer

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-06-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: That's a good question. :-) Possibly just an optional sign followed by one or more digits. Another possibility that occurs to me is for it to default to positional if it looks like an integer, but allow quoting to force

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-06-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Your original: {0[-1]}.format('fox') is a worse gotcha than: {-1}.format('fox') because you're much less likely to want to do the latter. It's one of those things that it would be nice to have fixed, or we could just add

[issue1519638] Unmatched Group issue - workaround

2010-06-25 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Issue #2636 resulted in the new regex module (also available on PyPI), so this issue is addressed by that, but there's no patch for the re module. -- ___ Python tracker rep

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-05 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100706.zip is a new version of the regex module. I've added your examples to the unit tests. The module now passes. Keep up the good work! :-) -- Added file: http://bugs.python.org/file17877/issue2636-20100706

[issue9179] Lookback with group references incorrect (two issues?)

2010-07-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Should a regex compile if a group is referenced before it's defined? Consider this: (?:(?(2)(a)|(b))+ Other regex implementations permit forward references to groups. BTW, I had a look at the re module, found it too difficult

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I started with trying to modify the existing re module, but I wanted to make too many changes, so in the end I decided to make a clean break and start on a new implementation which was compatible with the existing re module

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: The file at: http://pypi.python.org/pypi/regex was downloaded 75 times, if that's any help. (Now reset to 0 because of the bug fix.) If it's included in 3.2 then there's the question of whether it should replace the re module

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: As a crude guide of the speed difference, here's Python 2.6: re regex bm_regex_compile.py 86.53secs 260.19secs bm_regex_effbot.py 13.70secs8.94secs bm_regex_v8.py 15.66secs

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-08 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100709.zip is a new version of the regex module. I've moved most of the regex module's Python code into a private module. -- Added file: http://bugs.python.org/file17912/issue2636-20100709.zip

[issue1158231] string.Template does not allow step-by-step replacements

2010-07-10 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Here's a patch for Python 3.1, if anyone's still interested after 5 years. :-) -- keywords: +patch nosy: +mrabarnett Added file: http://bugs.python.org/file17930/from_template.diff

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-18 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100719.zip is a new version of the regex module. Just a few more tweaks for speed. -- Added file: http://bugs.python.org/file18054/issue2636-20100719.zip ___ Python tracker

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-19 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: This has already been reported in issue #3511. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-24 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100725.zip is a new version of the regex module. More tweaks for speed. re regex bm_regex_compile.py 87.05secs 278.00secs bm_regex_effbot.py 14.00secs6.58secs

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-26 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: No. Wouldn't that break compatibility with 're'? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-07-26 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: That's a possibility. I must admit that I don't entirely understand it enough to implement it (the OP said I don't believe that the algorithm for this is a whole lot more complicated), and I don't have a need for it myself

[issue9529] Converge re.findall and re.finditer

2010-08-06 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: (1) would break existing code. It would also mean that you wouldn't have access to the start and end positions of the matches either. (2) would also break existing code which is expecting a list. It's like the change that happened

[issue9529] Converge re.findall and re.finditer

2010-08-07 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Ah, I see what you mean. I still think you're wrong, though! :-) The 'for' loop is doing is basically this: it = re.finditer(r'(\w+):(\w+)', text) try: while True: match_object = next

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2010-08-11 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I agree with Kamil and Germán. I would've expected negative indexes for sequences to work. Negative indexes for fields is a different matter. -- ___ Python tracker rep...@bugs.python.org

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-08-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100814.zip is a new version of the regex module. I've added default Unicode word boundaries and renamed the Pattern and Match classes. Over to you, Alex. :-) -- Added file: http://bugs.python.org/file18532

[issue7255] Default word boundaries for Unicode data?

2010-08-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: These have been added to the new 'regex' module. See issue #2636 or PyPI at: http://pypi.python.org/pypi/regex -- nosy: +mrabarnett ___ Python tracker rep...@bugs.python.org http

[issue7255] Default word boundaries for Unicode data?

2010-08-15 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: If you're on Windows (x86, 32-bit) then compilation isn't necessary - just use the appropriate _regex.pyd. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7255

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-08-15 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100816.zip is a new version of the regex module. Unfortunately I came across a bug in the handing of sets. More unit tests added. -- Added file: http://bugs.python.org/file18541/issue2636-20100816.zip

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-08-23 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100824.zip is a new version of the regex module. More speedups. Getting towards Perl speed now, depending on the regex. :-) -- Added file: http://bugs.python.org/file18621/issue2636-20100824.zip

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-11 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100912.zip is a new version of the regex module. More speedups. I've been comparing the speed against Perl wherever possible. In some cases Perl is lightning fast, probably because regex is built into the language

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-12 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Another flag? Hmm. How about this instead: if a scoped flag appears at the end of a regex (and would therefore normally have no effect) then it's treated as though it's at the start of the regex. Thus: foo(?i) is treated like

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-12 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: The tests for re include these regexes: a.b(?s) a.*(?s)b I understand what Georg said previously about some people preferring to put them at the end, but I personally wouldn't do that because some regex implementations

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-12 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: OK, so would it be OK if there was, say, a NEW (N) flag which made the inline flags (?flags) scoped and allowed splitting on zero-width matches? -- ___ Python tracker rep

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-12 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100913.zip is a new version of the regex module. I've removed the ZEROWIDTH flag and added the NEW flag, which turns on the new behaviour such as splitting on zero-width matches and positional flags. If the NEW flag

[issue1708652] Exact matching

2010-09-17 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Does this request still stand? If so then I'll add it to the new regex module. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1708652

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-17 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20100918.zip is a new version of the regex module. I've added 'pos' and 'endpos' arguments to regex.sub and regex.subn and refactored a little. I can't think of any other features that need to be added or see any more

[issue1708652] Exact matching

2010-09-18 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: '$' matches at the end of the string or at a newline at the end of a string (if multiline mode isn't turned on). '\Z' matches only at the end of the string. If not even the OP is convinced of the need, then I have no objection

[issue2027] Module containing C implementations of common text algorithms

2010-09-20 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I've started on a module called 'texttools'. So far it has Levenshtein and Porter (both coded in C). If there's interest I'll put it on PyPI. Suggestions for other additions? -- nosy: +mrabarnett

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-09-21 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I use Python 3, where len(\U00010337) == 2 on a narrow build. Yes, wide Unicode on a narrow build is a problem: regex.findall(\\U00010337, a\U00010337bc) [] regex.findall((?i)\\U00010337, a\U00010337bc) [] I'm not sure how

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-08 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101009.zip is a new version of the regex module. It appears from a posting in python-list and a closer look at the docs that string positions in the 're' module are limited to 32 bits, even on 64-bit builds. I think

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-14 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: I am not able to build or test a 64-bit version. The update was to the source files to ensure that if it is compiled for 64 bits then the string positions will also be 64-bit. This change was prompted by a poster who tried to use

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-29 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: That's a bug. I'll fix it as soon has I've reinstalled the SDK. sigh/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-29 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101029.zip is a new version of the regex module. I've also added to the unit tests. -- Added file: http://bugs.python.org/file19419/issue2636-20101029.zip ___ Python tracker

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-29 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101030.zip is a new version of the regex module. I've also added yet more to the unit tests. -- Added file: http://bugs.python.org/file19422/issue2636-20101030.zip ___ Python

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-10-30 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101030a.zip is a new version of the regex module. This bug was a bit more difficult to fix, but I think it's OK now! -- Added file: http://bugs.python.org/file19435/issue2636-20101030a.zip

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-01 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101101.zip is a new version of the regex module. I hope it's finally fixed this time! :-) -- Added file: http://bugs.python.org/file19456/issue2636-20101101.zip ___ Python

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-01 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101102.zip is a new version of the regex module. -- Added file: http://bugs.python.org/file19460/issue2636-20101102.zip ___ Python tracker rep...@bugs.python.org http

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-02 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101102a.zip is a new version of the regex module. msg120204 relates to issue #1519638 Unmatched group in replacement. In 'regex' an unmatched group is treated as an empty string in a replacement template. This behaviour

[issue10328] re.sub[n] doesn't seem to handle /Z replacements correctly in all cases

2010-11-05 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: It's a bug caused by trying to avoid getting stuck when a zero-width match is found. Basically the fix is to advance one character after a zero-width match, but that doesn't always give the correct result. There are a number

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-05 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101106.zip is a new version of the regex module. Fix for issue 10328, which regex also shared. -- Added file: http://bugs.python.org/file19514/issue2636-20101106.zip

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-11 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: It looks like a similar problem to msg116252 and msg116276. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2636

[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-13 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: issue2636-20101113.zip is a new version of the regex module. It now supports Unicode 6.0.0. -- Added file: http://bugs.python.org/file19597/issue2636-20101113.zip ___ Python tracker rep

[issue7132] Regexp: capturing groups in repetitions

2010-11-18 Thread Matthew Barnett
Matthew Barnett pyt...@mrabarnett.plus.com added the comment: Earlier this week I discovered that .Net supports repeated capture and its API suggested a much cleaner approach than what Perl offered, so I'll be adding it to the regex module at: http://pypi.python.org/pypi/regex The new

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-15 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: I know what you mean about the dependencies! My current problem is that now I'm working with the current trunk, which means using Visual C++ Express 2008 instead of 2005. When debugging it's behaving like the debug info is out of date

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-15 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: Used Visual C++ Express 2005 and the PC\VS8.0 directory. Same problem. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3825

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-15 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: _sre.c is over 6000, but it does contain macros. I didn't have this problem when based on Python 2.5.2 in Express 2005. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3825

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-20 Thread Matthew Barnett
Changes by Matthew Barnett [EMAIL PROTECTED]: Removed file: http://bugs.python.org/file11530/regex_2.6rc2.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3825

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-20 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: Bugfix. Added file: http://bugs.python.org/file11532/regex_2.6rc2.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3825

[issue3262] re.split doesn't split with zero-width regex

2008-09-21 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: I wonder whether it could be put into Python 3 where certain breaks in backwards compatibility are to be expected. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3262

[issue3825] Major reworking of Python 2.5.2 re module

2008-09-21 Thread Matthew Barnett
Matthew Barnett [EMAIL PROTECTED] added the comment: Fixed the matching of word boundaries when searching and matching in substrings. Added file: http://bugs.python.org/file11543/regex_2.6rc2+1.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org

  1   2   3   4   5   6   >