David Harvey wrote: > On Jul 12, 2008, at 1:22 PM, Mats wrote: > >> Clarification: I would like fast ints&reals, with 2/3=0.6666, and not >> 2/3=0, but I cannot figure out how to do this in notebook mode. > > Hi Mats, > > If you build from source, you can apply the attached patch file to > get future division *everywhere* in the notebook. > > This is an ugly hack though, and won't go into Sage as is. > > For a permanent solution, one possibility is to add a "% > futuredivision" command that you could enter at the top of the cell. > The problem is, under the current framework, this would only affect > that cell, which is probably not what you want.
I think that if you did an import, something like in your patch, it would affect all calculations after that. So if you implemented a %futuredivision percenterator (David's term, not mine :), then it would break the convention that %thingy only affects the current cell. There aren't any > other "%thing" commands currently that affect *everything* in the > notebook. So architecturally, I'm not sure how we would deal with > this. There was a brief discussion in IRC a few minutes ago. > > You won't get the "from __future__ import division" statement working > in a notebook cell, because that needs to appear at the top of a > script (see http://www.python.org/dev/peps/pep-0236/), and affects > the parser itself, it's not an ordinary import statement. The > notebook prepends a bunch of stuff to the notebook cell input before > it gets passed to python. > > david > > > > > > > ------------------------------------------------------------------------ > > > --~--~---------~--~----~------------~-------~--~----~ 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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
