On Thu, Jul 17, 2008 at 2:52 PM, John H Palmieri <[EMAIL PROTECTED]> wrote:
>
> This is probably a stupid question: Is there a way to hide or delete a
> method for a class?  If I do this:
>
> class SteenrodAlgebra(Algebra):
>     blah
>     blah
>
> then do
>
>    A = SteenrodAlgebra()
>
> then A has inherited all of the methods from the Algebra class, many
> of which are useful, but some of which are completely irrelevant
> (e.g., the 'variable_name' method).  It might be nice if I could
> define the class SteenrodAlgebra so as to hide (or remove) those
> methods, so that 'A.<tab>' doesn't display them as possibilities. (I'm
> trying to think of this from the point of view of beginning users who
> might be overwhelmed by the long list of options when they try to tab-
> complete.)
>
> So, is there any way to do this, or am I stuck with these methods once
> I define SteenrodAlgebra in terms of the Algebra class?

I don't know of an easy way to hide a particular method, but you can
control what things get tab completed by defining a trait_names
method:

sage: class Foo(object):
....:     def trait_names(self):
....:         return ['a','b','c','d']
....:
sage: a = Foo()
sage: a.
a.a            a.b            a.c            a.d            a.trait_names

As a user, I don't know whether or not I would prefer a "customized"
tab completion.

--Mike

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to