On 10/29/2017 02:13 PM, Rick Johnson wrote:
Alberto Riva wrote:
Rick Johnson wrote:
Alberto Riva wrote:

[...]
In a language like Lisp

Python is nothing like Lisp, and for good reason!

I would disagree with this. Actually, it's the most Lisp-
like language I've encountered in my 25 years of writing
software.

Really? I'm sorry that you have only encountered a few
"academic languages". Do some googling, there are literally
thousands of them in the wilds.

I'm sorry, I'm not sure I understand what you mean. I've been exposed to quite a few programming languages over the years, and my personal assessment (based on the features I consider important from my own personal point of view) is that Python is the closest to Lisp of the ones that I would consider using. It's definitely closer to Lisp than C, or Java, wouldn't you agree? I don't see where you get the idea that I was only exposed to "academic languages".

It has closures, functions are first-class objects, it's
interactive, highly reflective, variables are not strongly
typed...

Congratulations. You've just described Ruby. And an apple-
cart full of other languages as well.

OK, so? Does that invalidate my statement? And even if it did, that has almost nothing to do with my original question.

I don't consider myself a fanboy - I've used Lisp for most
of my career, and now I happily use Python for 80% of what
I do, even if it means putting up with the occasional
limitation, as in this case.

(not that i'm defending Python here...) but how do you know
that this so-called missing "feature" is a limitation?

Because (again in my own personal opinion) Lisp macros are wonderful, they increase programmer productivity enormously, and not having them when I'm programming in other languages is a limitation from my point of view, since I enjoy using them so much.

How many other languages use this "feature"?

Almost none, unfortunately. So?

And how many
programmers swear they could not live without it? We need
stats; hyperlinks; and eye witness testimonials. Heck, even
a random YouTube vid would be helpful.

I don't see why. I'm just talking about something that I personally feel the need for, I'm not trying to convert anyone.

Why "thankfully"? Having macros in Python would be great.
Of course it's not possible because of the syntax, but it
would be great nevertheless :)

To me, macros would seem to violate Python's "explicit is
better than implicit" philosophy.

But that's exactly why I would like to be able to use macros. I think that being able to write "return if this happens" is much more explicit than having to write the full if statement, every time. The idea is that you abstract a pattern giving it a name, so every time you see that name you know immediately what's going to happen, without having to decode the conditional in your mind.

Possibly. But you've already poo-pooed the easy and
obvious solution of using conditional logic.

Not really. It's obvious that I'm going to use a
conditional, I was just asking for a way to avoid having to
type the same conditional over and over. Computers are
meant to do work for you, after all, aren't they? :)

A reasonable argument, i admit. But again, here in the
peaceful fields of "Pythonia", most of us feel that
"explicit is better than implicit". And why? Well, because
code is read more often than it is written, and as such,
explicit code will be of enormous help during the debugging
process. Sure, you may save yourself a few key-strokes with
features like macros, but at what cost? No action is without
consequences, dontchaknow?

I agree completely. Maybe we're using two different definitions of the word macro (I'm not sure how familiar you are with Lisp macros), but in my view their biggest advantage is that they make the code more readable and more explicit. And the issue of debugging is an orthogonal one, good development environments allow you to work on the original and the macro-expanded code equally easily.

Alberto

--
                E-mail address:
((lambda (s a b c) (map 'string #'code-char (mapcar (lambda (v)
(setq s (+ a (mod (+ s v (- a)) b)))) (map 'list (lambda (v)
(- (char-code v) c)) " 1`-THUZ&+Wh1")))) 97 46 73 32)
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to