I constructed a class:
class Foo (object):
def __init__(self,List):
self.List=List
@property
def numbers(self):
L=[]
for i in self.List:
if i.isdigit():
L.append(i)
return L
@property
def letters(self):
L=[]
for i in self.List:
if i.isalpha():
L.append(i)
return L
>>> inst=Foo(['12','ae','45','bb'])
>>> inst.letters
['ae', 'bb']
>>> inst.numbers
['12', '45']
How can I add attributes so I could do inst.numbers.odd that would return ['45']?