On Monday, July 30, 2012 10:31:49 AM UTC-7, Nils Bruin wrote:
>
> In python there is the concept of a "module" as well as a class. 
> Modules can do that much better. 
>

The pattern Samuel suggests shows up several places in Sage, such as for 
examples of graphs and posets.  I'm doing something similar for groups at

http://trac.sagemath.org/sage_trac/ticket/13115

which I should probably rethink and retool slightly in light of Nils' 
comments (thanks, Nils).

Then the thing to do would be to write

my_functions = <full/relative name of the module with the functions>

A small amount of experimenting suggests this approach is very compatible 
with tab-completion, which is one of the main features of building such a 
collection.  However, tab-completion exposes some irrelevant module-level 
cruft, like anything that gets imported at the top of the module (eg ZZ, 
say).  So the module would need to be fairly "clean" I'd think, with *just* 
the desired functions, though a module-level docstring is a nice thing to 
employ.

Where should the statement defining  my_functions  go?  Someplace at a 
level above the module itself?  In the  all.py  at that level?

Rob
 

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to