Le 20/09/2015 16:26, Volker Braun a écrit :
Why change the default? Global state is always a liability; Just don't
do it. Make the field a parameter to your code:

def frobnicate(x,y, field=None)
     if field is None:
         from sage.structure.element import get_coercion_model
         field = get_coercion_model().common_parent(x, y)
     x, y = field(x), field(y)
     ...

frobnicate(1, 2, field=RealField(100))

--
You received this message because you are subscribed to the Google
Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sage-devel+unsubscr...@googlegroups.com
<mailto:sage-devel+unsubscr...@googlegroups.com>.
To post to this group, send email to sage-devel@googlegroups.com
<mailto:sage-devel@googlegroups.com>.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Ok...
The origin of the discussion was: I have a code, translated from C, where a I want to be able to increase the precision of the float constants (there are many of them -about 400!-), as the problem is ill conditioned.... David Roe proposed to patch the parser.

Without changing the default precision, and using your solution, we revert to something where we must "declare" the float values:
x=field(137.8)
in place of
x=137.8
My principal motivation was lazyness :-)
But ok, I understand your argument; and also, patching the parser is not very smart programing...

t.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

<<attachment: tdumont.vcf>>

Reply via email to