[Tutor] dynamic attribute assignment

Alan Gauld alan.gauld at btinternet.com
Fri Sep 7 09:10:31 CEST 2007


"John" <washakie at gmail.com> wrote

>>>>vars.var3
> ['a','b','c']
>
> This is great, I had no idea! However, is there then a way to 
> reassign or
> update the values? For instance, can you say:
>
>>>>vars.var1='some new text'

Why not try it at the >>> prompt?

Thats the great thing about python, its very easy to try things like
that out and get a definitive answer! (Even faster than posting to
a mailing list! :-)

In this case its a yes...


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list