[Distutils] RFC : Version comparison

Sridhar Ratnakumar sridharr at activestate.com
Tue Apr 28 02:52:16 CEST 2009


On 09-04-27 05:09 PM, Eric Smith wrote:
>> [Trent]
>>>> Or we could have:
>>>>
>>>>    RationalVersion(...version bits...)
>>>>    RationalVersion.from_string(s)      # this is a @classmethod
>>
>> [Tres]
>>> I would prefer keeping the string version of __init__, with the "I'm in
>>> control, dammit" version reserved for the non-default factory method.
>>
>> I'd tend to agree, but I don't feel strongly about it.
>
> I agree. The more common one will be the string version, it should be
> __init__.

I prefer `from_string` for the following reasons:

   - `__init__` is typically expected to accept object components as 
arguments, rather than a parse-able string.
   - `RationalVersion.from_string('...')` is much more explicit than 
`RationalVersion('...')` and explicit is better than implicit. Besides, 
the standard library has several instances of `from_string`.


More information about the Distutils-SIG mailing list