[Tutor] Fwd: What's in a name?

Asokan Pichai pasokan at talentsprint.com
Fri Jan 3 10:27:01 CET 2014


On Fri, Jan 03, 2014 at 02:45:04AM -0500, Keith Winston wrote:
> And to beat that poor horse in the same example, my current way of doing
> that would be:
> 
> for alist in "lista", "listb":
>     print(alist, eval(alist))

Since you know both pieces, namely the name of the entity "alist" and its 
actual symbol aka alist, why not do something like:

    Lists = {"lista": lista, "listb": lisb}

and use
    Lists[x] ...

HTH

Asokan Pichai



More information about the Tutor mailing list