Beautiful Code in Python?

sjdevnull at yahoo.com sjdevnull at yahoo.com
Mon Mar 3 17:30:01 EST 2008


On Mar 2, 1:18 pm, castiro... at gmail.com wrote:
> On Mar 2, 12:01 pm, John DeRosa <stug... at qwest.net> wrote:
>
> > On Mon, 3 Mar 2008 01:23:32 +0900, js <ebgs... at gmail.com> wrote:
> > >Hi,
>
> > >Have you ever seen Beautiful Python code?
> > >Zope? Django? Python standard lib? or else?
>
> > >Please tell me what code you think it's stunning.
>
> > Just about any Python code I look at.
>
> Decorators, with, and namedtuple.

IMO, decorators are functional but far from beautiful.  They're a
special, somewhat ugly syntax for something that was already handled
by normal constructs ("foo=classmethod(foo)") that you didn't need
extra knowledge to understand.

On balance I think it's worth it in order to get those "declarations"
up by the function defs, but it's sort of a tradeoff of magical non-
explicitness for pragmatism over purity.  A worthwile tradeoff, but
not what I'd ever call beautiful.



More information about the Python-list mailing list