Python becoming less Lisp-like

Paul Boddie paul at boddie.org.uk
Wed Mar 16 03:43:21 EST 2005


Steven Bethard <steven.bethard at gmail.com> wrote in message news:<f_ednc-jcPDIa6vfRVn-tg at comcast.com>...
> 
> Certainly descriptors in the "wrong hands" could lead to confusing, 
> unreadable code.  But Python is a "we're all adults here" language, and 
> so we have to trust other coders to be responsible.

The problem is as much about social dynamics as it is about
responsibility. Introduce a cool new feature and there'll always be a
minority who will use it in every situation, no matter how absurd; the
problem arises when these unnecessary excursions into absurdity start
to dominate the code you're using or maintaining.

>                                                      There are some very 
> reasonable uses for descriptors which I don't believe are really 
> confusing, for example the lazy property recipe:
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/363602

This is all very exciting, but...

  * You could do this with __getattr__ since Python 1.x, possibly
    even Python 0.x. Moreover, the __getattr__ example would be
    more readable.

  * This introduces runtime baggage to solve a notation issue. Yes,
    accessor methods are "so Java", but once a program is running
    who cares whether it's a property or a method that is getting
    called? (Actually, for interactive inspection of an object
    model there is some argument for having properties...)

I think the first point quite reasonably illustrates the original
contributor's concerns about Python's current consistency/coherency.

Paul



More information about the Python-list mailing list