[OPINION] - does language really matter if they all do the samething?

Aahz aahz at pythoncraft.com
Sat Jan 24 01:33:55 EST 2004


In article <mailman.726.1074923000.12720.python-list at python.org>,
Dietrich Epp  <dietrich at zdome.net> wrote:
>
>Python, second try:
>
>def reset_settings(self):
>     method = None
>     try:
>         method = self.delegate.default_settings
>     except AttributeError:
>         pass
>     if method:
>         self.set_settings(method(self))
>     else:
>         self.set_settings(some_fallback_value)
>
>If you think this example is contrived, maybe you haven't worked with 
>the paradigms used in Objective-C very much.  The example above was 
>used dozens of times in a class that I wrote in Objective-C which draws 
>a grid to the screen, for example, when it asks itself or its delegate 
>what color the grid should be, or the maximum scale allowed.  The 
>practice is also used heavily by Apple's Cocoa libraries, which are my 
>favorite UI libraries of all time to program with.

I'm quite sure it isn't contrived.  OTOH, unlike your Lisp example, this
is one which I think reads more easily than the equivalent Objective-C
code (or your attempt to literally translate it).  I think it's possible
to emulate your Lisp code in Python, but as the joke goes, every language
ends up writing a Lisp emulator.  On the gripping hand, Lisp does
absolutely nothing to demand the clarity with which you wrote your Lisp
code, and I'm not willing to pay the price of reading the occasional (or
frequent! -- depending on the code writer) Perl-like monstrosity for the
privilege of having that elegance readily available.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

A: No.
Q: Is top-posting okay?



More information about the Python-list mailing list