Hi Nick, On 10/4/07, Nick Alexander <[EMAIL PROTECTED]> wrote: > > On Thu, 2007-10-04 at 09:50 -0400, William Stein wrote: > > On 10/4/07, Georg Muntingh <[EMAIL PROTECTED]> wrote: > > > Indeed, that's great! What about adding an exclamation mark to the end > > > of the function you want to edit, so writing for instance "factor!" to > > > edit the source code of the function "factor"? Or is too easily > > > confused with the factorial? > > > > I think it is worth considering doing something like this, as a sort of > > analogue of foo? and foo?? for help and source code. > > I wanted to do this for IPython, but my thread with Fernando died way > back when. I suggest foo???. I often type x?, UP ? (giving x??), and > the natural one yields x???.
Sorry about that, I fell badly behind on email a few months ago, and missed a few threads (both here and on the ipython lists). I'm not sold on the ??? syntax, because I think it's starting to get a bit heavy, and also because I tend to prefer *less* special syntax rather than more. These special, one-off syntaxes require special code to handle them, because something like this isn't just a simple pattern. For example, originally the special markers were only allowed at the beginning of a line, where they are easy to detect with a simple dispatch table. But '?' is uniquely also allowed at the end, and you can also do ?foo? <-> ??foo <-> foo?? If we allow three, do we allow all combinations? Just at the end? (which would break the existing dispatch rules). One at the start and two at the end? Basically, I tend to prefer a few simple rules that can be applied consistently. The current one was to use the special ESC_* markers as a dispatch table: In [1]: __IP.ES __IP.ESC_HELP __IP.ESC_PAREN __IP.ESC_QUOTE2 __IP.ESC_SH_CAP __IP.ESC_MAGIC __IP.ESC_QUOTE __IP.ESC_SHELL and to fire a handler registered for each of these escapes if detected as the first character. The '?' was special-cased simply because it is way too convenient not to, but I'd like to keep such special-casing to a minimum, so the overall model doesn't spiral into a spaghetti dish too fast. But I also appreciate practicality, so if there's an overriding wish for this or someone has a different perspective, I'm all ears. Cheers, f --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---
