Py2K wishes
Paul Prescod
paul at prescod.net
Mon Dec 27 07:28:34 EST 1999
I would love it if one of my Python nits was corrected in Python 2
whenever that comes about. Consider the keywords "def" and "class"
"class": noun, taken from Marxist literature, as in "class war" and
"history class"
"def": adjective, taken from urban slang as in "def comedy jam"
Kidding aside, "class" is a noun and "def" is an abbreviation for a
verb. Furthermore, "def" is way too generic. Python has class
definitions and function definitions. The keywords should be
"func"/"function" and "class".
-----
The syntax for selecting base classes is un-Pythonic in the sense that
it is not clearly obvious what is going on. Java's "extends" keyword is
more Pythonic (if only the rest of Java was!).
-----
Python has an efficient multi-level dispatching mechanism that is used
as the basis for name lookup and attribute lookup. The implementation of
this mechanism should be made availab le to the programmer. I should be
able to make a proxy object something like this:
class Proxy:
def __init__ ( self, fallback ):
__fallback__=fallback
a = Proxy( someObject )
This would imply the following:
class SomeClass( someParentClass ): pass
assert SomeClass.__fallback__ == someParentClass
assert SomeClass().__fallback__ == SomeClass.__fallback__
Paul Prescod
More information about the Python-list
mailing list