Some things I'd like

Craig Lawson (claw@rahul.net)
Fri, 5 Aug 1994 18:46:55 GMT

Here are some things from my Python Wish List:

1. PARENT keyword for referencing methods in a base class. Example:

class a:
def m(self): ...
class b(a):
def m(self): ... parent.m() ... # Calls a.m()
class c(b):
def m(self): ... parent.m() ... # Calls b.m()

Why it's important: makes class heirarchy modification easier. In
the preceding example, I could change C's definition to use a
different base class, and not have to update multiple explicit
references to B. This scenario is especially bad if I insert a class
into the heirarchy between B and C (call it B1), because an overlooked
explicit call to b.m() from c.m() may produce a nasty bug: b1.m()
should have been called, but wasn't.
How it would work with multiple inheritance: I don't know. Surely,
there are a lot of other implementations to use as models.
PARENT cannot be implemented as a method because a method cannot
determine which class it is defined in.

2. Conversions to and from lists:
tuple_to_list() list_to_tuple()
string_to_list() list_to_string()
Since LIST is the only mutable sequential type (a hindrance, IMHO),
these conversions will permit easy manipulation of elements.
These can be implemented in Python, but a built-in would be much
faster.

-- 
Craig Lawson
claw@rahul.net