Creating a dictionary key on demand
What I want:
A dictionary that looks something like "SIG":"SIG1,SIG2,SIG3,...,SIG205,SIG206". It's currently called "output_buffers". The things I'm trying to add to it are devices. Each subsystem key has lots of devices.
My current thing that writes to it:
output_buffers[subsystem].append(device)
I do this every time I want to write a new device to the buffer for that particular subsystem.
Do I have to initialise the dictionary explicitly beforehand?
Edit: The language is Python.
Peter
[link|http://www.no2id.net/|Don't Let The Terrorists Win]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Home]
Use P2P for legitimate purposes!
Edited by
pwhysall
April 10, 2006, 06:46:05 AM EDT
Creating a dictionary key on demand
What I want:
A dictionary that looks something like "SIG":"SIG1,SIG2,SIG3,...,SIG205,SIG206". It's currently called "output_buffers". The things I'm trying to add to it are devices. Each subsystem key has lots of devices.
My current thing that writes to it:
output_buffers[subsystem].append(device)
I do this every time I want to write a new device to the buffer for that particular subsystem.
Do I have to initialise the dictionary explicitly beforehand?
Peter
[link|http://www.no2id.net/|Don't Let The Terrorists Win]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Home]
Use P2P for legitimate purposes!
Edited by
pwhysall
April 10, 2006, 06:59:45 AM EDT
Creating a dictionary key on demand
What I want:
A dictionary that looks something like "SIG":"SIG1,SIG2,SIG3,...,SIG205,SIG206". It's currently called "output_buffers". The things I'm trying to add to it are devices. Each subsystem key has lots of devices.
My current thing that writes to it:
output_buffers[subsystem].append(device)
I do this every time I want to write a new device to the buffer for that particular subsystem.
Do I have to initialise the dictionary explicitly beforehand?
Edit: The language is Python.
Peter
[link|http://www.no2id.net/|Don't Let The Terrorists Win]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Home]
Use P2P for legitimate purposes!