[Zope] The Prefect Python

Gilles Lenfant gilles@pilotsystems.net
Wed, 28 Aug 2002 22:47:11 +0200


Call this JavaEiffelPython (c) :))
Try to write PEPs about it but don't expect the support of most Python
community members!
See my (personal) answers within the lines of your original mail (I
apologize too for my poor english)

--Gilles

----- Original Message -----
From: "Jean-François Ménard" <jeanfrancoismenard@msn.com>
To: <zope@zope.org>
Sent: Wednesday, August 28, 2002 5:31 PM
Subject: [Zope] The Prefect Python


> Just posted this on comp.lang.python.
> Maybe Zope developpers could have comments.

[SNIP]

>
> The Perfect Python (c):
>
> What is missing ?  Well, I'm not a language designer, but I can say what
*I*
> miss.
>
>     - Interfaces.  Behavior checking is not enough.

raise NotImplementedError exceptions in the base classes in methods that
*must* be implemented by child classes.

>     - Private and Public scopes.  Explicitly.  No more __name_mangling

__xxx notation is familiar and short to most python developers including
newbies. Using __xxx shows that we're using private scope in an expression.
When you declare...

private stuff
...
# 100 lines of code
...
stuff = someExpression

You don't see immediately that "stuff" is in the "private" scope... Talking
about readable code ? Huh !

>     - Design by contract. Pre and Post conditions.  Could save hours of
> debugging.

Check the values and raise appropriate exceptions if needed

>     - Block comments.  """ """ should be for documentation.

These ARE for documentation !!!???

>     - Class variables.

class Stuff:
    # class var below...
    objectsCount = 0
    def __init__(self):
        Stuff.objectsCount += 1

>     - A cleaner Property declaration.  No separate _variable. Saw too many
> newbie posts about that.
>     - No more self in functions declarations.  In OOP, this *can* be
> implicit. (I know, this is controversial stuff)
>     - Standard GUI library.  AnyGui seems to be the solution, but
> development seems to have stalled recently...

Tkinter *is* the standard GUI library that comes with any Python distro.
Okay that is not as rich as Java Swing, but it's enough for most small apps,
and easy to use.
Don't blame those who want to provide environment specific GUI library
(Win32, QT...) that are essential in lots of circumstances.

[SNIP]