On Thu, Apr 13, 2017 at 10:13 PM, Colin Watson <[email protected]> wrote:
> On Thu, Apr 13, 2017 at 09:15:08PM +0100, Alex Kavanagh wrote: > > So instead of: > > > > if ubuntu_version > 'trusty': > > > > We do: > > > > cmp_version = CompareHostReleases(ubuntu_version) > > if cmp_version > 'trusty': > > > > This version of the code checks that ubuntu_version and 'trusty' strings > > are known releases and makes it easy to fix existing code. >, <, >=< <=, > > ==, != are all supported. > > I have déjà vu: I did exactly the same thing in lp:ubuntu-cdimage in > 2012. :-) I agree that this style makes things pretty nice for calling > code. > > The one problem I've had with it is that every so often somebody looks > at a bit of code and says "hey, isn't this going to break after 17.04?" > and then I have to explain that it's actually magically OK, which as > problems go is not really a bad one to have. > Good to know that I'm not totally going out on a limb with this approach! There was some criticism of leaving is as >, <, etc., the alternatives just seemed really clunky. There is the downside that people could miss it, but there wasn't a reasonable way of stopping people just using a regular string comparison. Thanks for the feedback / confirmation! > > -- > Colin Watson [[email protected]] > > -- > Juju mailing list > [email protected] > Modify settings or unsubscribe at: https://lists.ubuntu.com/ > mailman/listinfo/juju > -- Alex Kavanagh - Software Engineer Cloud Dev Ops - Solutions & Product Engineering - Canonical Ltd
-- Juju mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju
