Kenneth Lin <[email protected]> writes:

> Hey Sage,
>
> So I'm trying to make a really long function that I wanted to put on
> multiple lines to look nice. However, Sage's backslash preprocessing,
> combined with the preprocessing of making functions, doesn't allow me
> to do this:
>
> sage: botrk(h0_prime, a0, s0, c0) = h0_prime / ceil(log(20 * (a0 +
> 25) / (h0_prime + 20 * (a0 + 25)), 0.95)) *   
>   File "<ipython-input-51-0e90997af202>", line 1
>     __tmp__=var("h0_prime,a0,s0,c0"); botrk = symbolic_expression
> (h0_prime / ceil(log(Integer(20) * (a0 + Integer(25)) / (h0_prime +
> Integer(20) * (a0 + Integer(25))), RealNumber('0.95'))) *).function
> (h0_prime,a0,s0,c0)
>                                                                      
>                                                                      
>                                                   ^
> SyntaxError: invalid syntax
>
> sage: botrk(h0_prime, a0, s0, c0) = h0_prime / ceil(log(20 * (a0 +
> 25) / (h0_prime + 20 * (a0 + 25)), 0.95)) * \
>   File "<ipython-input-52-fe3774a6c1a7>", line 1
>     __tmp__=var("h0_prime,a0,s0,c0"); botrk = symbolic_expression
> (h0_prime / ceil(log(Integer(20) * (a0 + Integer(25)) / (h0_prime +
> Integer(20) * (a0 + Integer(25))), RealNumber('0.95'))) *  *
> BackslashOperator() * ).function(h0_prime,a0,s0,c0)
>                                                                      
>                                                                      
>                                                     ^
> SyntaxError: invalid syntax
>
>
> Does anyone know more about this? If there's planning to be a patch
> to fix this, or I'm doing something wrong, or otherwise? If it's an
> easy fix I'd be down to help fix it.

I would guess this is a bug in the preparser, but in any case,
backslash-based line continuations are frowned upon in Python (and in
Sage). Instead of

    f(x) = x + \
           y

you should use

    f(x) = (x +
            3)

Sadly, this seems to be broken in the preprocessor as well, so I don't
know what to tell you...

-Keshav

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to