[issue13219] re module doc has minor inaccuracy in character sets

2011-10-20 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 07eca800cdb4 by Ezio Melotti in branch '2.7':
#13219: clarify section about character sets in the re documentation.
http://hg.python.org/cpython/rev/07eca800cdb4

New changeset dc96a89ac192 by Ezio Melotti in branch '3.2':
#13219: clarify section about character sets in the re documentation.
http://hg.python.org/cpython/rev/dc96a89ac192

New changeset 78540d1264d9 by Ezio Melotti in branch 'default':
#13219: merge with 3.2.
http://hg.python.org/cpython/rev/78540d1264d9

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13219] re module doc has minor inaccuracy in character sets

2011-10-20 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Done, thanks for the report!

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13219] re module doc has minor inaccuracy in character sets

2011-10-20 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Well, the actual behavior is a little bit more complex to describe.

 re.match('[.-_a-z]', '-')
 re.match('[._-a-z]', '-')
_sre.SRE_Match object at 0x100418e80


 re.match('[.-_a-z]', 'b')
_sre.SRE_Match object at 0x100418b88
 re.match('[._-a-z]', 'b')

However, I don't think it is worth changing again the documentation.

--
nosy: +flox
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13219] re module doc has minor inaccuracy in character sets

2011-10-20 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Indeed.
The tricks of putting '-' at the beginning/end and ']' at the beginning are 
well known and works with most of the implementations afaik, but I would 
consider the behavior of [._-a-z] as an implementation detail and don't expect 
it to work elsewhere.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13219] re module doc has minor inaccuracy in character sets

2011-10-19 Thread becky lewis

New submission from becky lewis bex.le...@gmail.com:

The documentation for the re module  (specifically the section for []) states 
that:

If you want to include a ']' or a '-' inside a set, precede it with a 
backslash, or place it as the first character.

However, after finding a typo in a regex I wrote it turns out to be false.

Using the following regex finds a match:
 regex = re.compile(r'[123ab-f-]+')
 regex.match('-')
_sre.SRE_Match object at 0x8dd1b10

I am not sure if this is an issue with the documentation or if the re module 
itself should not allow this behaviour. It would be nice if the documentation 
warned that hyphens (and other 'special' characters such as [) that are not 
escaped may still be matched, even though they are not the first character.

--
assignee: docs@python
components: Documentation
messages: 145911
nosy: becky.lewis, docs@python
priority: normal
severity: normal
status: open
title: re module doc has minor inaccuracy in character sets
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13219] re module doc has minor inaccuracy in character sets

2011-10-19 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Here's a patch against 2.7.  I rephrased the section a bit.  If it's more 
understandable I'll commit it.

--
assignee: docs@python - ezio.melotti
keywords: +patch
nosy: +ezio.melotti
stage:  - commit review
versions: +Python 3.2, Python 3.3
Added file: http://bugs.python.org/file23474/issue13219.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13219
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com