Python or Perl?

The place for chatting and discussing subjects unrelated to Wesnoth.

Moderator: Forum Moderators

Python or Perl?

Python
19
73%
Perl
7
27%
 
Total votes: 26

User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Python or Perl?

Post by Gambit »

Ruby is hardly "traditional". And python bears no resemblance to java, but perl looks just like it.
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Python or Perl?

Post by ancestral »

Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re: Python or Perl?

Post by Viliam »

ancestral wrote:Perl is sexier: There’s more than one way to do it!
This is why reading other people's Perl code is always such a pleasure... :lol2: :lol2: :lol2:


Python versus Perl is a question of what you hate more:

a) language with inconsistent syntax, for example array is "@a" and is indexed like this "$a[$index]", while "$a" is a completely unrelated variable; also magical global variables like "$_" that are used automatically, which makes some bugs difficult to find

b) language where invisible characters are syntactically significant, so a line starting with 8 spaces is not the same as a line starting with 1 tab, even if they look exactly the same in editor


Of course there are other popular language choices, like:

* Java where you write 100 lines of code to achieve the same functionality as 1 line of Perl code, or

* C/C++ where for every line of code you must write two lines of makefile to make it compile correctly, and you can never be sure if number 1000 can fit into "int" variable; and the macro "OMGSOMETHING" declared across twenty libraries usually expands to empty string depending on position of Neptune in zodiac, or

* PHP where anything can mean anything, depending on your provider's "php.ini" file that you usually can't see.
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Python or Perl?

Post by Dixie »

Viliam wrote: Python versus Perl is a question of what you hate more:

a) language with inconsistent syntax, for example array is "@a" and is indexed like this "$a[$index]", while "$a" is a completely unrelated variable; also magical global variables like "$_" that are used automatically, which makes some bugs difficult to find

b) language where invisible characters are syntactically significant, so a line starting with 8 spaces is not the same as a line starting with 1 tab, even if they look exactly the same in editor
And for the sake of curiosity, which language would be which? If I had to guess, I'd say a) is Perl and b) is Python, but I really dunno. I have been thinking of maybe picking up some language (python?) for a yet undetermined project this summer, so this is of relative interest to me :)
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Python or Perl?

Post by Gambit »

Yep. A perl. B python.

Because of A, never do Perl without the strict and warnings modules. It might nag you (like a wife), but it really is good for you in the long run (like a wife?). What? I was trying to keep up with the Perl is sexy stuff. :(
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

Re: Python or Perl?

Post by Velensk »

Viliam wrote:...
That was interesting and fairly accurate as far as my knowledge goes (I have minor experience with Java and C++). Would you care to make a corresponding comment on the languages strengths?
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re: Python or Perl?

Post by Viliam »

Velensk wrote:That was interesting and fairly accurate as far as my knowledge goes (I have minor experience with Java and C++). Would you care to make a corresponding comment on the languages strengths?
I am a natural born pessimist, which is probably not very good... unless you work in computer security or testing, when the "I already see hundred things this could go wrong" brings you money. :lol2:

The strengths... well, all these languages are Turing complete :P and also:

Pascal -- easy to use
C/C++ -- fast, great for deep understanding how the machine works
Java -- portable, garbage collection, great documentation
Perl -- powerful at text processing
Python -- concise, easy to read
PHP ...sorry, there is no advantage in PHP :roll:
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Python or Perl?

Post by Gambit »

Viliam wrote: PHP ...sorry, there is no advantage in PHP :roll:
If I may throw one more in (namely as an alternative to PHP):

ColdFusion good: It's a markup language so it matches the HTML you're already using on your web applications, and has easy abstracted access to many other technologies like AJAX and Java.

ColdFusion bad: The Adobe server is extremely expensive and the FOSS alternatives are missing a few features in comparison to it (mostly related to those easy abstracted accesses and not the core of the language). Hosting is also a lot rarer and tends to be slightly more expensive.


It's not a common language (it doesn't belong on your list), but I love it.
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: Python or Perl?

Post by pauxlo »

The (only?) advantage to PHP is that usually even the cheapest of webspace providers provide it with your webspace (with a provider-dependent php.ini which you even can't see), while everything else is depending on the exact offer.

(And yes, one can create quite big projects in PHP, I happened to maintain one (a participant administration program for esperanto meetings) for some years.
PHP is still better than Perl for this kind of stuff, I would assert. I would not have started this project from scratch in PHP, though.)
User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Python or Perl?

Post by Dixie »

One of my friends seems to be into Erlang (he made the linked toturial). I've talked a bit about it with him but had much less knowledge about programming languages at the time and didn't understand much. I don't see/talk to him much nowadays, but I wondered if any of you knew that language and what were your thoughts about it?
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
User avatar
Iris
Site Administrator
Posts: 6797
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Python or Perl?

Post by Iris »

pauxlo wrote:The (only?) advantage to PHP is that usually even the cheapest of webspace providers provide it with your webspace (with a provider-dependent php.ini which you even can't see), while everything else is depending on the exact offer.
Some providers (like nearlyfreespeech.net, which hosts my website) provide a page where you can see the details of their default PHP configuration, or you can make one yourself like this:

Code: Select all

<html>
  <head>
    <title>PHP test</title>
  </head>
  <body>
    <?php phpinfo() ?>
  </body>
</html>
Anyway, I find the ability to write inline code anywhere — as in the example above — while keeping static HTML/XHTML/XML in a natural format in the same file to be an advantage in many cases.

If you need to find examples of large software written in PHP, look no further than phpBB and other popular online discussion board software such as vBulletin, MyBB, PunBB, Invision and SMF (more). There’s also MediaWiki, Wordpress and Drupal amongst other popularly used CMS software.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Post Reply