[issue31969] re.groups() is not checking the arguments

2017-11-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue31969] re.groups() is not checking the arguments

2017-11-08 Thread Matthew Barnett
Matthew Barnett added the comment: @Narendra: The argument, if provided, is merely a default. Checking whether it _could_ be used would not be straightforward, and raising an exception if it would never be used would have little, if any, benefit. It's not a bug, and it's not worth changing.

[issue31969] re.groups() is not checking the arguments

2017-11-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, it should not throw error that there is no any optional match. It is not easy to check if there is optional match. For example, the pattern '(a)|(b)' contains optional matches, while the group in the pattern '()?' always matches. -- __

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra
Narendra added the comment: Hi Storchaka, As per re.groups(), its should work as below: groups([default]) Return a tuple containing all the subgroups of the match, from 1 up to however many groups are in the pattern. The default argument is used for groups that did not participate in the mat

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is nothing wrong with this output if you use the first example. -- ___ Python tracker ___

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: All work as designed. In your example you don't see a difference because all groups are defined. Look at other example: >>> import re >>> m = re.match(r'(?:(\w+)@)?(\w+)\.(\w+)', 'hackerrank.com') >>> m.groups() (None, 'hackerrank', 'com') >>> m.groups(1) (1

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra
Narendra added the comment: Please look in to the following example: >>> m.groups() ('narendra', 'happiestmidns', 'com') >>> m.groups(1) ('narendra', 'happiestmidns', 'com') >>> m.groups(34) ('narendra', 'happiestmidns', 'com') >>> m.groups(10

[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra
New submission from Narendra : Hi Team, I have observed a bug in re.groups() function behavior in Python as below: Issue: re.groups() is not validating the arguments Example: >>> m = re.match(r'(\w+)@(\w+)\.(\w+)','usern...@hackerrank.com') >>> m.groups() ('username', 'hackerrank', 'com') >>>