Hi Carl! On Sun, Mar 15, 2009 at 06:11:52AM -0700, Carl Witty wrote: > > On Sat, Mar 14, 2009 at 11:42 PM, Nicolas M. Thiery > <nicolas.thi...@u-psud.fr> wrote: > > In fact, I'd love to be able to do: > > > > from SymmetricFunctions(QQ).shorthands import * > > > > Furthermore, providing the user with (optional but easy to load) > > shorthands promotes their standardization among all users. This makes > > it much easier for them to share worksheets / little calculations / ...
> How about this syntax instead? > %open SymmetricFunctions(QQ).shorthands > The leading '%' makes it clear that something strange is going on here. Yes, thanks for the suggestion! Or maybe: %from SymmetricFunctions(QQ) import shorthands for consistency: the user just needs to know one synta× for imports, and to remember that, here, this is a pseudo import from something which is not actually a module. > we don't want to introduce more subtle differences between the > command line and the library syntax. +10 Well, let's just keep this in the back of our head for the moment. Being able to do S = SymmetricFunctions(QQ).shorthands, and then S.s(...) + S.h(...) is already pretty good. Cheers, Nicolas PS: Warning: geek discussion for the fun and the curiosity. It is not required for the main discussion. > > from SymmetricFunctions(QQ).shorthands import * > > > Unfortunately, this can't work -- that's a syntax error in Python, and > I don't think there's any standard way to get the functionality you > want. The syntax error comes from the (). Otherwise one can do some wicked tricks like: sage: from bla import * --------------------------------------------------------------------------- ImportError Traceback (most recent call last) ... ImportError: No module named bla sage: class bla: ... x = 1 ... y = 2 ... z = 3 ... sage: sys.modules['bla'] = bla sage: from bla import * sage: x 1 sage: y 2 sage: z 3 sage: So maybe the door is not completely closed for some horrible (but well localized) hack around :-) Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---