[Tutor] Shorten Code.
Alexander Etter
rhettnaxel at gmail.com
Fri Nov 18 21:20:17 CET 2011
On Nov 18, 2011, at 13:15, ALAN GAULD <alan.gauld at btinternet.com> wrote:
>
> > > for var in [value,value_1]:
> > > var = "green"
> >
> > Um, that won't work. You typed that example too quickly.
>
> Oops! Yes. You'd need to enumerate and access the variables
> via an index. yuk. Don't do it folks! :-)
>
> Excuse: It was early morning and I hadn't had any coffee...
>
> Alan G.
> ____
In your defense Alan, after you typed that code in your response you mentioned the necessity of defining the variables:
>But you need to have already created the variables >somewhere and unless there is a big list its not usually >worth while.
Alexander Etter
> ___________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111118/898ecbbf/attachment.html>
More information about the Tutor
mailing list