April 3, 2011
9:39 a.m.
On 04/02/2011 02:16 PM, kirby urner wrote:
Likewise, Demented Python serves a didactic function, here to remind about the decorator:
def sillystrip( f ): if f.__doc__: f.__doc__ = "Your function has been hacked!" else: f.__doc__ = "You should always have a docstring." return f
@sillystrip def square( x ): """could also be a triangle""" return x * x
def _test(): frank = 2 joe = square (frank) # frank is kinda square print("Hello Joe, Frank here.") print(square.__doc__)
if __name__ == "__main__": _test()
Did you see the PyCon2011 video on obfuscating python? http://blip.tv/file/4881220 -- Corey Richardson