On Sep 5, 2:03 pm, William Stein <wst...@gmail.com> wrote:
> You could also just define your own wrapper for the show command,
> i.e., your own function called "show" (or even "sh"), and set
> additional options there.   Check out the *args and **kwds support in
> Python.

Wrapping is probably the cleanest and most advisable options. However,
Python's extremely dynamic nature actually makes it possible to change
the defaults on the fly. Tricks like this should probably void any
warranty, if you had any to begin with:

sage: V=Poset({Integer(0):[Integer(2)],Integer(1):
[Integer(2)],Integer(2):[Integer(3)],Integer(3):[]})
sage: L=list(V.show.im_func.func_defaults)
sage: L[5]='orange'
sage: V.show.im_func.func_defaults=tuple(L)

After this you basically have accomplished the same thing that a
source change would do -- but only for the remainder of this session.
If you now do "V.show()" you'll have orange vertices (the 5 comes from
the fact that 'vertex_color' is the 6th keyword argument in the
definition of V.show).

Again, I don't think you'd want to advertise a technique like this to
students, so go with the wrapper.

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

Reply via email to