[issue27177] re match.group should support __index__

2016-06-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker

[issue27177] re match.group should support __index__

2016-06-18 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0303ab246152 by Serhiy Storchaka in branch 'default': Issue #27177: Match objects in the re module now support index-like objects https://hg.python.org/cpython/rev/0303ab246152 -- nosy: +python-dev ___

[issue27177] re match.group should support __index__

2016-06-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Interesting. This is very unusual but reasonable use case. -- assignee: -> serhiy.storchaka ___ Python tracker ___

[issue27177] re match.group should support __index__

2016-06-18 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: My use case is SageMath: http://trac.sagemath.org/ticket/20750 -- ___ Python tracker ___

[issue27177] re match.group should support __index__

2016-06-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is the use case? -- ___ Python tracker ___ ___ Python-bugs-list

[issue27177] re match.group should support __index__

2016-06-15 Thread Xiang Zhang
Xiang Zhang added the comment: Attach a patch to add this feature to Py3.6. -- nosy: +xiang.zhang Added file: http://bugs.python.org/file43396/issue27177.patch ___ Python tracker

[issue27177] re match.group should support __index__

2016-06-02 Thread Matthew Barnett
Matthew Barnett added the comment: It would be a bug if it was supported but gave the wrong result. It has never been supported (the re module predates PEP 357), so it's a new feature. -- ___ Python tracker

[issue27177] re match.group should support __index__

2016-06-02 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: I would still argue that it's a bug. The intention of PEP 357 is that __index__ should be used whenever some object needs to be converted to a Py_ssize_t, which is exactly what you do here. -- ___ Python tracker

[issue27177] re match.group should support __index__

2016-06-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This looks as new feature and can go only in 3.6. -- nosy: +serhiy.storchaka stage: -> needs patch type: -> enhancement versions: +Python 3.6 -Python 2.7 ___ Python tracker

[issue27177] re match.group should support __index__

2016-06-01 Thread Jeroen Demeyer
New submission from Jeroen Demeyer: ``` >>> class zero(object): ... def __index__(self): ... return 0 ... >>> z = zero() >>> import re >>> p = re.compile('(a)b') >>> m = p.match('ab') >>> m.group(0) 'ab' >>> m.group(z) Traceback (most recent call last): File "", line 1, in