python – Imaginary Billboards http://www.imaginarybillboards.com Imagined things Thu, 28 Jan 2010 02:15:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.11 If perl is write-only… http://www.imaginarybillboards.com/?p=61 http://www.imaginarybillboards.com/?p=61#comments Thu, 03 Sep 2009 13:43:52 +0000 http://www.imaginarybillboards.com/?p=61 Then python is read-only.  Think of it.

Both have a shebang line, and after that import (use) lines.  Perl’s are mostly optional – for sysadmin stuff you’re usually just doing your boilerplate strict and warnings.  Of course, even that is optional.  Technically anyway.  For python, you need to import something to do absolutely anything.   Which is okay – it shows you what is being used.

Then on to the real work.  In perl, you start out with the program.  It’s right there.  If you want to see the logic, just open the file – it’s usually at the top.  Python is the opposite – you have to declare your objects and functions higher up in the file before you can use them.   I couldn’t say you have to declare them before you use them because in practice you’re coding along and think “hey, this should be a function” and zoom down a bit and add it, then go back to the logic.  You’re still doing them before.

So you have your listing of objects and functions somewhere, and the actual program logic somewhere.  But this shows one difference between the two.

Perl cares about doing things.  Python cares about defining things.

]]>
http://www.imaginarybillboards.com/?feed=rss2&p=61 3
yet another python vs perl post http://www.imaginarybillboards.com/?p=20 http://www.imaginarybillboards.com/?p=20#respond Tue, 30 Nov 1999 00:00:00 +0000 http://www.imaginarybillboards.com/?p=20 “Oh yeah, perl can do that without adding a library. Stuff’s just built in”

Perl: “here’s a chainsaw, use it however you want”

Python: “You’ll use this bowie knife exactly how I tell you to, asshole”

Actually, there are more that just came up not long ago. There’s a monitoring system built in python that we’re using. In a perl system, it’s usually easy to add or remove things – it’s stored in a database or flat file of some arbritary format. For this, though, you *have* to use the python interface. Ugh. “Why would you want to use anything else”???

Now *that’s* python vs perl.

]]>
http://www.imaginarybillboards.com/?feed=rss2&p=20 0