[BangPypers] magic in datetime module?

Anand Balachandran Pillai abpillai at gmail.com
Fri Apr 3 08:56:40 CEST 2009


On Fri, Apr 3, 2009 at 12:21 PM, Anand Chitipothu <anandology at gmail.com>wrote:

> > I have a basic doubt - why do you want to set a module as core
> > as __builtins__ to {} in your code ? If you can answer that
> > reasonably, it makes sense to investigate this or raise a bug.
> > Otherwise, I don't think it is good coding.
>
> It is used in web.py templating engine to restrict the available
> builtins to templates.


   web.py is a great framework, but this is bad coding for sure.
  I guess you need to do some hack like,

    oldbuiltins=__builtins__
    __builtins__ = {}

   Then before calling code that breaks,
    __builtins__ = oldbuiltins

     <call breaking code here>

 But this is damn ugly and if it were me, I would investigate other
 options whch doesn't force me to put __builtins__ to {} in my
 code. I don't know details enough to advise you on this
 specifically in this case.


>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
-Anand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090403/30cf111e/attachment-0001.htm>


More information about the BangPypers mailing list