Thoughts about Python

Marco Aschwanden PPNTWIMBXFFC at
Tue Feb 24 21:37:08 CET 2004

> I think you should spend a bit of time reading the PEPs... 
> what you say has been discussed previously, 
> then see where your thoughts lead you.

I will do that.

> Forget the speed and memory difference. The main argument for tuples as a 
> separate type are to use as dictionary keys. How do you propose to handle 
> dictionary keys without tuples?

Maybe I don't get the point here: Why do dictionaries need tuples to
work? I know that tuples can be used as keys... but how many times do
you need tuples as dictionary keys (it would be simple to turn a list
into an immutable string if really needed ("::".join(["a","b"]). But
maybe tuples are used within dictionary in a way I don't know. If you
could clarify on this point I will never ever say anything about
"useless" tuples... instead I will start asking for "immutable
dictionaries" 8o)

> > A list, a dictionary, a str, an int, a float are builtin functions...
> No they aren't. They are types, not functions.

functions... types... classes... simplicity at its best. But then it
was stated I am a very un-pythonic thinker.

> > The list-function instantiates a new list... it is actually nothing
> > but an overloaded List class. Why are the handed in as functions? In a
> > OO environment it should be more the instatiation of a class rather
> > than a function and classes start with an uppercase letter:
> > 
> > myList = List()
> > myDict = Dict()
> > myString = String(45)
> > 
> So they don't follow your naming convention.

Well, yeah, this is true and isn't. It is true that there is no rule
how to name a class. To me a list / dict / string is a (basic) class
(you take about types - the manuals does also) but why introduce new
words, when the class-idiom is enough to explain everything. You want
a list, well instantiate a list class --> list = List().
What is easier to explain: If you want to create an object some kind,
you need a class which starts with an uppercase letter. Or do you
rather like to explain: well, if you want a list or dictionary you use
list() or dict() but if you want an attribute error object you use:
AttributeError(). Whenever you want an object, you check the manuals
to see, whether you need upper- or lower-class instantiation. 8o)
It is true, no one tells you that class names have to start with
uppercase letter (and I could create an alias). But look into the
standard library and you will find that my naming scheme for classes
prevails. Intuition tells me hence: I want a list instance therefore I
need to call the _L_ist-Class. And yes, talking about the
_f_ile-function/class/type... that returns a "file-object": I would
write it with a leading uppercase letter: I want to instantiate a
file-object hence I need to new a _F_ile-class.
I am well aware that it wasn't possible to derive a List / Dict / ...
until lately. Most probably the distinction between types and classes
stems from this time.

Anyway, I see that my "feedback" was very unreflected. These were
thoughts I had while learning and it was wrong to mention them so
unprocessed. Without consulting the PEP, reading comp.lang.python


More information about the Python-list mailing list