Bizzare lst length problem

Ben Benjamin.Barker at gmail.com
Sun Oct 8 07:12:02 EDT 2006


Hello...hopefully my last question :-)

I ave a dictionary, where each value is a class instance. I access it
using:

for k, v in self.panels.panel_list.items():
                print "Number:\t",v.number
                print "Level:\t",v.level
                print "Location:\t",v.location
                print "MOPS:\t",v.mops
                print "List length:\t",len(v.mops)
                print "Matrix:\t",v.matrix,"\n\n"

The output from this would be (for a given key value):
                Number:	181
                Level:	ovride+supvis
                Location:	 mons=4 v8.0 3rd floor
                MOPS:	['287', '288', '289', '290']
                List Length:	28
                Matrix:	kng

This is really odd...my len(v.mops) ought to return 4 (4 elements in
the list). In fact it returns 28. looking at outputs from lots of
records, it seems that the length is almost always 7 time too great
(28/7=4)....but not always. This is really confusing...can anyon
suggest what is going on?

I've been trying to output the list elements as a string with equally
limmited success, but the thing seems so simple I can't see where the
prblem might lie....

Cheers,

Ben




More information about the Python-list mailing list