python - Getting TypeError when instantiating class with a base class -


i'm using pint play unit conversions, , trying inherit 1 of pint's quantity classes make ingredient class. works fine when have argument in __init__ definition, typeerror:

# how docs initialize quantity class pint import unitregistry  ureg = unitregistry() quantity = ureg.quantity  class ingredient(quantity):     def __init__(self, name=none, quantity=0, units=none):         super(ingredient, self).__init__(quantity, units)         self._name = name   = ingredient('milk', 3, 'cups') 

this produces following error:

traceback (most recent call last):   file "c:\pathtofile\myfile.py", line 14, in <module>     = ingredient('milk', 3, 'cups') typeerror: __new__() takes @ 3 arguments (4 given) 

i'm assuming it's because quantity requires 2 arguments default not sure. if terminology off, please feel free correct me


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -