Kunjesh Kaushik <[email protected]> added the comment:
I think we are dealing with two separate issues: a feature request for
sectionxform kind of functionality desirable in a future release (3.3 maybe)
and a behaviour issue in current releases (2.x and 3.x both). I suggest we
split the two issues and solve them as such. Deferring the latter may be
undesirable.
Also, I found that a non-greedy pattern will work with the original patch:
>>> import re
>>> r = re.compile(r'\[\s*(?P<header>[^]]+?)\s*\]') # note +? instead of +
>>> r.match('[ section header ]').group('header') # works as "expected"
'section header'
Attaching a new patch file as well.
----------
keywords: +patch
Added file:
http://bugs.python.org/file20569/allow_spaces_around_section_header.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue11027>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com