[Python-Dev] Proposing PEP 386 for addition

Michael Mysinger cybersol at yahoo.com
Thu Dec 10 06:41:01 CET 2009

Floris Bruynooghe <floris.bruynooghe <at> gmail.com> writes:

> On Tue, Dec 08, 2009 at 08:53:18PM -0800, Michael Mysinger wrote:
> > I don't know what notation this versioning schema was trying for, especially
in regards to what the +'s mean:
> > N.N[.N]+[abc]N[.N]+[.postN+][.devN+]
> > 
> The full regex (stripped from named groups) is the rather unreadable:
> \d+\.\d+(\.\d+)*([abc]?\d+(\.\d+)*)?((\.post\d+)?(\.dev\d+)?)?

The ()? around the combination of post and dev is not needed. I also think
[abc]? should just be [abc], as one letter is required to proceed the digit in
that case, and the full regular expression does help to distinguish exactly
which of those two is required by the PEP. 

> So the '+' in the pseudo notation above roughly means "one or more"
> with the brackets meaning "zero or one" so plus and brackets combined
> result into "zero or more".  But even then it's might be missing
> square brackets around the whole of "[abc]N[.N]+".

What is confusing about the +'s is that they are not consistent. If your regular
expression with my modifications above is right, then using the substitions 'N
for \d+', '{} for []', '[] for ()?' and '+ for *' leaves:


Notice that the last two +'s are gone, and overall I think this is more
consistent psuedo-code.   
> Note that the meaning of the contents of the brackets changes too
> ("abc" is a choice, .postN+ is the recursive notation) so it'll
> probably never work exactly.  So maybe the PEP should also include the
> full regex for exactness.
> Regards
> Floris

Yes, it probably should have the full regex for absolute clarity, and it can
still have some type of psuedo-code for easier reading, but inconsistent
psuedo-code just adds confusion instead of simplification.


More information about the Python-Dev mailing list