Help with a reverse dictionary lookup

rh0dium steven.klass at gmail.com
Fri Mar 10 00:51:20 CET 2006


Hi all,

I have a dict which looks like this..

dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']},
'180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']},
'250nm': {'umc': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
['1p6m_2.2-3.5_sal_log', '1p6m_1.8-3.3_sal_ms']}
}

For clarification:
130nm,180nm,250nm refer to Nodes
tsmc,chartered,umc refer to Foundries
1p6m..blah, 2p6m..blah refer to Process

I want a function which can do this:

nodes = getNodes()
  should return a list [130nm,180nm,250nm]

nodes = getNodes(Foundry="umc")
  should return a list [130nm,250nm]

nodes = getNodes(Process="2p6m_1.8-3.3_sal_ms")
  should return a list [180nm,250nm]

nodes = getNodes(Foundry="umc", Process="2p6m_1.8-3.3_sal_ms")
  should return a list [250nm]

nodes = getNodes(Foundry="foo", Process="2p6m_1.8-3.3_sal_ms")
  should return None

Obviously I want to extend this to Each area ( i.e., getFoundry(),
getProcess() ) but I can do that.  I just don't know how to easily do
this reverse kind of look up?  Can someone help me on this?




More information about the Python-list mailing list