[Python-Dev] Proposing PEP 386 for addition

Floris Bruynooghe floris.bruynooghe at gmail.com
Wed Dec 9 13:21:36 CET 2009


On Tue, Dec 08, 2009 at 08:53:18PM -0800, Michael Mysinger wrote:
> Technical question:
> 
> 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+]
> Am I missing something here? You could maybe explain what the pluses mean in the PEP, and why some are inside the [] and others are outside.
> 
> Or a regular expression version like this might be more specific. 
> 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+)?)?

(And hopfully I didn't make a mistake here)

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]+".

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

-- 
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org


More information about the Python-Dev mailing list