On Sun, Jun 23 2013,Alan Gauld wrote:

[snipped 21 lines]

> But we normally call methods via the object instance rather than the
> class so simplifying this further we get:
>
> b['a'].append('c')
>

Thanks for the detailed explanation.

I've sort of used a dict of this sort {'a': [1,2,'fff'] } in my
programs and I've noticed that I've got to unpack the list with
hardcoded list positions when I retrieve the value of a key.

I think I'd be better off, if I did something of

{'a' : ['foo': 1, 'bar':2, 'offset': 'fff'] }

wouldn't that be better from a maintainability POV?  Are there any
examples of such?  Or is there a 'struct' option for python?  I don't
want to use OO methods for now.


 sivaram
 -- 

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to