<br><div>In calling something "demented" I'm coming off</div><div>the namespace used around genres of cartoon.</div><div><br></div><div>Cartoons I'd consider demented:</div><div><br></div><div>Pinky and the Brain</div>
<div>Ren and Stimpy</div><div>Teenage Aqua Hunger Force (Kevin Altis of PythonCard a fan)</div><div>SpongeBob SquarePants</div><div>...</div><div><br></div><div><br></div><div>(see clips on Youtube for any/all)</div><div>
<br></div><div>Synonyms for demented: zany, surreal</div><div><br></div><div>Relevant: links to "grossology" in EuroPython </div><div>presentation:</div><div><br></div><div><a href="http://www.4dsolutions.net/presentations/connectingthedots.pdf">http://www.4dsolutions.net/presentations/connectingthedots.pdf</a></div>
<div>(see string.Template Mad Libs)</div><div><br></div><div>Likewise, Demented Python serves a didactic function,</div><div>here to remind about the decorator:</div><div><div><br></div><div>def sillystrip( f ):</div><div>
if f.__doc__:</div><div> f.__doc__ = "Your function has been hacked!"</div><div> else:</div><div> f.__doc__ = "You should always have a docstring."</div><div> return f</div><div>
<br></div><div>@sillystrip</div><div>def square( x ):</div><div> """could also be a triangle"""</div><div> return x * x</div><div><br></div><div>def _test():</div><div> frank = 2</div>
<div> joe = square (frank) # frank is kinda square</div><div> print("Hello Joe, Frank here.")</div><div> print(square.__doc__)</div><div> </div><div>if __name__ == "__main__":</div><div>
_test()</div><div> </div></div><div>Usage:</div><div><br></div><div><div>>>> ================================ RESTART ================================</div><div>>>> </div><div>Hello Joe, Frank here.</div>
<div>Your function has been hacked!</div><div><br></div><div>Then comment out the docstring in the def of square.</div><div><br></div><div>>>> ================================ RESTART ================================</div>
<div>>>> </div><div>Hello Joe, Frank here.</div><div>You should always have a docstring.</div></div><div><br></div>