[issue2650] re.escape should not escape underscore

2008-06-28 Thread Morten Lied Johansen

Morten Lied Johansen <[EMAIL PROTECTED]> added the comment:

In my particular case, we were passing the regex on to a database which 
has regex support syntactically equal to Python, so it seemed natural 
to use re.escape to make sure we weren't matching against the pattern 
we really wanted.

The documentation of re.escape also states that it will only escape non-
alphanumeric characters, which is apparently only true if you are using 
a single byte encoding (ie. not utf-8, or any other encoding using more 
than a single byte per character). At the very least, that's probably 
worth mentioning in the docs.

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



[issue2650] re.escape should not escape underscore

2008-06-26 Thread Morten Lied Johansen

Morten Lied Johansen <[EMAIL PROTECTED]> added the comment:

One issue that the current implementation has, which I can't see have 
been commented on here, is that it kills utf8 characters (and probably 
every other character encoding that is multi-byte).

A é character in an utf8 encoded string will be represented by two 
bytes. When passed through re.escape, those two bytes are checked 
individually, and both are considered non-alphanumeric, and is 
consequently escaped, breaking the utf8 string into complete gibberish 
instead.

--
nosy: +mortenlj

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



[issue3196] Option in pydoc to show docs from private methods

2008-06-25 Thread Morten Lied Johansen

New submission from Morten Lied Johansen <[EMAIL PROTECTED]>:

Currently, running pydoc on a module will show you the documentation on 
all regular methods, and all special methods (starting and ending in 
double underscores).

Private methods (starting with a single underscore) are not included.

Some times, it would be nice to include docs for these methods aswell, 
and a small change to pydoc.visiblename solves the problem.

I've included a patch that adds this behaviour as an option (-i for 
include private names). The implementation isn't as clean as one would 
hope for (sets a global flag), but was the best I could come up with in 
the short time I had available. Feel free to make a better 
implementation.

The patch is against python 2.5.

--
components: Library (Lib)
files: pydoc.privatenames.patch
keywords: patch
messages: 68722
nosy: mortenlj
severity: normal
status: open
title: Option in pydoc to show docs from private methods
type: feature request
versions: Python 2.5
Added file: http://bugs.python.org/file10727/pydoc.privatenames.patch

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