Lots o' Questions

Craig Lawson (claw@rahul.net)
Wed, 20 Jul 1994 18:31:04 GMT

I just started using Python and I like it, even though I am using a
pathetic DOS machine. Does anyone know of a graphics extension for
DOS or Windows?
OK enough whining. Here are some things I'm comfused about:

1) Why can't some functions be applied to immutable types?
Example: Applying list methods "index" or "count" to strings.
Even more to the point, definging "remove", "reverse" or "sort" for
strings such that they return a new strings.
2) Why make strings immutable in the first place? I understand why
from an implementation perspective (moving pointers), but what are
some other reasons?
3) Why aren't all types treated as objects, (i.e. strings)?
Why can't I write: "a string".length()
4) Why can't I descend from built-in classes? Why can't I derive a
class from the built-in "file" class? It would save me the trouble of
creating a wrapper class to add functionality (like a "getchar()"
type function.
5) Why do scoping rules require an explicit scope specification for
everything except: self.<class_var> ? Example:
class my_class:
i = 1
def f(self):
self.j = self.i + 1

Here, "j" is an instance variable and "i" is a class variable,
shared among all instances of the class. They are accessed with
the same syntax. Why?
6) Why make "self" (or whatever) a mandatory formal parameter in
methods? Why not make "self" a predefined identifier within methods?
7) More about contexts: having to fully specify variable contexts
really bugs me. The more Python I write, the more it bugs me.
It is correlated. It is a trend. I am bugged. Because: I prefer
a language that does the work for me. Why isn't there a predefined
context search order?
8) Why can't the debugger (pdb) understand the syntax:
break <class>.<method>
Instead I have to type:
break <class>.__dict__['<method>']
9) Why does "cl" (clear all breaks) bomb? (pdb)

That's all for now. I'm not about to stop using Python because of
these issues. I would like an explaination of the various design aspects.
Hope no one is really touchy about these issues. Guess I'll find out.

-- 
Craig Lawson
claw@rahul.net