On Fri, Jan 15, 2010 at 4:03 PM, Noufal Ibrahim <nou...@gmail.com> wrote:
> On Fri, Jan 15, 2010 at 4:00 PM, Baishampayan Ghose <b.gh...@gmail.com > >wrote: > > > > It is a clever hack, taking advantage of the nature of the data. But > > > it is far more faster than the other approaches posted here. > > > > I thought eval was evil :) > > > > Given that the OPs data is fixed, eval is okay. :) > > Otherwise, it could be evil or unreliable (eg. => inside some of the data > strings etc.) > My sentiments are the same. As long as you are sure of the safety of your data such as absence of %s etc which could cause security issues, eval is safe. It can often be used for quick short-cuts such as the one above. I started off with a regular expression solution first, but after I observed that the pattern fits a recursive dict, changed tack. Btw "eval" is spelled e-v-a-l, not e-v-i-l :) > > -- > ~noufal > http://nibrahim.net.in > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- --Anand _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers