cy99 / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

re.findall not compatible with CPython #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When a group is defined in a pattern, re.findall returns matches instead
the group.

e.g. 
re.findall("ab (cd) ef", "ab cd ef gh")

CPython returns: ['cd']
Shedskin executable returns: ['ab cd ef']

Shedskin verison: 0.0.28

Original issue reported on code.google.com by avibe...@gmail.com on 8 Sep 2008 at 1:45

GoogleCodeExporter commented 8 years ago
thanks for reporting!

because the return type of findall can be either a list of strings or a list of
tuples, depending on regular expression, it cannot be fully supported. 

I modified the warning message, to be clear about groups not being supported.

the single-group case could work, I guess, as the return type is still a list of
strings, but I won't fix this myself. 

Original comment by mark.duf...@gmail.com on 8 Sep 2008 at 7:12

GoogleCodeExporter commented 8 years ago
note that finditer should work fine, as it always returns match objects..

Original comment by mark.duf...@gmail.com on 13 Sep 2008 at 8:04

GoogleCodeExporter commented 8 years ago

Original comment by mark.duf...@gmail.com on 13 Sep 2008 at 8:04

GoogleCodeExporter commented 8 years ago
okay, I don't think anyone is going to fix this based on the issue.. let's just 
wait
until someone runs into the warning and decides to fix the single-group case.. 

Original comment by mark.duf...@gmail.com on 16 May 2010 at 5:45