[issue3756] re.escape() does not work with bytes()

2008-09-10 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: >Looks fine, except I used frozenset for the _alphanum* variables and >reverted to double quotes like the rest of the file. Submitted as r66366. All good. Thankyou. ___ Python tracker <[EMAIL PROTECTED]>

[issue3756] re.escape() does not work with bytes()

2008-09-10 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: Looks fine, except I used frozenset for the _alphanum* variables and reverted to double quotes like the rest of the file. Submitted as r66366. -- assignee: -> gvanrossum resolution: -> accepted status: open -> closed ___

[issue3756] re.escape() does not work with bytes()

2008-09-07 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: I meant "I can certainly imagine use cases..." In case it's not clear, I think the implementation in the patch is "good enough" (unless someone can suggest any obvious optimisations). If someone can prove that re.escape() performance is ca

[issue3756] re.escape() does not work with bytes()

2008-09-07 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: I don't think it's possible to say whether it's preformance critical - I can certainly image use cases such as parser generators where its speed could be noticed. I tried building a version using regular expressions, but I couldn't do any

[issue3756] re.escape() does not work with bytes()

2008-09-04 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: I don't think there are cases where re.escape is performance critical - are there any? By the way, it seems to me the simplest way to write re.escape() would be to use a regexp to do the replacement. It might or might not be the fastest.

[issue3756] re.escape() does not work with bytes()

2008-09-04 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: On further testing, sometimes the str version is faster, sometimes the bytes version is faster. Never more than about 50% one way or the other, so probably not worth worrying about, although I still don't really like the implementation. Ma

[issue3756] re.escape() does not work with bytes()

2008-09-03 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- priority: -> deferred blocker ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Pytho

[issue3756] re.escape() does not work with bytes()

2008-09-02 Thread Andrew McNamara
Changes by Andrew McNamara <[EMAIL PROTECTED]>: Added file: http://bugs.python.org/file11352/re_escape-patch ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3756] re.escape() does not work with bytes()

2008-09-02 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: Will do, although I'm slightly concerned that my "bytes" version of the function is about 50% slower than the "str" version. I can see why, I just can't think of a way to do it any faster. There's an inherent asymetry in bytes type that di

[issue3756] re.escape() does not work with bytes()

2008-09-01 Thread Andrew McNamara
Andrew McNamara <[EMAIL PROTECTED]> added the comment: The attached "re_escape.py" is a (somewhat crappy) fix for re.escape() Added file: http://bugs.python.org/file11340/re_escape.py ___ Python tracker <[EMAIL PROTECTED]> _

[issue3756] re.escape() does not work with bytes()

2008-09-01 Thread Andrew McNamara
New submission from Andrew McNamara <[EMAIL PROTECTED]>: In python 2, re.escape() works with either str or unicode, but in python 3, re.escape() no longer works correctly with the bytes type. -- components: Regular Expressions messages: 72309 nosy: andrewmcnamara severity: normal status