473,788 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

merits of Lisp vs Python

How do you compare Python to Lisp? What specific advantages do you
think that one has over the other?

Note I'm not a Python person and I have no axes to grind here. This is
just a question for my general education.

Mark

Dec 8 '06
852 28743
In article
<pa************ *************** *@REMOVE.THIS.c ybersource.com. au>,
Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrote:
And here I was thinking that languages fell from the sky like donuts!
Gosh, thank you for explaining that too me. What a fool I must seem!
Certainly that is what you wrote. If you had not meant that English
enforces restrictions on expressiveness, perhaps you should not have
written it.
Look, I was arguing a really simple point: for communication to occur
between two individuals, both people must agree on a set of rules for the
language that they use to communicate. If they don't have a common
language with agreed upon rules, communication will be feeble and weak, if
not non-existent, or there will be misunderstandin gs and errors.
No, in that post you are arguing a straw man. In this post you seem
to be agreeing with me while acting like you disagree.

If we both agree that the rules of languages are social, then we
should both agree that in the case of programming language,
communities of language users help to constrain how the language is
used by rejecting extensions that are not lispy/pythonic, and
accepting extensions that converge with accepted style.
No. Your peers or your parents or your editor or your teachers correct
you. Or you get a reputation for being "stupid" and people start treating
you as if you were stupid -- maybe they start talk-ing ver-y slow-ly at
you, using baby words. Or people just find it difficult to communicate
with you, or misunderstand what you are trying to say.
And likewise, if you propose a construct that is unlispy/unpythonic,
that construct is not likely to be adopted by the community of
computer language users.

Since you are apparently in complete agreement with the post you
dishonestly quoted out of context, I don't see where we have an
argument.
Before patronizing me, do make the effort to understand what I am saying.
I understand what you wrote. Perhaps your problem is that in your
rhetoric zest you chose to dishonestly attack a strawman, and chose
to defend a position you now claim not to hold.
Are you man enough to acknowledge your error, or are you going to continue
this ridiculous charade of attacking me for holding views I don't have?
I have no way of knowing the views that you have, only the views
that you write. And if you don't write what you mean, I have no way
of understanding that you are really in agreement with me, when you
attack something I did not say.
Dec 10 '06 #301
On Sun, 10 Dec 2006 00:03:11 -0800, Wolfram Fenske wrote:

[snip]
Doesn't matter because it only has to be written once. For Common
Lisp it's already part of the language. It would of course be bad to
write a macro if pattern comes up only a few times. But that's not how
macros are used.
So you say. I've heard it be said that anytime you do anything more than
once, you should abstract it away into a function or macro.

Of course, that was the same person who told me that no function should
ever be more than five lines of code, so perhaps you might consider him
prone to over-stating his case.

[snip]
>Saving one line of code, at the expense of having another block of code
to write or understand -- is that really the best example of what
macros are used for in practice? You don't really save writing any
boilerplate code, except for else clause, unless you're claiming that
"if" and "elif" is boilerplate.

No, all the "if control_code == SOME_STATUS:" are boilerplate:
You still have to include SOME_STATUS in the Lisp example. Calling it
boilerplate for Python is unfair.

[snip]
The pattern is that one value is compared against several possible
values and depending on which one matches, the appropriate action is
taken. Common Lisp's CASE and ECASE macros and the "switch" statements
of C or Java make this pattern explicit and arguably easier to
recognize. In Python you have to type it out yourself.
Yes, Python doesn't have a case/switch statement. It may get one in the
future. There are advantages to a case statement, but they aren't
overwhelming, and there are costs to implementing it.

>Okay, I'm impressed that ecase can pick up on the four constants being
tested against, and feed their names (rather than merely their values)
into an error message. Python has nothing like that, and if you only
have three or four things to test against, *and* they have names, that
could be a useful thing to do. And if I've understood correctly, that's
more a feature of Lisp's symbols than of macros.

But if you're testing against fifty different values, well, is it
really useful for your error message to list all fifty names? Or do you
have another macro ecase-with-lots-of-tests?

Now you're being silly.
How am I being silly? Do you not believe that people write case blocks
with fifty tests? Okay, how about twenty? Ten? Eight?

One of the advantages of Lisp's ecase macro was specifically stated to be
that it gave you the error message for free, without the coder having to
add new terms to the message as they add new comparisons. Why is it
"silly" to question whether that feature is always useful?
[snip]
Here's another example. I had to use a database in one of my Python
programs. Everytime I used the database I had write something like
this:
[snip]
In Lisp, I could just write a macro "WITH-CONNECTION" that takes the
name of the connection variable and the code for "do something with the
connection" as arguments. Actually, I ended up writing something like
it as a function in Python:

--8<---------------cut here---------------start------------->8---
def withConnection( self, fun):
self.lock.acqui re()
try:
connection = sqlite.connect( self.dbFile)
connection.row_ factory = dictFactory
try:
return fun(connection)
finally:
connection.clos e()
finally:
self.lock.relea se()
--8<---------------cut here---------------end--------------->8---

What would have been the body in the Lisp macro has to be supplied as
function. It's basically a macro, but it still requires more typing
because you have to define a local function eveytime it is used.
Hang on -- why can't you just call the function again?

If you're talking about calling withConnection with different functions,
then of course you have to define a different function each time. How is
that different from the Lisp macro? You still have to write that.

And these functions -- shouldn't they be tested? If they were just
anonymous blocks, won't they be hard to test? These aren't rhetorical
questions.

--
Steven.

Dec 10 '06 #302
Steven D'Aprano wrote:
Yes. But you can't redefine 1+2 in Python, at least not without hacking
the interpreter. Can you redefine (+ 1 2) in Lisp?
Yes, that's no problem and works without warnings and in every Common Lisp
implementation:

CL-USER (shadow '+)
T

CL-USER (defun + (&rest rest) (apply #'- rest))
+

CL-USER (+ 3 1)
2

--
Frank Buss, fb@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Dec 10 '06 #303
Steven D'Aprano schrieb:
>def import():
File "<stdin>", line 1
def import():
^
SyntaxError: invalid syntax
Nope, can't shadow or change keywords. (And yes, the error message could
be better.)
I have a very interesting Python module. Look what it does:

======= python =============== =====
>>import a
import b
You sucker thought I'd import b for you.
Instead I'm going to erase your hard drive.
=============== =============== ==

Somehow the meaning of "import" changed between the first
and the second line. Doesn't it frighten you?
(BTW: Do you know how that works, or should a Lisper show
you?)

It seems that Phytonistas, including Guido, don't trust each
other. Guido always provides half assed restrictive solutions
instead of decent meta programming. Examples include "lambda",
the new "with" syntax and decorators.

Dec 10 '06 #304

Kirk Sluder wrote:
In article
<pa************ *************** *@REMOVE.THIS.c ybersource.com. au>,
Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrote:
Yes. But you can't redefine 1+2 in Python, at least not without hacking
the interpreter. Can you redefine (+ 1 2) in Lisp?

Not without barreling through error messages about name conflicts.
By LISP do you mean CL?

In Scheme next

(+ 1 2)
---1

is possible. It would be possible in other dialects of LISP also

Dec 10 '06 #305
Steven D'Aprano wrote:
So which is it? If Lisp is so self-evidently better than every other
language, and if nobody has any fears or concerns with Lisp, why is Lisp a
fringe language?
Because shifting to lisp somewhere in the middle of
your project or carear is VERY EXPENSIVE STEP.
And its doubtable movement for absolute majority
of GUI's button makers.
Dec 10 '06 #306


Steven D'Aprano wrote:
On Sun, 10 Dec 2006 02:12:29 -0500, Bill Atkins wrote:

>>Steven D'Aprano <st***@REMOVE.T HIS.cybersource .com.auwrites:

>>>Rightly or wrongly, people fear that Lisp's macros push Lisp closer to
that hypothetical anything-goes language than is healthy. Maybe that's a

Wrongly.


That's your opinion, and as an experienced Lisp coder, it is an opinion
worth treating seriously. Nevertheless, a mere denial doesn't constitute
evidence, let alone proof.
Well, it does unless you think we are lying, or creating obfuscated code
and do not know it. This would be consistent with the theory that we
positively love parentheses only because we are mutants. To be honest, I
think it would be way cool if it turned out I was this mutant life form,
the only kind that can understand Lisp. And this would be consistent
with my theory that John McCarthy must be an alien. How else can he
wander over to his desk one day, misread Church, and create a language
that, as you say, is growing in popularity and whose essence can be
found in every popular language except C++, which only makes my point.

Have you read On Lisp by Paul Graham? It is on-line. Just the preface
will do, I think, maybe also Chapter One where he raves on macros. Do
you think he is mistaken? Confused? Lying? Mutant?

This exchange has not been a complete disaster, but it sure could have
covered a lot more ground if you had not had your hands over your ears.

Now I see you want Lispniks to explain its unpopularity. I like that, we
have to figure out what is wrong with you. :) Apparently that would be
fear of the unknown, xenophobia, and prejudice. Meanwhile, given that
Python and Ruby have copied so much from Lisp, and that languages seem
to be converging on Lisp, now we have to have an equally daft exchange
over the possibility that Lisp is the most popular language going. Even
Java has Groovy.

Lisp has all the cool qualities you like in your pets, plus native
compilation in most implementations , plus maturity and a standard, plus
a better OO, plus macros, plus a dozen more small wins. Including
automatic indentation. :)

It is just a matter of critical mass. At some very low threshold Lisp
becomes "OK". I get the feeling that has already begun, but it is not
quite there yet. Certainly it gets mentioned now when language names get
bandied about, if only to be dismissed. That is a step up for us. :)

ken

--
Algebra: http://www.tilton-technology.com/LispNycAlgebra1.htm

"Well, I've wrestled with reality for thirty-five
years, Doctor, and I'm happy to state I finally
won out over it." -- Elwood P. Dowd

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
Dec 10 '06 #307
Ken Tilton <ke*******@gmai l.comwrites:
Have you read On Lisp by Paul Graham? It is on-line. Just the preface
will do, I think, maybe also Chapter One where he raves on macros. Do
you think he is mistaken? Confused? Lying? Mutant?
I remember Paul Graham's piece about macros that made him sound like
someone who went nuts with them, as is certainly possible to do. In
my experience, good coders write for clarity and that includes in
their use of Lisp macros. All in all Lisp's macro system is something
like the C preprocessor. Yes, you can obfuscate things horribly with
it, but you can also use it to make things clearer, and that's what
good programmers do.
Dec 10 '06 #308

Ken Tilton ha escrito:
It is just a matter of critical mass. At some very low threshold Lisp
becomes "OK". I get the feeling that has already begun, but it is not
quite there yet.
Sometime in the past LISP got an increased 'popularity' (i suspect
because LISP natural fit into web services). However, i also noticed
that since some months ago, the TIOBE index for LISP decreases and
decreases and decreases... whereas Python, Ruby, and company increase.

Last December index, Ruby increases ranking by 9 positions to 11th,
Python 1 to 7th, whereas LISP decreases to 17th from 13th.

Dec 10 '06 #309

Ken Tilton wrote:
>
Lisp has all the cool qualities you like in your pets, plus native
compilation in most implementations , plus maturity and a standard, plus
a better OO, plus macros, plus a dozen more small wins. Including
automatic indentation. :)
Better OO? You mean the one that doesn't support basic encapsulation
and is retardedly cumbersome to use? There's a reason I said, I'd never
use Lisp for OO not even when I'm high. Gimme Python, Eiffel or
Smalltalk anyday, not the retarded add-on package bolted on CL.
It is just a matter of critical mass. At some very low threshold Lisp
becomes "OK". I get the feeling that has already begun, but it is not
quite there yet. Certainly it gets mentioned now when language names get
bandied about, if only to be dismissed. That is a step up for us. :)
Bahahahaha! You lispers and your fairy little macros world.

Dec 10 '06 #310

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2190
by: Paddy3118 | last post by:
This month there was/is a 1000+ long thread called: "merits of Lisp vs Python" In comp.lang.lisp. If you followed even parts of the thread, AND previously used only one of the languages AND (and this is the crucial bit), were persuaded to have a more positive view of the other language; (deep breath, this is a long, as well as grammatically incorrect sentence), THEN WHY NOT POST ON WHAT ARGUMENTS PERSUADED YOU.
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.