3 ms·
Just in terms of readability, not functionality, sometimes "attempting to do math in words than symbols" is not such a bad idea. Also, explicit comments within
by photochemsyn 4y ago
Just in terms of readability, not functionality, sometimes "attempting to do math in words than symbols" is not such a bad idea. Also, explicit comments within regular expressions are nice (I notice Perl has this capability too, but perhaps not used as much as it could be)? Such as:
a = re.compile(r"""\d + # the integral part
\. # the decimal point
\d \* # some fractional digits""", re.VERBOSE)
Also, the Python re basic functions - match, search, fullmatch, finditer - return match objects which are not so bad to process, and the other functions - findall, split, sub, subn - are well-documented and easy to interpret. The pattern being used is also clearly separate from the functions that use it, making it easier to understand.
In contrast, Perl regex tutorials are a bit more complex... such as:
https://perldoc.perl.org/perlre https://perldoc.perl.org/perlre
Basically, it seems you can get the same functionality with Python but with a less steep learning curve, and it's easier to read and maintain than Perl.