dictionary sub-value lookup

Dan Parisien dan at eevolved.com
Wed Feb 7 12:41:51 EST 2001


Richard wrote:

> Hi
> 
> I am kinda new to this whole object orientation thing, so
> there is probably an easy way of doing this, but the
> tutorials etc are sparse.
> 
> I have an object M which contains N dictionaries. Inside
> dictionary N, is an identifier, Y, plus various other
> values, eg: Z.... is it possible to find M.Y.Z without
> looping through the whole of M, checking Y each time ?
> 
> Since I will have to do a LOT of this, and M may be large,
> I need a fast method.
> 
> Ideas/comments etc ?
> 
> -Bye
> -Richard

What problem are you trying to solve? There may be simpler ways to do it... 
that sounds incredibly complex. You could always have a dictionary that 
contains
{"dictionary_names":dict}
and do
M[N].Y.Z

does this help?
Dan



More information about the Python-list mailing list