mercredi 5 août 2015

A better design pattern for this code in python?

I am new in Python and I developed some code. But was thinking if this is good design for this code or Is there a scope for improvement?. I am really in need for some suggestion. Original code is bigger this is just some partial code. Thanks a lot in advance.

# file: price_validation
class price_validation:

  STATE = []

  def __init__(self, net_amount, max_price, min_price):
    self.net_amount=net_amount
    self.max_price=max_price
    self.min_price=min_price

  def Procurement_Price_Max_Procurement_Price(self):
     if self.max_price is not None and self.max_price >= self.net_amount:
        price_validation.STATE=True
        return price_validation.STATE
     else:
        data_validation.STATE=False
        return price_validation.STATE



# file: DB_validation

from price_validation import price_validation

class DB_validation:
  def __init__(self):
     self.price = price_validation(net_amount=2000, max_price=4000,  
                                                           min_price=1000)

  def price_check(self):
      self.price.Procurement_Price_Max_Procurement_Price()

if __name__ == "__main__":
   db_check=DB_validation()
   db_check.price_check()

Aucun commentaire:

Enregistrer un commentaire