Dictionaries -- ahh the fun.. (newbie help)
Gerard Flanagan
grflanagan at yahoo.co.uk
Wed May 10 04:33:46 EDT 2006
rh0dium wrote:
> Hi all,
>
> Can someone help me out. I am trying to determing for each run whether
> or not the test should pass or fail but I can't seem to access the
> results ..
>
> Alternatively can someone suggest a better structure ( and a lesson as
> to the reasoning ) that would be great too!!
>
> cells={}
>
> cells["NOR3X1"]= {
> 'run' : [ 'lvs', 'drc' ],
> 'results' : [{ 'lvs' : 'pass' },
> { 'drc' : 'fail' }]
> }
>
> cells["OR3X1"] = {
> 'run' : [ 'lvs' ],
> 'results' : [{ 'lvs' : 'pass' }]
> }
>
> cells["AND3X1"] = {
> 'run' : [ 'drc' ],
> 'results' : [{ 'drc' : 'fail' }]
> }
>
>
other suggestions:
cells={
"NOR3X1": {
'pass' : ['lvs'],
'fail' : ['drc']
},
"OR3X1" : {
'pass' : ['lvs'],
'fail' : []
},
"AND3X1" : {
'pass' : [],
'fail' : ['drc']
}
}
cells2={
"NOR3X1": [ ('lvs',1), ('drc', 0) ],
"OR3X1" : [ ('lvs', 1) ],
"AND3X1" : [ ('drc',0) ]
}
class cell(object):
def __init__(self, id, passes=None, fails=None):
self.id = id
self.passes = passes or []
self.fails = fails or []
Gerard
More information about the Python-list
mailing list