Re: Python riddle

2005-12-07 Thread Steven D'Aprano
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?

Re: Python riddle

2005-12-05 Thread Dan Bishop
kyle.tk wrote: > SPE - Stani's Python Editor wrote: > > I know that this code is nonsense, but why does this print 'Why?' > > > > a = 1 > > if a >2: > > try: > > 5/0 > > except: > > raise > > else: > > print 'why?' > > last time i checked this should print 'why?' > I hav

Re: Python riddle

2005-12-05 Thread kyle.tk
SPE - Stani's Python Editor wrote: > I know that this code is nonsense, but why does this print 'Why?' > > a = 1 > if a >2: > try: > 5/0 > except: > raise > else: > print 'why?' last time i checked this should print 'why?' I have no idea how you got it to print 'Why?'

Re: Python riddle

2005-12-05 Thread Daniel Schüle
SPE - Stani's Python Editor wrote: > I know that this code is nonsense, but why does this print 'Why?' > > a = 1 > if a >2: > try: > 5/0 > except: > raise > else: > print 'why?' > because 1 is not greater than 2 I suppose :) -- http://mail.python.org/mailman/listinf

Re: Python riddle

2005-12-05 Thread SPE - Stani's Python Editor
Forget it, it's not 1st of april yet. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python riddle

2005-12-05 Thread ech0
1 is not greater then 2 last time i checked :) -- http://mail.python.org/mailman/listinfo/python-list

Python riddle

2005-12-05 Thread SPE - Stani's Python Editor
I know that this code is nonsense, but why does this print 'Why?' a = 1 if a >2: try: 5/0 except: raise else: print 'why?' -- http://mail.python.org/mailman/listinfo/python-list