On Tue, Mar 4, 2008 at 10:25 AM, Martin Albrecht
<[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> It is a known issue, that
>
> {{{
> 1
> 2
> 3
> }}}
>
> in the notebook outputs:
>
> {{{
> 3
> }}}
>
> However, this behavior is not uniform. E.g. this (note the spaces)
>
> {{{
> 1
> 2
> 3
> }}}
>
> outputs
>
> {{{
> 1
> }}}
>
> Most interestingly, this:
>
> {{{
> while True:
> 1
> 2
> 3
> break
> }}}
>
> outputs the desired output
>
> {{{
> 1
> 2
> 3
> }}}.
>
> Another example:
>
> {{{
> while True:
> class Foo:
> def __init__(self):
> pass
> def __repr__(self):
> return "Foo"
> Foo()
> 2
> 3
> break
> }}}
>
> outputs
>
> {{{
> Foo
> 2
> 3
> }}}
>
> The point? William was asking once how to get the intermediate outputs from
> Python and this seems to be an ugly way. I didn't think this through, though.
> Just sharing the observation.
>
That is really weird. I have no idea what is going on above.
By the way, if you put a newline after the class definition -- keeping
all indenting the same,
your trick doesn't work (I discovered this quickly after doing a
sample implementation and
finding it doesn't work):
{{{
while True:
class Foo:
def __init__(self):
pass
def __repr__(self):
return "Foo"
Foo()
2
3
break
}}}
So I just mystified...
William
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---