[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

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 better than 5x slower than the existing implementations, and the 
resulting code was less readable.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 causing problems 
for other modules in the standard lib (email, ctypes, warnings, 
fnmatch, _strptime use it, among others), then we might consider a C 
implementation.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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. Maybe it deserves a C implementation?

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.

--
nosy: +pitrou

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 didn't exist before: b''.join(list(b'abc')) 
does not work. Of course, this does work: bytes(list(b'abc')), but the 
bytes constructor only accepts ints, not bytes. I'd like to see either 
the join method accept ints as well as bytes, or the bytes ctor accept 
bytes as well as ints. Or something.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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: open
title: re.escape() does not work with bytes()
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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]
http://bugs.python.org/issue3756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com