Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2012-06-21 22:32:39 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-06-21 22:32:39 (GMT)
commitfff064652841569436be13670d57842ff58b2893 (patch)
treeda802471e0492c02fcd22baac2ab9d578347a897
parent27f80089032046ce709fb67c0a084980efd83722 (diff)
Cambie el codigo para que se mas prolijo
-rw-r--r--Convert.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/Convert.py b/Convert.py
index a1ef537..bbff36f 100644
--- a/Convert.py
+++ b/Convert.py
@@ -18,16 +18,31 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
class convert():
- def __init__(self, number, uni1, uni2, type_u, ):
+ def __init__(self, number, uni1, uni2, type_u):
super(convert, self).__init__()
- self.list = {"long": {},
- "vol": {},
- "area": {},
- "peso": {},
- "vel": {},
- "time": {}}
+ self.long = {}
+ self.vol = {}
+ self.area = {}
+ self.peso = {}
+ self.vel = {}
+ self.time = {}
+
+ if type_u == "long":
+ self.dic = self.long
+ elif type_u == "vol":
+ self.dic = self.vol
+ elif type_u == "area":
+ self.dic = self.area
+ elif type_u == "peso":
+ self.dic = self.peso
+ elif type_u == "vel":
+ self.dic = self.vel
+ elif type_u == "time":
+ self.dic = self.time
+
+ self.a = number * self.dic[uni1]
- self.a = number * self.list[type_u][uni1]
- return self.a * self.list[type_u][uni2]
+ return self.a * self.dic[uni2]