anatoly techtonik added the comment:

You're right - groups are defined here: 
http://docs.python.org/2/library/re.html#re.MatchObject.group

The need to fix this is to gain internal language consistency, external 
consistency with other major implementations, reduce docs and amount of 
exception to remember, and thus make this part intuitive.


The external inconsistency is that other languages use \0 and don't make 
distinction between "match group" and "substition group". I wonder if there are 
any other differences justify the presence of this distinction? Internal 
inconsistency is in substitution groups notation:

\0 is \x0 but is not \g<0>
\1 is not \x1 but is \g<1>

Let me also put accent that re is a module - not a feature of Python language - 
that provides ability to work with "regular expressions". Evolution led to the 
"best practices" that became unwritten standard in different implementations - 
like using \x for backreferences in replacements. If some library invents its 
own standards that add nothing to the user rather than "another thing to 
remember" [1] then the user is automatically granted the right to wear the sign 
"this library suxx" on her t-shirt.


I'd classify a 'language wart' as an inconsistency in expected behavior, 
independent of the language, where a technical fix is possible, but can not be 
fixed due to backward compatibility concerns. Language independent, because 
single language is by definition "works as documented" and has different 
"features in implementation details".

1. http://php.net/manual/en/types.comparisons.php

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to