forked from divyagiridhar/SE-HW-Trial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCols.py
31 lines (26 loc) · 776 Bytes
/
Cols.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from Sym import Sym
from Num import Num
def push(t, x):
t[1 + len(t)] = x
return x
class Cols:
def __init__(self, names):
self.names=names
self.all=[]
self.klass=None
self.x=[]
self.y=[]
for c, s in names.items():
if s.isupper():
Num(c, s)
col = push(self.all, (c, s))
if s.islower():
Sym(c, s)
col = push(self.all, (c, s))
if not s.find(':'):
if s.find('+' or '-'):
self.y.append(col)
else:
self.x.append(col)
if s.find('!'):
self.klass = col