data structure

Andrew Zyman formisc at gmail.com
Wed Jun 14 21:36:50 EDT 2017


Hello,
 i wonder what would be a proper data structure for something with the
following characteristics:

id - number,
obj[a..c] - objects of various classes

the idea is to be able to update certain fields of these objects initially
getting access to the record by ID

something like this ( not working )

### code start

class ClassA(object):
    a = ''
    b = ''
    def __init__(self):
        a= 'aa'
        b= 'ab'

class ClassB(object):
    def __init__(self):
        self.c = 'ba'
        self.d = 'bb'

def main():
    obja = ClassA
    objb = ClassB

    sets = set(obja, objb)
    contracts[1] = sets

    print('Sets ', contracts)

# with the logic like ( not working too)
        if obja.a = 'aa':
            contracts[1].obja.a = 'ABC'


 if __name__ == '__main__':
    main()


### code end

appreciate your guidance



More information about the Python-list mailing list