Python riddle

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Dec 7 06:12:10 EST 2005


On Mon, 05 Dec 2005 22:58:42 -0800, Dan Bishop wrote:

>>>> class CapOutput:
> ...    def __init__(self, fileobj):
> ...       self._file = fileobj
> ...    def write(self, text):
> ...       self._file.write(text.capitalize())
> ...
>>>> sys.stdout = CapOutput(sys.stdout)
>>>> print 'why?'
> Why?


That's ... brilliant. Brilliant and evil.

But mostly evil.


*grin*


-- 
Steven.




More information about the Python-list mailing list