SPE - Stani's Python Editor wrote:[color=blue]
> 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?'
>[/color]
SPE - Stani's Python Editor wrote:[color=blue]
> 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?'[/color]
last time i checked this should print 'why?'
I have no idea how you got it to print 'Why?'
kyle.tk wrote:[color=blue]
> SPE - Stani's Python Editor wrote:[color=green]
> > 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?'[/color]
>
> last time i checked this should print 'why?'
> I have no idea how you got it to print 'Why?'[/color]
[color=blue][color=green][color=darkred]
>>> class CapOutput:[/color][/color][/color]
.... def __init__(self, fileobj):
.... self._file = fileobj
.... def write(self, text):
.... self._file.writ e(text.capitali ze())
....[color=blue][color=green][color=darkred]
>>> sys.stdout = CapOutput(sys.s tdout)
>>> print 'why?'[/color][/color][/color]
Why?
Comment