2013/7/15 Guillem Barba Domingo <[email protected]>
>
> El 15/07/2013 2:16, "Oscar Alvarez" <[email protected]> va
> escriure:
>
> >
> > El 14/07/13 17:20, Cédric Krier escribió:
> >
> >> Hi,
> >>
> >> I would like to submit this poll for this change:
> >>
> >> http://codereview.tryton.org/969002/#msg9
> >>
> >>
> >> kg.convert(1000, gr) == 1
>
The above one is more logical and more object-oriented approach as you
provide the quantity (units and units of measurement) to the method convert.
It would be even more logical if we would have quantity as object and we
could pass it as a single argument:
class Quantity:
def __init__(self, units, uom):
self.units = units
self.uom = uom
Unfortunatily, there is no such a infrastructure on tryton's orm, so the
best we can do is to pass the quantity by two arguments.
> >>
> >> gr.convert(1000, kg) == 1
>
It's kind random and amateurish.
> >>
> >>
> >> Which one is more logical/easy/right?
> >>
> > +1
> >
> > gr.convert(1000, kg) == 1
>
> +1
>
--
Giedrius