On Tue, Apr 28, 2009 at 1:25 AM, Trent Mick <trentm@gmail.com> wrote:
[Tarek]
Sounds good, I'd be in favor of making RationalVersion using explicit version bits, and having some kind of function:
str2version(somestring) -> RationalVersion instance
[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.
Tarek, Why would you prefer the default constructor argument be the version bits form.
The example that came in mind to me was datetime, that uses the bits in the constructor, plus provides conversion function or class methods to handle the string form: datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) So like Sridhar, I'd rather have an detailed constructor. I'm 0- on Tres proposal though, because the string form will be the most used form. Cheers Tarek