mabshoff wrote:
>
>
> On Jan 25, 6:20 am, Jason Grout <[EMAIL PROTECTED]> wrote:
>> mb wrote:
>>> Hello,
>>> Here is a suggestion. The default way to post examples is like so:
>>> sage: s=0
>>> sage: for i in range(100):
>>> ....: s=s+i
>>> ....:
>>> sage: print s
>>> 4950
>>> I would propose a format that makes it easier to cut and paste (into a
>>> file), without having to do it line by line, namely
>>> s=0
>>> for i in range(100):
>>> s=s+i
>>> print s
>> How do you propose separating input and output?
>
> Well, I guess it would only be input ;)
>
>> I think it should be pretty easy to write a function that converts the
>> former form to the latter form. Maybe you can make it a trac ticket?
>
> Don't. "sage:" is already eaten by the preparser (you can try that)
> and the already is a ticket for "....:".
What about the situation the poster describes, where you want to strip
the example down to something you can stick into the file? A function
would be nice to do that:
strip_example("""
sage: s=0
sage: for i in range(100):
....: s=s+i
....:
sage: print s
4950
""")
prints
s=0
for i in range(100):
s=s+i
print s
and then it's easy to copy and paste the example into a file.
-Jason
--~--~---------~--~----~------------~-------~--~----~
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-forum
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---