The Artima Developer Community
Sponsored Link

Web Buzz Forum
Why I like Python

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Stuart Langridge

Posts: 2006
Nickname: aquarius
Registered: Sep, 2003

Stuart Langridge is a web, JavaScript, and Python hacker, and sometimes all three at once.
Why I like Python Posted: Mar 7, 2005 10:09 AM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Stuart Langridge.
Original Post: Why I like Python
Feed Title: as days pass by
Feed URL: http://feeds.feedburner.com/kryogenix
Feed Description: scratched tallies on the prison wall
Latest Web Buzz Posts
Latest Web Buzz Posts by Stuart Langridge
Latest Posts From as days pass by

Advertisement

Schwuk makes reference to a post of Rory’s on why Python is no good. As Schwuk says, I might get annoyed by this, and he’s pretty much correct here.
You see, I think that a reasonable proportion of Rory’s complaints are a bit lacking. Take his complaint that you have to explicitly pass “self” to methods:

Sure, having to add self to a parameter list once isn’t any big deal, but three-hundred methods later, when the ink is worn off the S, E, L, and F keys, you might be thinking differently about it.

Take a glance at your close-curly-bracket key: }. Has the ink worn off that? If it has, then I’ll start to listen to your complaint more. If it hasn’t then, well, obviously extra unneeded characters, like C’s curly brackets, aren’t that big a deal, eh?

I would have respected a choice to have ditched all 1.x hacks, but instead they were carried over to 2.x, so now we had the choice of doing things procedurally or Object Orientedally (yeah – I made that word up – bite me). What a bloody mess! Let’s see… Do I want to work with functions on my strings, or do I want to work with members of the string object? I hate that kind of crap.
I utterly don’t agree here. OO gives you the power to write decent proper applications; I entirely agree, and I pretty much find that anyone writing anything even vaguely substantial in Python uses OO to do it. But constricting the user to write in OO style is a massive pain in the arse when you just want to throw out a quick script. I find myself doing things like
grep "some regexp" /some/file | \
python -c "import sys;print '\n'.join([x.split()[3] for x in sys.stdin.readlines if x.split()[6] == 'word'])"
If I had to wrap that in a load of OO bullshit it’d be loads more complex for no reason. Similarly, a lot of the Python I write is short scripts to, say, grab an RSS feed and rip some data out of it (the thing that reposts my SitePoint articles here is like that). Again, this is a quick procedural script: start at the top and work through the lines. They quite often don’t even use functions. If I had to swaddle that in OO bollocks it’d be more complex and slower to write and I would derive no benefit from it.

Notate bene primus: Perl people are saying “what’s all that sys.stdin.readlines() shite? This is what perl -n is for!” They’re right; Perl is even better at this sort of thing than Python is. I find that Python hits the sweet spot between the two; others differ.

Notate bene secundus: yes, I suppose I could do similar stuff with a sed/awk pipeline without going into Python. Fuck off.

Notate bene tertius: “orientedly“.

He’s right about all the underscores, though. Constructors being called __init__ is a pain in the arse.

In short, I disagree. However, each to their own and all that…

Update: further discussion on Schwuk’s original post.

Read: Why I like Python

Topic: Free S9Y Bloghosting Previous Topic   Next Topic Topic: Get GMail invites here

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use