[Tutor] Dict of Dict with lists

Kai Bojens kb at kbojens.de
Wed Apr 25 14:46:12 EDT 2018


On 25/04/2018 –– 18:35:30PM +0100, Alan Gauld via Tutor wrote:
> > ...
> >     for line in logfile:
> >         result = pattern.search(line)
 
> Doesn't this overwrite your data structure?
> I would strongly advise using another name.

You are of course right. I accidentally shortened this name as I was trying to
fit my code into 80 characters width of this mail. That was sloppy ;) 
 
> However personally I'd use a class to define tyour data structure and
> just have a top leveldictionary holding instances of the class.

You are right (again). I haven't thougt of using classes, but that's exactly
what they were invented for. Thanks for pointing that out. 

Thanks for the help!


More information about the Tutor mailing list