Deeply nested dictionaries - should I look into a database or am I just doing it wrong?

Andrew Berg bahamutzero8825 at gmail.com
Sun Jul 31 16:34:22 EDT 2011


On 2011.07.31 02:51 PM, Chris Rebert wrote:
> Less punctuation noise:
> QueueItem.x264.avs.filter.fft3d.ffte
> vs.
> QueueItem.x264['avs']['filter']['fft3d']['ffte']
> 
> It would also make clear that your sets of "keys" are static (unlike
> typical dictionary usage).
I see what Thorsten meant by "named tuple" now. I was thinking of a
tuple with a name:
x = (1,2)
Your usage made me look it up and I see that it means the factory
function in the collections module. I wanted to make things look like
that, but the only way I knew how to do that would've been to a new
create blank class and assign values to its __dict__.
Named tuples look useful; I'll read the docs and see if that will work.

-- 
CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0
PGP/GPG Public Key ID: 0xF88E034060A78FCB



More information about the Python-list mailing list