Whilst having 20+yrs in IT I'm brand new to Python programming...
I'm trying to reference an object in a different class as a lookup...
I have a class which describes items and their prices
I have a class which describes a currency code and a conversion rate
I'm trying to auto-calculate the local price based on currency conversion lookup.
I can't seem to find the best way of linking the two.
Any ideas please?
class Currency(object): def __init__(self, currency, conversion_rate): self.currency = currency self.conversion_rate = conversion_rate def getconversionrate(self, currency): return self.conversion_rate class Stock_Detail(object): def __init__(self, item, cost, local_cost, currency): self.item = item self.local_cost = local_cost self.currency = currency self.cost = self.local_cost * Currency.getconversionrate(self.currency)