➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Scanner class in re module undocumented
类型: Stage:
Components: Documentation Versions: Python 3.2, Python 2.7
process
状态: closed Resolution: rejected
Dependencies: 后续:
分配给: rhettinger 抄送列表: asmodai, benjamin.peterson, effbot, georg.brandl, michael.foord, mrabarnett, rhettinger
优先级: low 关键字:

Created on 2009-02-21 16:56 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (13)
msg82569 - (view) Author: Michael Foord (michael.foord) * (Python committer) 日期: 2009-02-21 16:56
There is a useful Scanner class in the re module which is undocumented.

See:

http://mail.python.org/pipermail/python-dev/2003-April/035075.html
http://www.evanfosmark.com/2009/02/sexy-lexing-with-python/
msg82658 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2009-02-24 04:57
Any opinions on whether this was intended to be exposed?
msg84326 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) 日期: 2009-03-28 19:15
The class is commented as being "experimental", and the interface
probably could use improvement (it's a bit awkward to subclass Scanner),
but since it's been around for so long, I guess enough people will be
using it that we have to keep it that way and document it.

Opinions?
msg84435 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) 日期: 2009-03-29 21:59
I'm sure people are already rely on the intimate details of this class,
so why not?
msg84447 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) 日期: 2009-03-30 00:55
FYI, I did tidy up the class and add a 'scaniter' method when I was
working on issue #2636; it might yet see the light of day if it gets the
go ahead!
msg84907 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) 日期: 2009-03-31 21:11
OK, so we'll wait for that.
msg84914 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2009-03-31 21:19
Whether this should be exposed is up to effbot.  It's his code.  He
knows its limitations and he made the original decision to leave it
undocumented.
msg84930 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) 日期: 2009-03-31 22:03
One of the limitations is that it identifies what matched by using
capture groups, so if the expressions provided contain captures then it
gets confused! :-)

I handled that by 1) rejecting named captures and 2) changing unnamed
captures into non-captures.
msg86794 - (view) Author: Jeroen Ruigrok van der Werven (asmodai) * (Python committer) 日期: 2009-04-29 10:36
So far effbot hasn't said anything about this. So Frederik, was it
intended to be exposed or not?
msg86795 - (view) Author: Michael Foord (michael.foord) * (Python committer) 日期: 2009-04-29 10:39
Whether it was intended to be exposed or not it is known and used - and
therefore we can't change the API without going through the usual
deprecation process. As it is used and useful it should be documented.
msg86796 - (view) Author: Jeroen Ruigrok van der Werven (asmodai) * (Python committer) 日期: 2009-04-29 10:41
OK, clear, then I'll see what I can do.
msg88036 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2009-05-18 16:44
This is very old code, without a mature API.  Will take a look at
competing recipes to see if this is still the best way of doing this. 
Maybe it should return a generator instead of a list.  Perhaps there
should be some checking for re's that don't combine well.  Also, would
like to see it exercised on a number of common parsing tasks to see how
well it holds up.  Better to do this work than to expose what is there
now and get hit with bug reports, feature requests, deprecations, and
cases where is it almost the right tool for the job.
msg88104 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2009-05-20 01:31
Looking back at the original thread, good reasons were expresses for not
documenting this code but just leaving it in as an example.
历史
日期 用户 动作 参数
2022-04-11 14:56:46admin修改github: 49587
2009-05-20 01:31:06rhettinger修改状态: open -> closed
resolution: rejected
dependencies: - Adding a new regex module (compatible with re)
消息: + msg88104
2009-05-18 16:44:43rhettinger修改优先级: low

消息: + msg88036
versions: + Python 2.7, Python 3.2, - Python 2.6, Python 3.0
2009-04-29 12:53:54rhettinger修改assignee: effbot -> rhettinger
2009-04-29 10:41:42asmodai修改消息: + msg86796
2009-04-29 10:39:39michael.foord修改消息: + msg86795
2009-04-29 10:36:54asmodai修改抄送: + asmodai
消息: + msg86794
2009-03-31 22:03:52mrabarnett修改消息: + msg84930
2009-03-31 21:19:46rhettinger修改assignee: benjamin.peterson -> effbot
消息: + msg84914
2009-03-31 21:11:02georg.brandl修改dependencies: + Adding a new regex module (compatible with re)
消息: + msg84907
2009-03-30 00:55:33mrabarnett修改抄送: + mrabarnett
消息: + msg84447
2009-03-29 21:59:33benjamin.peterson修改消息: + msg84435
2009-03-28 19:15:26georg.brandl修改assignee: effbot -> benjamin.peterson

消息: + msg84326
抄送: + benjamin.peterson
2009-02-24 04:57:18rhettinger修改assignee: georg.brandl -> effbot
消息: + msg82658
抄送: + rhettinger, effbot
2009-02-21 16:56:04michael.foord创建