Patrick May <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > ...an alleged reply to me, which in fact quotes (and responds to) > > only to statements by Brian, without mentioning Brian... > > > > Mr May, it seems that you're badly confused regarding Usenet's > > quoting conventions. > > It seems that someone pisses in your cornflakes nearly every > morning. > > For the record, I was attempting to respond to your post which I > only saw quoted in another message. Please excuse any accidental > misquoting.
Your message was an immediate followup to mine, but all the text you quoted in it was by Brian (w/o mentioning him) -- you quoted no text written by me. > > Your "pragmatic benefits", if such they were, would also apply to the > > issue of "magic numbers", > > That claim is, frankly, silly. A function is far more > understandable without a name than a value like 1.19 in isolation. > The situations aren't remotely comparable. I think the comparability is definitely there. Somebody asked me about translating a bunch of Lisp he'd written (he later admitted he had misunderstood the power of python's def, and that it lets one do all he's using unnamed functions for); well, each of those HOF's returns an unnamed function *with a nice short comment explaining WHAT it does*. The code would be of far worse quality without the nice short comments, but it would be much better if the comments were turned into *NAMES* (allowing easier inspection in interactive development, debugging including examination of tracebacks, etc). What's the *POINT* of coding (python syntax): def blank(*a): " return a blank picture " return lambda *ignore_args: [] rather than: def blank(*a): def blank_picture(*ignore_args): return [] return blank_picture and so forth? The former is obscure (ok, it's an anonymous function taking and ignoring arbitrary args and returning an empty list, but WHY, WHAT DOES IT MEAN?!), except for the explanatory comment; the latter clearly defines the purpose of the returned-function by its name. The situation is exactly parallel to "magic numbers", as in: total *= 1.19 is entirely mysterious (OK, total, is being multiplied by 1.19, but WHY, WHAT DOES IT MEAN?!), better is # augment total by VAT total *= 1.19 and better still VAT_MULTIPLIER = 1.19 total *= VAT_MULTIPLIER A comment is better than nothing (given that the 1.19 constant, or the function ignoring its arguments and returning empty list, are mysterious in their purpose), a name is better still. > > cost: I like languages that are and stay SMALL and SIMPLE. > > Like Scheme? Didn't want to trigger some flamewar;-), but, yes, if that was my only choice, I'd much rather use small, simple Scheme than huge, complicated, rich, powerful Common Lisp. ((But in this case I'm biased by early experiences, since when I learned and used Lisp-ish languages there WAS no Common Lisp, while Scheme was already there, although not quite the same language level as today, I'm sure;-)). Alex -- http://mail.python.org/mailman/listinfo/python-list