Try this, global()[ lis['a'][1] ]()
or this, lis = { "a": [ getabc, gettuple, getlist ] } lis['a'][1]() On Wed, Dec 7, 2011 at 7:41 PM, Anand Patil <2002an...@gmail.com> wrote: > Hi. > > I have a unique question or may be i am not so perfect at python.Please > help me out > > a, b, c = 0, 0, 0 > def getabc(): > print "hi " > > def gettuple(): > print "hello all" > > def getlist(): > print "bye" > > lis={"a":["getabc","gettuple","getlist"]} > lis['a'][1]() > > why does this fail ? > How to make it work? > On Wed, Dec 7, 2011 at 4:30 PM, <bangpypers-requ...@python.org> wrote: > >> Send BangPypers mailing list submissions to >> bangpypers@python.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> http://mail.python.org/mailman/listinfo/bangpypers >> or, via email, send a message with subject or body 'help' to >> bangpypers-requ...@python.org >> >> You can reach the person managing the list at >> bangpypers-ow...@python.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of BangPypers digest..." >> >> >> Today's Topics: >> >> 1. Re: virtual-python & easy_install doubt (Ashutosh Narayan) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Wed, 7 Dec 2011 14:07:48 +0530 >> From: Ashutosh Narayan <aashutoshnara...@gmail.com> >> To: Bangalore Python Users Group - India <bangpypers@python.org> >> Subject: Re: [BangPypers] virtual-python & easy_install doubt >> Message-ID: >> <cadft7njqxxnefjhios46en-paelejmbpaqdoc8aeuvutf84...@mail.gmail.com >> > >> Content-Type: text/plain; charset=ISO-8859-1 >> >> OK. Giving it a shot then. Thanks ! >> >> On Wed, Dec 7, 2011 at 2:00 PM, Noufal Ibrahim <nou...@gmail.com> wrote: >> >> > Ashutosh Narayan <aashutoshnara...@gmail.com> writes: >> > >> > > Yes, virtualenv is an extension of virtual-python. I can try that as >> > well. >> > > But again my concern is why easy_install is not picking up the virtual >> > > environment that I have set to. Any pointers ? >> > >> > [...] >> > >> > I don't think anyone uses virtual-python anymore. You should use >> > virtualenv. Create an env, then activate it and then use easy_install >> > (or preferably pip) to install packages inside it. >> > >> > There's also a virtualenvwrapper package to help management of >> virtualenvs. >> > >> > -- >> > ~noufal >> > http://nibrahim.net.in >> > >> > She used to diet on any kind of food she could lay her hands on. -- >> Arthur >> > Baer, American comic and columnist >> > _______________________________________________ >> > BangPypers mailing list >> > BangPypers@python.org >> > http://mail.python.org/mailman/listinfo/bangpypers >> > >> >> >> ------------------------------ >> >> _______________________________________________ >> BangPypers mailing list >> BangPypers@python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> >> >> End of BangPypers Digest, Vol 52, Issue 7 >> ***************************************** >> > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers -- Pratap. _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers