FEEDBACK WANTED: Type/class unification

Skip Montanaro skip at pobox.com
Mon Aug 6 13:22:07 EDT 2001


    Dylan> The 'list' class/type has a method '__getslice__' (etc.), which
    Dylan> uses the old and very broken interface.  I want to define a
    Dylan> subclass for which this interface is insufficient.  If I want the
    Dylan> new interface, I have to figure out how to hide that method.
    Dylan> [Does anyone know how to do this?]

How about

    >>> class MyList(list):
    ...   def __getslice__(self, *args):
    ...     raise AttributeError, "__getslice__"
    ... 
    >>> x = MyList()
    >>> x.__getslice__()
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File "<stdin>", line 3, in __getslice__
    AttributeError: __getslice__

?

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list