PDA

View Full Version : Advantages of Python?



teryowen
November 27th, 2007, 04:18 AM
Alot of people on this forum talk about python seems like its pretty big in the community. I am very familiar with Perl programing. Now i would like to know if i should try and learn python perhaps it has more functionality or something that perl doesn't have. Just want to hear from some people what they think? and weather i should get into it.

Thanks in advance

nanotube
November 27th, 2007, 04:22 AM
Alot of people on this forum talk about python seems like its pretty big in the community. I am very familiar with Perl programing. Now i would like to know if i should try and learn python perhaps it has more functionality or something that perl doesn't have. Just want to hear from some people what they think? and weather i should get into it.

Thanks in advance

well, if you are very familiar with perl, and can do anything you want with it, there's not that much of a reason to invest into learning a new language - anything you can do with perl you can do with python, and vice versa.

one of the main advantages of python is the readability of code, and its resulting scalability to large projects. but if you don't "feel" the need for better code readability yourself, then unless you are just itching for something new, there may not be a good "business case" for you to invest time and effort into learning python.

if you are just curious, you can't go wrong by going through the python tutorial (on python.org/doc), or googling for "python vs perl" and reading what people have to say about it. :)

shawnhcorey
November 27th, 2007, 05:27 AM
well, if you are very familiar with perl, and can do anything you want with it, there's not that much of a reason to invest into learning a new language - anything you can do with perl you can do with python, and vice versa.

One of the advantages of learning a new language is learning something different.


one of the main advantages of python is the readability of code, and its resulting scalability to large projects. but if you don't "feel" the need for better code readability yourself, then unless you are just itching for something new, there may not be a good "business case" for you to invest time and effort into learning python.

No, Python does not have readability as an advantage.


if you are just curious, you can't go wrong by going through the python tutorial (on python.org/doc), or googling for "python vs perl" and reading what people have to say about it. :)

Yes, Python enthusiasts think they are the answer to toilet paper.

But there are other languages to consider, like Perl or Ruby.

jfinkels
November 27th, 2007, 05:31 AM
No, Python does not have readability as an advantage.


???

Python is a "very high level language", and as such, is closer to natural language (specifically English) than is Perl.

EDIT:

p.s. This thread == flamebait

teryowen
November 27th, 2007, 05:47 AM
But there are other languages to consider, like Perl or Ruby.

I know perl quite well. Just not really sure what ruby is, could you explain briefly, is it pretty much like perl.

My main concern is does it add more functionality over perl(for both ruby and python)?

shawnhcorey
November 27th, 2007, 05:55 AM
Python is a "very high level language", and as such, is closer to natural language (specifically English) than is Perl.

Being closer to a natural language just means a whole new space to go wrong in.


p.s. This thread == flamebait

Somehow you think natural languages are logical; or are being thinking within them is logical.

Python, like COBOL, is a Universal Turing Machine. Grow up! You like the syntax of Python but you have never had your naive premises challenged.

Python is no better a language than the rest.

tjagoda
November 27th, 2007, 05:57 AM
I know, or at least I think I know, that one advantage PERL has over Python is it's completely MASSIVE code and userbase. For almost anything under the sun, there's an example (or an example of components) freely available that's been written with PERL. I'm not sure if Python has been able to snowball up quite so much support yet.

Of course, that said as well, I know a lot of people who started Python-ing, and refuse to go back to other languages now.

jfinkels
November 27th, 2007, 06:03 AM
Python, like COBOL, is a Universal Turing Machine. Grow up! You like the syntax of Python but you have never had your naive premises challenged.

:| I didn't know this was an interrogation.

I'm just making a suggestion as to why people might prefer Python. I understand that all sufficiently powerful languages are equivalent and the only difference is sugar and syntax.

I don't appreciate your assumptions about me (that's definitely NOT the spirit of Ubuntu), so I'm going to step out now and not answer your original question any further.

shawnhcorey
November 27th, 2007, 06:10 AM
I know perl quite well. Just not really sure what ruby is, could you explain briefly, is it pretty much like perl.

My main concern is does it add more functionality over perl(for both ruby and python)?

Ruby is a language; it is an object-oriented language (OOL).

No, it is not like Perl. It assumes that objects are the fundamental premise of programming. Perl objects are an add-on; but they are fully capable as any object.

And no, no language can add more! That is the fundamental principle of a language. Any language that is Turing complete is just as capable as any other language (that is Turing complete). The only difference is the syntax.

shawnhcorey
November 27th, 2007, 06:25 AM
:| I didn't know this was an interrogation.

I'm just making a suggestion as to why people might prefer Python. I understand that all sufficiently powerful languages are equivalent and the only difference is sugar and syntax.

I don't appreciate your assumptions about me (that's definitely NOT the spirit of Ubuntu), so I'm going to step out now and not answer your original question any further.

I do not appreciate that you can endorse Python but when I endorse Perl, I am "NOT the spirit of Ubuntu."

Wybiral
November 27th, 2007, 06:25 AM
And no, no language can add more! That is the fundamental principle of a language. Any language that is Turing complete is just as capable as any other language (that is Turing complete). The only difference is the syntax.

You can code everything in assembly if you'd like (be my guest). But while you're wasting your time thinking "this is Turing complete, it must be just as good of a tool as any other" you will waste a lot of time rewriting code that the authors of higher level languages (and the libraries that go with them) have already written.

You can open a can of soup by beating it with a rock, but someone has already invested the time designing a perfectly good electric can opener for you to use.

So yes... Almost every language is Turing complete. But no... That doesn't mean they are all equal or equally as justifiable of a tool for whatever job you may have.

To the OP:
Programming languages are tools and there is no universal tool. The best approach is to learn to use as many tools as you can and get a good sense for picking the right tool for the job. Don't use PHP for 3d graphics, don't use C for web applications, and don't rewrite code when you don't have to (if a language has functionality that you need for your project, use it).

shawnhcorey
November 27th, 2007, 06:39 AM
You can code everything in assembly if you'd like (be my guest). But while you're wasting your time thinking "this is Turing complete, it must be just as good of a tool as any other" you will waste a lot of time rewriting code that the authors of higher level languages (and the libraries that go with them) have already written.

You can open a can of soup by beating it with a rock, but someone has already invested the time designing a perfectly good electric can opener for you to use.

So yes... Almost every language is Turing complete. But no... That doesn't mean they are all equal or equally as justifiable of a tool for whatever job you may have.

You missed a point. I have always said that any newbie should learn Perl, Python, or Ruby as their first language.


To the OP:
Programming languages are tools and there is no universal tool. The best approach is to learn to use as many tools as you can and get a good sense for picking the right tool for the job. Don't use PHP for 3d graphics, don't use C for web applications, and don't rewrite code when you don't have to (if a language has functionality that you need for your project, use it).

The only thing I have to add is: don't rewrite code.

It's cheaper to buy code or download it from public domain. But if you do so, comply with their licenses.

shawnhcorey
November 27th, 2007, 06:54 AM
So yes... Almost every language is Turing complete. But no... That doesn't mean they are all equal or equally as justifiable of a tool for whatever job you may have.

Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

ThinkBuntu
November 27th, 2007, 07:15 AM
Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.
Please step down from your Computer Science tower and join us developers when we discuss equality in terms of practicality, not mathematical axioms. We care about things like productivity, maintainability, readability, and a bunch of other -bilities. I know the point you're getting at, and it's a valid one, but the "developer" equality is what 99.999% of posters (as if there were enough to warrant that granularity :^) ) in this sort of forum care about, since Turing completeness is an afterthought.

LaRoza
November 27th, 2007, 12:38 PM
@OP

Python is a high level language similar to Perl in many ways, however:

* Python is designed to be OO
* Python is newer, and was built with many languages to look back on
* Python follows a different philosophy than Perl
* Python is not hard to learn, so you can spend very little time studying it before you can write actual programs

http://laroza.pbwiki.com/Python

Wybiral
November 27th, 2007, 02:44 PM
Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

I'm not trying to say Python is the God of all languages (in fact, I said use what suites you best). But I am saying that Turning completeness is NOT a measure of equality.

MS paint is capable of producing beautiful images... If you want to waste your time, you can paint pixel-by-pixel. It's graphically "Turing complete". But that doesn't hold it's weight when you need to render a 3d scene or retouch large photos. You need blender/gimp/photoshop. Anything else is a waste of time.

The same goes with programming. Some languages are geared towards certain tasks. The fact that they can all be forced to solve a certain problem is irrelevant. Learn the language that applies to what you plan to do. If you want to design web applications, don't even bother learning assembly. If you want to write device drivers, don't bother learning PHP/Python/Ruby. It's common sense... Use the right tool for the job.

Anzan
November 27th, 2007, 04:29 PM
I'm just a n00b slowly learning Python but I admire its philosophy of concision.

tyoc
November 27th, 2007, 06:22 PM
There is no point in say that a language is more easy than other to learn (there will be alway 1 exception to the rule, and you can arguee all that you want, also about paradigms wich better, etc... see this by instance http://www.geocities.com/tablizer/oopbad.htm about OOP), people think different and have different way to see things, "there is no ring for rule them all", for example I was loose at Pascal (I really dont like that lang), but C do it very well for me, also I learn more fast C++ than java (havent programmed in them for some time now), and I think is more easy asm for x86 than asm on PIC programming... also I dont like "web development" (design pages and so on) I like web programming tough.

I would say that yo go and learn the new language, I even know some of this lang http://www.txl.ca/ and Im sure that some of you would think that learn such a unknow language is a waste of time.

Quoting that site



"A language that doesn't change the way you think about programming is not worth knowing." - Alan Perlis

egon spengler
November 28th, 2007, 12:52 PM
Ruby is a language; it is an object-oriented language (OOL).

No, it is not like Perl.

It must be at least something like Perl seeing as Matz (the creator of Ruby) says that he based it, in part, on Perl and in fact named it Ruby because of Perl. (Pearl is the birthstone before Ruby)


Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

Really? Then why are there no device drivers written in javascript?

Jessehk
November 28th, 2007, 03:02 PM
I agree with shawncorey. There's too much Python-bullying around here -- it has become a mob mentality.

Tuna-Fish
November 28th, 2007, 03:20 PM
Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

something to educate yourself with:
http://www.paulgraham.com/avg.html

weaver4
November 28th, 2007, 05:23 PM
I have been a C# programmer for years (in the windows world) as I began my journey into Linux I decided to find a programming language to use in the Linux world without knowing either Python, Ruby, or Perl.

I decided on Python because it "felt" more like a modern language in the cloth of Java, Delphi or C#. Ruby was also very good but it did not appear to have the market strength of Python.

IMHO I felt that my strengths as a windows programming were more applicable to Python than Perl. So, I would of come to a different conclusion if I was a long time user of Perl or C.

sujoy
November 28th, 2007, 07:24 PM
something to educate yourself with:
http://www.paulgraham.com/avg.html

great article.........very informative and inspiring indeed........

teryowen
November 28th, 2007, 09:55 PM
something to educate yourself with:
http://www.paulgraham.com/avg.html

Excellent article, really enjoyed it.

As for me ill probably continue to develop my knowledge in Perl, but to increase the scope of my knowledge ill try to learn python and try Lisp (which i never heard of lol)

pmasiar
November 29th, 2007, 06:07 PM
There's too much Python-bullying around here -- it has become a mob mentality.

Well, if thousand people are saying same thing, and many of them are even experienced programmers themselves, is there a slight possibility that they might be right? :-)

Python has no marketing/hyping machine financed by a rich enterprise, all the love is earned old-fashioned way: being good tool for solving real-life problems, in real-life environment.

Another good read by Paul Graham: http://www.paulgraham.com/hundred.html

You can ignore tools which increase your own productivity on your own peril.

slavik
November 29th, 2007, 06:51 PM
Well, if thousand people are saying same thing, and many of them are even experienced programmers themselves, is there a slight possibility that they might be right? :-)

Python has no marketing/hyping machine financed by a rich enterprise, all the love is earned old-fashioned way: being good tool for solving real-life problems, in real-life environment.

Another good read by Paul Graham: http://www.paulgraham.com/hundred.html

You can ignore tools which increase your own productivity on your own peril.

no hyping machine? I'd say many people in these forums are hyping machines for Python (not that hype is inherently bad or evil).

as far Perl vs. Python goes. If you know Perl decently well, I doubt you will find a problem that will be easier for you to solve in Python.

$output = `ls`; #can Python do soemthing like this?

pmasiar
November 29th, 2007, 08:20 PM
as far Perl vs. Python goes. If you know Perl decently well, I doubt you will find a problem that will be easier for you to solve in Python.

$output = `ls`; #can Python do soemthing like this?

Of course not that easy: Python deliberatedly adds more verbose syntax in places where it aids readability. For a person who does not hack perl daily, meaning of `ls` is not obvious. Python version, OTOH, is 100% obvious:

files = os.listdir('.')

I was not comparing hype of Perl vs Python: perl has also earned the fame to be "duck tape which build the internet" and "swiss army chainsaw" by being extremely sharp tool for the job. In fact little too sharp: as they say, Perl gives you enough rope to hang yourself, and many developers do :-)

I was comparing comparing presumable "hype" around Python (earned by hard work) with paid-for hype around Java (paid by Sun and IBM) and C#/.NET (paid by MSFT). Python did not any supporting company until recently: Google picked Python because it was good for the job, not because they wanted to push it down user's throats.

LaRoza
November 29th, 2007, 08:24 PM
no hyping machine? I'd say many people in these forums are hyping machines for Python (not that hype is inherently bad or evil).

as far Perl vs. Python goes. If you know Perl decently well, I doubt you will find a problem that will be easier for you to solve in Python.

$output = `ls`; #can Python do soemthing like this?

Since the hyping is in good faith, by people who use it among other languages, it is not bad.

I am amazed at the snippets of Perl you post and that I see. Perl is certainly powerful, and a very good language, and for those who know it, there is probably no reason to use another language.

slavik
November 30th, 2007, 05:31 AM
Of course not that easy: Python deliberatedly adds more verbose syntax in places where it aids readability. For a person who does not hack perl daily, meaning of `ls` is not obvious. Python version, OTOH, is 100% obvious:

files = os.listdir('.')

I was not comparing hype of Perl vs Python: perl has also earned the fame to be "duck tape which build the internet" and "swiss army chainsaw" by being extremely sharp tool for the job. In fact little too sharp: as they say, Perl gives you enough rope to hang yourself, and many developers do :-)

I was comparing comparing presumable "hype" around Python (earned by hard work) with paid-for hype around Java (paid by Sun and IBM) and C#/.NET (paid by MSFT). Python did not any supporting company until recently: Google picked Python because it was good for the job, not because they wanted to push it down user's throats.

except I can also do:

$output = `dpkg -l`; :)

or something like


open $file, "cat /etc/fstab|" or die $!;

Perl is for a completely different purpose than Python. Please don't try to compare languages when they are not in their native setting. :)

from wikipedia "... widely adopted for its strengths in text processing and lack of the arbitrary limitations of many scripting languages at the time."

Python is more of BASIC done right, whereas Perl was made to process text.

It is like the current research into object-oriented databases. One approach is to take an OO language (Java for example) and give it database like qualities (persistence through instances). The other approach is to take a database (like MySQL) and give it object oriented characteristics.

EDIT: for those disliking Perl's sigils for whatever reason, here's another way in which they are useful.

@lines = `cat somefile`; #creates an array where each element stores a single line;
$lines = `cat somefile`; #creates a scalar where the entire file is concatenated together (any newline characters are preserved).

EDIT2: If you want an interpreted language (I define that as something where the source code is usually the program) that looks like a compiled language, then look to Python.

Vox754
November 30th, 2007, 06:59 AM
I do not appreciate that you can endorse Python but when I endorse Perl, I am "NOT the spirit of Ubuntu."



Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

I personally don't understand that attitude. Maybe shawnhcorey was having a bad day and he needed to vent.




I agree with shawncorey. There's too much Python-bullying around here -- it has become a mob mentality.
Well, if thousand people are saying same thing, and many of them are even experienced programmers themselves, is there a slight possibility that they might be right? :-)

Python has no marketing/hyping machine financed by a rich enterprise, all the love is earned old-fashioned way: being good tool for solving real-life problems, in real-life environment.

I agree with pmasiar.
People who promote Python really love it. There is no bullying, just people telling others about a great tool.



I am amazed at the snippets of Perl you post and that I see. Perl is certainly powerful, and a very good language, and for those who know it, there is probably no reason to use another language.
I agree with LaRoza.
Truly Perl (or any other language) promoters are like Slavik, who take their time to teach us in a good way the strengths of their language while not discrediting others.

Well, pmasiar constantly bashes Perl, but that's because he knows it from previous experience, and always does so with humor. So in those cases we can make exceptions, right?



I know, or at least I think I know, that one advantage PERL has over Python is it's completely MASSIVE code and userbase. For almost anything under the sun, there's an example (or an example of components) freely available that's been written with PERL. I'm not sure if Python has been able to snowball up quite so much support yet.

Wow! This is the first time I read something like this.
I haven't used Python a lot, but I think Python is one pretty damn huge snowball right now!

nanotube
November 30th, 2007, 02:31 PM
Wow! This is the first time I read something like this.
I haven't used Python a lot, but I think Python is one pretty damn huge snowball right now!

well, perl's been around longer, so it's not quite that big a surprise :)

nanotube
November 30th, 2007, 02:32 PM
except I can also do:

$output = `dpkg -l`; :)

or something like


open $file, "cat /etc/fstab|" or die $!;

Perl is for a completely different purpose than Python. Please don't try to compare languages when they are not in their native setting. :)


well, how well would those work for you on say... windows? thought so. :)
note also that python can also execute commands in the shell, it's just a bit more verbose about it.

but sure, perl does have a nice compactness for text processing. :)

pmasiar
November 30th, 2007, 04:48 PM
Full disclosure: I prefer Python, but I would take Perl over Java anytime.

I got burned by Perl project, IMHO Perl is excellent to quick 10-liners (using powerful syntax shortcuts, so expertly presented by Perl lover, slavik), but in bigger projects (couple thousand LOC), Perl's very flexible syntax means courting a disaster unless really strong nazi-type project manager keeps very strong coding standards.

It is interesting how such similar languages, like Perl and Python are, can still feel so different by having subtle preferences.

Perl claims "there is more than one way to do it" - TIMTOWDI, which adds flexibility but makes program by other people (or your own old code) harder to read and understand.

Python has "there should be one obvious way to do it right" policy, and efforts are made to make simple, intuitive, short way be the optimal, fastest way to do it (of course, you still need to learn some idioms, like ''.join(itemlist), which I admit is not 'obviously' intuitive, but easy to 'catch').

Python makes using unasigned variable an error, Perl is eager to auto-vivify it. BTW Java commits similar sin.

Different emphasis is given standard libraries: In Python, regex is a library, so it can be changed between versions. Perl has it part of syntax, which is more convenient (no import needed) but lex flexible to upgrades. Whole library is treated differently: Perl has wide anarchy of CPAN, where many modules compete (and it is hard to see which one is stable, or even maintained), Python has concept of "core libraries", where new mature libraries are added after they proven itself in the field and are clear winners in the category. Again, Perl's policy of TIMTOWDI hurts Perl in the long run, IMHO.

IMHO the most important insight used in Python is, code is read more often than written, so giving priority to readability (communicating between humans) is more important than creating powerful syntax where you can do a lot in couple of lines. Perl has "golf" competitions (solving problem in shortest code: every character counts), Python has culture of having meaningful 'obvious' names.

And please don't get me started on Perl's differences between list and scalar context, or between @x, $x, $x[1], $x{'key'} and @x{@list}, or "5" + 1 being valid in Perl. This is plain wrong, cool for 'obfuscated Perl' competition but not fitting for a language used by a scientist 2-3 months of a year. Perl requires devotion and daily skills being refreshed daily.

One of the killer Python features for learners is it's shell (to try new code, one line at a time), and IDLE, half-decent cross-platform IDE. Perl has none.

Not mentioning the fact that Perl 6 development is stalled for quite a while and with no big company backing, while Python has increasingly growing support from many companies, most prominent being Google, and in context of this forum, Canonical.

So yes, I loved Perl, but it was before I found Python. I have no problem with people who love Perl, but IMHO Perl is not suited to anyone except most devote PerlMonks, practicing art of perl-fu daily. I prefer to have a life :-)

BTW, if someone uses PERL you know right there it is someone **not** connected to Perl community, a wannabe. It is standard test :-)

jfinkels
November 30th, 2007, 09:03 PM
It seems that this thread has [d]?evolved into a Perl vs. Python thread. Interesting.

"There's a few things we don't discuss in here: politics, religion, sports...and personal preference of programming languages! Take that stuff to the Backyard!"

nanotube
November 30th, 2007, 09:11 PM
It seems that this thread has [d]?evolved into a Perl vs. Python thread. Interesting.

well, given that the OP asked for perl vs python comparisons (i know perl, should i learn python?), it seems that it was that from the beginning. in fact, it would be off-topic if it were anything /other/ than a perl vs python discussion. :)

jfinkels
December 1st, 2007, 12:13 AM
well, given that the OP asked for perl vs python comparisons (i know perl, should i learn python?), it seems that it was that from the beginning. in fact, it would be off-topic if it were anything /other/ than a perl vs python discussion. :)

You're right. I forgot. I was just subconsciously recalling the title: "Advantages of Python?".

slavik
December 1st, 2007, 07:39 AM
not well, since windows lacks dpkg and doesn't have an /etc directory. :)

pmasiar, here's a quote by Larry Wall: "Although the Perl Slogan is There's More Than One Way to Do It, I hesitate to make 10 ways to do something. :-)"

as for Perl not being suitable for large projects, I would disagree. Implementation is at best as good as the design. If the design is crap, the implementation won't be better. By design I mean how you separate functionality and such.

Vox754
December 1st, 2007, 05:43 PM
well, perl's been around longer, so it's not quite that big a surprise :)

I know Perl is older and has a large user base. I wasn't challenging that.
What amazed me in that post was this sentence

I'm not sure if Python has been able to snowball up quite so much support yet.


Right now Python has a lot of support. That's it.

Fbot1
December 1st, 2007, 07:50 PM
Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent. That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.

Yes, there are all equal, that's what Alan Turing proved.

Okay, this really annoys me. That's not what Turing proved. IMHO it's extremely insulting to misunderstand someone's work like that. Turing hypothesized that there is nothing more functionally capable then a Turing machine.


Really? Then why are there no device drivers written in javascript?

Because that would be a pain.

CptPicard
December 1st, 2007, 08:03 PM
Okay, this really annoys me. That's not what Turing proved. IMHO it's extremely insulting to misunderstand someone's work like that. Turing hypothesized that there is nothing more functionally capable then a Turing machine.


Don't misunderstand his work like that.

The Church-Turing thesis is separate from the Turing-completeness issue of your typical programming languages.

Proving that something is equivalent to a Turing machine only proves it up to that point, not that all physically possible computation is equivalent to a Turing machine.

Here, we're discussing the fact that all the programming languages we know of and work with are Turing-complete, thus in the same class. It says nothing about the possibility of a superior computational model, although there has been a hypothesis that says there isn't.

Fbot1
December 2nd, 2007, 01:44 AM
Don't misunderstand his work like that.

The Church-Turing thesis is separate from the Turing-completeness issue of your typical programming languages.

Proving that something is equivalent to a Turing machine only proves it up to that point, not that all physically possible computation is equivalent to a Turing machine.

Here, we're discussing the fact that all the programming languages we know of and work with are Turing-complete, thus in the same class. It says nothing about the possibility of a superior computational model, although there has been a hypothesis that says there isn't.

Are you addressing me or shawnhcorey?

CptPicard
December 2nd, 2007, 02:35 AM
I quoted you, did I not? :)

Fbot1
December 2nd, 2007, 03:46 AM
I quoted you, did I not? :)

What did I misunderstand?

Wybiral
December 2nd, 2007, 04:19 AM
Because that would be a pain.

More than a pain... Literally impossible. Another reason why Turing completeness doesn't mean anything in modern programming. Maybe all languages are capable of expressing some mathematical model, but they do so in completely different ways, with completely different limits, and completely different measures of efficiency. Not to mention that software and web development usually have nothing to do with math. You can't write device drivers in Javascript, you can't write client-end browser code in assembly.

CptPicard
December 2nd, 2007, 04:29 AM
What did I misunderstand?

The others' supposed misunderstanding. As I said, Turing-equivalence among our current programming languages does not yet preclude stronger computational models. Although there is certainly the hypothesis of all physically possible computation being equivalent to a TM, it is not being argued when the point of equivalence of all languages is brought up...

CptPicard
December 2nd, 2007, 04:37 AM
Another reason why Turing completeness doesn't mean anything in modern programming. Maybe all languages are capable of expressing some mathematical model, but they do so in completely different ways, with completely different limits, and completely different measures of efficiency..

Uh... no, they don't. You simply can not make an NP-hard problem easier or the halting problem more tractable by switching from one language to the other, and this is why Turing-completeness is the most fundamental aspect of theory of computation.

It's all remarkably similar when you think of it in abstract terms, and all the different languages are just syntactic sugar that happens to work better for the developer in certain contexts. Lisp or Prolog didn't give us strong AI despite the initial hype.

I can certainly see what you're arguing, but you're just way out there claiming that the TM is just some ivory-tower mathematical model without real-world relevance :)

Wybiral
December 2nd, 2007, 05:11 AM
Uh... no, they don't. You simply can not make an NP-hard problem easier or the halting problem more tractable by switching from one language to the other, and this is why Turing-completeness is the most fundamental aspect of theory of computation.

It's all remarkably similar when you think of it in abstract terms, and all the different languages are just syntactic sugar that happens to work better for the developer in certain contexts. Lisp or Prolog didn't give us strong AI despite the initial hype.

I can certainly see what you're arguing, but you're just way out there claiming that the TM is just some ivory-tower mathematical model without real-world relevance :)

No, you're misunderstanding. You've basically argued "some problems are hard in every language" and that's not what I was saying. I'm saying that some languages have better constructs than others for expressing certain things. And even further than that, some languages are simply incapable of certain tasks, Turing complete or not. For instance, as I said, good luck writing client-side web code in assembly. It lacks the means of communication and portability that other languages have. Good luck writing device drivers in anything other than C/Assembly. Most languages simply don't support the means of communicating those messages.

Turing completeness is theory, and real-world programming extend way beyond theoretical potential. There are many more issues ranging from development time, portability, scalability, readability, security, runtime efficiency, and memory consumption. And almost every language is different in this respect. That is where real-world relevance comes into play, and I don't care how you interpret some mathematical theory because I know from experience that languages are different. They have different purposes and measures of efficiency. There's more than just syntactic sugar difference between them.

jflaker
December 2nd, 2007, 05:22 AM
A wise professor told me that LOGIC will not change for a process.......it is the syntax of the programming language that will change.

If your tool is capable, use it. If the wheel has already been invented, then USE THAT INSTEAD!

The only time you should be rewriting code is to remove lines of code by implementing API's that have become available in the language of your choice. By using API's, your code base can shrink and efficiency inproved while maintaining functionality.

Fbot1
December 2nd, 2007, 06:03 AM
The other's supposed misunderstanding. As I said, Turing-equivalence among our current programming languages does not yet preclude stronger computational models. Although there is certainly the hypothesis of all physically possible computation being equivalent to a TM, it is not being argued when the point of equivalence of all languages is brought up...

Yeah, it is. If the Church–Turing thesis is correct then anything that is Turing complete is equally functionally capable.


More than a pain... Literally impossible. Another reason why Turing completeness doesn't mean anything in modern programming. Maybe all languages are capable of expressing some mathematical model, but they do so in completely different ways, with completely different limits, and completely different measures of efficiency. Not to mention that software and web development usually have nothing to do with math. You can't write device drivers in Javascript, you can't write client-end browser code in assembly.

No, either of those could definitely be done (in fact the browser one would be pretty easy). Also, I strongly disagree with you on math.

Wybiral
December 2nd, 2007, 07:15 AM
No, either of those could definitely be done (in fact the browser one would be pretty easy). Also, I strongly disagree with you on math.

OK. How do I go about getting assembly code to execute in my viewers browsers? Or controlling DOM objects in assembly for that matter. And theoretically, yes, you could compile Javascript into machine code and write device drivers. But the lack of kernel libraries, compiler, and the shear loss of efficiency makes that a worthless option.

Where's the practicality here? The potential to do something doesn't justify itself. Is it practical? Efficient? Well supported? Those are the questions you need to ask in a real-world situation. Not "is it Turing complete"?

LaRoza
December 2nd, 2007, 07:30 AM
Where's the practicality here? The potential to do something doesn't justify itself. Is it practical? Efficient? Well supported? Those are the questions you need to ask in a real-world situation. Not "is it Turing complete"?

What? Don't you know Malborge (http://www.lscheffer.com/malbolge.shtml) is Turing complete? Lets all use it....

tyoc
December 2nd, 2007, 08:02 AM
For "counterback" arguments about turing machines (or say, yes we know that already), I remember you that it is a model (that prove some things about computation), from what I see...

Execution base is is different than the language using it.


yes, all turing complete langs are equivalent, from what I remember it was enough to have loop, branch and follow (aka structured programming, IIRC structured programming has been prove to be equivalent in some way...), the fact is that we don't program for a turing machine, we program with a different model that mathematically have the same semantics at end (and at the end all is exec at processor and memory).



I mean, if we have in the back a execution environment that make all implementation of langs equal/equivalent (being what we call script, compiled, JITed, etc...), that mean memory eficency, minimal cicle count, and all vars equal for all, a "NORMALIZED" execution environment for all langs and that behave like you want ie: script, jited, compiled or combinations (erase that barrier),, then we can start argee about what of the langs has best semantics for certain type of problems than other, we can start analyse langs for what they are actually, not for what they are named:

* memory eficency??, go with C or if you are master asm)
* cross-plataform?, go with java, python, perl, etc, etc...
* RAD?? take java Matisse, other real RAD products supporting X lang
* game programming? C++ for efficency and OO
* scripting?, bash
* financial? cobol!!!

When analising a lang, in other words, analise it because what they are actually, and not because the back *** supporting them.

I mean, what if it where more efficient for computers to be scripted than compiled? or jited than compiled?, what if all executions in different langs where at the same speed?, you see this things can change from time to time, but still the definition of the langs will still be the same.


In other words compare apples to apples, if you gonna compare 2 langs, compare the 2 langs, not the back, like ey! my lang is compiled, but your is scripted and that is sh*t, that only mean that the supporting back *** is different... you know is different compiled than scripted, than jited. But the implementations of langs may change, for example, there is native execution of java opcodes, there was some time (like I know) lisp machines (and I guess there are still now), doing some work even you can use the java VM for other langs, or for the infamous .net... all that is implementation and has nothing to do with the features that appeal to human knowledge and usage... about the usage and expressionism that 1 person use (remember there is no ring to rule them all, and not bullet proof to all).

For be more rough, 1 think that support the back *** of all those langs are that they are turing complete.

Dont know, but I think this make it clear and clean.

CptPicard
December 2nd, 2007, 02:52 PM
Yeah, it is. If the Church-Turing thesis is correct then anything that is Turing complete is equally functionally capable.

You're correct, but claiming C-T thesis correctness is still a stronger statement than what is being talked about. One still leaves the door open to more powerful computation than TM, unlikely as it may be... and our statements on programming languages really rely on the TM-equivalence class (in the sense that your language X can do what TM can do and it can't do what TM can't do), without making additional assumptions whether it actually is the end-all, be-all model of computation that can handle anything computable. It's just that there isn't a counter-example... yet?

The C-T thesis is likely, but one doesn't need to invoke it :)



Another reason why Turing completeness doesn't mean anything in modern programming. Maybe all languages are capable of expressing some mathematical model, but they do so in completely different ways, with completely different limits, and completely different measures of efficiency

I'm just QFTing, these are such strong statements that it's really hard to construe your later backtracking post from this ;)

Seriously, my own personal experience is that switching algorithms beats switching languages any day. Practical aspects are there, but they're not the hard limits of what you can do.

Wybiral
December 2nd, 2007, 06:30 PM
I'm just QFTing, these are such strong statements that it's really hard to construe your later backtracking post from this ;)

Seriously, my own personal experience is that switching algorithms beats switching languages any day. Practical aspects are there, but they're not the hard limits of what you can do.

I don't see how I backtracked, but regardless practicality is choosing the right tool for the job. You could say something like "bikes, cars, and semi-trucks are all equivalent because they're all equally as capable of land travel". The problem is that they all have their advantages and disadvantages. Could you make it across the country with a bike? Sure, but it takes a heck of a lot more man-power. Could you make it through the woods with a truck? Sure, but you have to clear our some trees first (whereas a bike would have no problem).

The problem with theoretical capability is that is doesn't hold its weight of practicality. If someone asks "Which language is better for parsing XML documents: Assembly or Python?" and you answer "It doesn't matter, they're Turing complete!" then I would call you an idiot. If someone says "I need to do a lot of REing but I don't want a bunch of 3rd party dependencies, should I use C or PERL" I would hope you didn't spit out some Turing-completeness BS.

Development-time efficiency is the biggest reason why Turing completeness doesn't apply to most programming. It's possible to do anything in Assembly or Brain****... But it's not efficient. Tell your boss "I'm going to design all of the server-side code for this new website in Brain****, but it's OK because it's Turing complete." and you'll probably get laughed at, or fired. You can cling to your theoretical models if you want, but it's not going to help you much in the real world (where practicality beats theoretical potential).

CptPicard
December 2nd, 2007, 06:44 PM
I don't see how I backtracked, but regardless practicality is choosing the right tool for the job.

Your statement was rather unequivocal "Turing-completeness is irrelevant" -- which is a lot to say no matter how much you believe that "practical" aspects override theoretical ones.


Could you make it across the country with a bike? Sure, but it takes a heck of a lot more man-power. Could you make it through the woods with a truck? Sure, but you have to clear our some trees first (whereas a bike would have no problem).

Yet, it takes the same amount of energy from food/gasoline/whatever to move one kilogram of your *** across the country, regardless of the means of transportation, no matter which way you choose.


The problem with theoretical capability is that is doesn't hold its weight of practicality.

No amount of practicality will hold its weight in the face of theoretical limits. If only I got € 1 each time I hear anecdotes of some pragmatic programmer trying to solve a known NP-complete problem through assorted haxory and using the language du jour :)


If someone says "I need to do a lot of REing but I don't want a bunch of 3rd party dependencies, should I use C or PERL" I would hope you didn't spit out some Turing-completeness BS.

If, on the other hand, you're writing that RE library, you'll be implementing the same FSA-stuff regardless of language, and your end result will be just as powerful from the formal languages point of view.


Development-time efficiency is the biggest reason why Turing completeness doesn't apply to most programming.

From the software engineering viewpoint I'm not disputing this, but calling theoretical considerations irrelevant is much. One could even say that Turing-completeness actually allows you to make all these choices based on what happens to fit the problem best at the moment, as long as the language isn't being fit too tightly to the problem, thus losing generality.

By all means one should choose the right tool for the job, with the understanding that the underlying computational theory isn't going anywhere. This is particularly important for our n00bs here to understand, as there is so much useless bothering about whether they're learning the "wrong" language or not...

Wybiral
December 2nd, 2007, 07:00 PM
From the software engineering viewpoint I'm not disputing this, but calling theoretical considerations irrelevant is much. One could even say that Turing-completeness actually allows you to make all these choices based on what happens to fit the problem best at the moment, as long as the language isn't being fit too tightly to the problem, thus losing generality.

By all means one should choose the right tool for the job, with the understanding that the underlying computational theory isn't going anywhere. This is particularly important for our n00bs here to understand, as there is so much useless bothering about whether they're learning the "wrong" language or not...

You're still misunderstanding. I get that it's useful for discussing computational theory and that it has a purpose academically. But in real-world situations, considering all modern languages are Turing-complete, practicality is more of an issue. I DO look over my tool set before I start a project because I've seen first-hand how certain languages make certain tasks easier (or more efficient in some measure). I don't sit around thinking about theoretical potential, I think about practical solutions and which language has the most relevant strengths/weaknesses.

CptPicard
December 2nd, 2007, 07:13 PM
How can you then disregard the very theoretical statement that allows you to make such choices in the first place? It *allows* you to be pragmatic :)

Conversely, it's also the reason why can't code in HTML, although it is pretty good for its set purpose -- describing web pages.

Okay, let's agree we both understand quite well what the other one is saying, but simply emphasize different viewpoints. I just happen to consider the algorithmic aspects first, and condemning something quite fundamental to a status of "irrelevance" is not going to produce any more insightful computer scientists out of the beginners here...

Wybiral
December 2nd, 2007, 07:26 PM
I just happen to consider the algorithmic aspects first, and condemning something quite fundamental to a status of "irrelevance" is not going to produce any more insightful computer scientists out of the beginners here...

In real-world application of software development, where all languages are Turing complete, and practicality and efficiency are what matter. Yes I consider it an irrelevant issue (to my line of work). To people interested in computational theory, then it's completely relevant.

As for the beginners around here, I'm not their baby-sitter and I don't care how they interpret what I'm saying. In real-world programming, this simply is not an issue. Practicality IS.

I think we do get what each-other are saying, but I feel that you care more about the theoretical potential or academic side of the problem rather than seeing the real-world side. In reality, software development extends way beyond issues of theoretical potential. Ask your boss what he/she thinks you should be concerned about more: efficiency (whether it be runtime/development time/security) or theoretical potential.

CptPicard
December 2nd, 2007, 07:44 PM
In real-world application of software development, where all languages are Turing complete, and practicality and efficiency are what matter.

And to restate, Turing-completeness pretty much gives you that freedom to choose the right tool for the job. That's also why I bring it up to beginners who agonize about the right language!



As for the beginners around here, I'm not their baby-sitter and I don't care how they interpret what I'm saying. In real-world programming, this simply is not an issue. Practicality IS.

I'd hate to ride in a future car that was built by an engineer who thought physics was irrelevant and was built by some ad hoc seat of pants pragmatism. If your traction is less than your tangential forces, you're screwed :)


I feel that you care more about the theoretical potential or academic side of the problem rather than seeing the real-world side. In reality, software development extends way beyond issues of theoretical potential.

Correct, but I don't think I am being nearly as unconditional, and I feel you discredit the "academics" too much. All software development happens strictly within the confines of its theoretical potential, and not understanding this results too often in systems that are hopelessly misdesigned because of underestimating this.


Ask your boss what he/she thinks you should be concerned about more: efficiency (whether it be runtime/development time/security) or theoretical potential.

Oh, he's very much concerned about theory, as one of our most central problems happens to be clique (http://en.wikipedia.org/wiki/Clique_problem), that I just need to be able to handle to the best of my capacity... had I not actually proven the issue, we would still be arguing whether I'm just being slow or whether there is an actual reason to why the rather simple-looking issue is so "hard" to solve!

tyoc
December 2nd, 2007, 09:32 PM
Im passing good with you guys or fun?, because you are argee about the same thing 1 time and the other, none of you is willing to accept the "other side" as valid as "your side".
Yes, if a language is turing complete, then has equal computational power that any other lang (even it is to focused to a problem, if it is turing complete, it is. That mean if you dont care of that OK and fine, but the thing that you dont care doesnt mean nothing to computation and the equivalence that exist like a fact).
A language, "eliminating" all the back implementation support or normalizing it (I mean eliminate the "superfluos" to analize a lang like: who does it, which APIs are there, documentation, user base, old implementation of compiler/interpreter/VM, etc etc, all that that is superfluos to a language in itself) like: memory efficiency, exec speed, interpreted, compiled, JITed, and other techniques. Even taht you "eliminate" all that the language Still have some properties that appeal directly to human interaction, is more easy to read python, java and other "HLLs" than brain**** or other related, also you can give equality knowing that is turing complete, also for some people is more easy to code C++ than java or C#, even for some people is more easy to code asm than java, perl, etc. And that is because each human is different. Still the lang even that humans are different, have some properties that can be evaluated from is own context, and perhaps compared to others, but when doing that, don't relly in what humans think of them ;) (because each one think different, different POV, different experience, then is not fair assume your POV rule all), there are to little investigations about human argue in this regard ;).Only for show you more, there where a lot of machines constructed before without know the "physics behind them" or there where "barcos" or navies before we know the complexisty of fluids, gravity and all those things, but still that we can do all those machines before, doesnt mean that all what we have discovered, isn't there before we see it (we discover, we dont invent things and they apear spontanoulsy in the nature because we discover them, they are and have been there always, we know it or no). Then from my POV you are argeen to mcuh about the same and nothing :P.

Fbot1
December 3rd, 2007, 03:07 AM
Where's the practicality here? The potential to do something doesn't justify itself. Is it practical? Efficient? Well supported? Those are the questions you need to ask in a real-world situation. Not "is it Turing complete"?

I think you're missing my point. Impossible and impractical are quite different. No one here is say something like "Oh its Turing-complete so its just as good". shawnhcorey's main point is that no language "adds" they only look like stuff. My point is that neither Alan Turing or Alonzo Church proved the Church–Turing thesis. I think CptPicard point is that Church–Turing thesis isn't needed to prove them equal, I agree but, I don't think that really applys to my or shawnhcorey's post. Look at this:



Every high-level language is Turing-complete. And most other languages are; from assembler to Brain****. And every language that is Turing complete is equivalent.

That's what Alan Turing proved. And yes, they are equal, the only difference is syntax.


Okay, this really annoys me. That's not what Turing proved. IMHO it's extremely insulting to misunderstand someone's work like that. Turing hypothesized that there is nothing more functionally capable then a Turing machine.

shawnhcorey isn't just saying that some languages are equal but, that no languages can be more then [insert your favorite Turing-complete languages here] (which indeed does require the Church–Turing thesis). So I think everyone is mostly on the same page.


OK. How do I go about getting assembly code to execute in my viewers browsers? Or controlling DOM objects in assembly for that matter.
You make a special browsers that assembles something tagged in some way along with a library and the page's info.

pmasiar
December 3rd, 2007, 03:33 AM
We need to carefully distinguish between
- problems which are computable, even if very hard (like writing DOM manipulation is ASM), so we are sure that given time, we could implement it correctly, and
- problems for which we can **prove** that no deterministic Turing machine can solve them, even if given all the time. This is the crap what they teach in CompSci - so you don't waste time trying to square the circle. We can prove that it it impossible, regardless how smart programmer is.

see:
http://en.wikipedia.org/wiki/NP_%28complexity%29
http://en.wikipedia.org/wiki/NP-complete

But I am not sure how NP-completeness is specific to Python :-)

CptPicard
December 3rd, 2007, 01:24 PM
- problems for which we can **prove** that no deterministic Turing machine can solve them, even if given all the time.

Actually, no need to restrict yourself to deterministic TMs -- non-deterministic ones are just as limited, although "faster" :)

jfinkels
December 5th, 2007, 07:14 AM
Sorry to bring back a dying thread buuut....

http://xkcd.com/353/

(note the alt-text)