in Search
Welcome to Neopoleon - Sign in | Join | Help
Navigation: Home | Forums | Galleries

Python-O-Rama

[Note: I don’t mean to pick on you, Stuart, but you brought up a lot of points that I wanted to argue, I actually really enjoyed your post, and there isn’t anything personal about this. But I know that I can be a bit abrasive at times, so I do apologize if I come off wrong here. To make up for it, I’ve tried to give you some google juice :) ]

After reading comments and posts in response to my Python post, I’m thinking that I ought to clarify a few things.

Thing One

I still think Pink Floyd sucks the big stinker. Let’s not make any mistake about my position where that band of pompous ding-a-lings is concerned.

Thing Two

I mentioned that I hated having to add self to parameter lists for method declarations. It’s been mentioned on Stuart Langridge’s blog, as well as in the comments here, that C# can be targeted for similar pointless typing exercises, and most notably in the curly bracket ( {} ) department.

In my post, I was basically complaining that, in spite of its clean start, Python still managed to come along with some pointless syntactic thingy-dingies. C#, on the other hand, is clearly a C-like language, and some archaic bits were carried over.

That said, self requires a lot more typing than { or }.

I’ll admit that I am no longer toeing the line of petty concerns, but have leapt right over it, leaving my dignity on the other side of the fence.

I hope I don’t let myself get dragged into an argument in which a few of us actually attempt to figure out which language requires more keystrokes.

And, by that, I mean that I hope I do. I just don’t want to admit it.

But it would all be beside the point. The point is this: C# is an extension of the past whereas Python is a very modern creation, and the choice was there to make it uber-clean.

A choice was made.

It was the wrong one.

Thing Three

Stuart Langridge left a comment in Schwuk’s blog in which he mentions that self doesn’t have to be in a method declaration’s parameter list.

Great, but not including self makes the method static.

This would be useful if, oh, I don’t know, 98% of my methods were static, but they aren’t. It’s the other way around.

This strange bit of syntax makes me think that it’s preferred that methods be static, as it’s more difficult to create instance methods.

Maybe that’s good for small bits of scripting, but what if I want to write an actual application?

Does anybody know if there’s a way to create global variables in Python? I think they’d compliment this feature well.

Anyway, a static keyword would have been nice.

Thing Four

Also in Stuart Langridge’s comment in Schwuk’s blog is this argument:

The fact that Python can work procedurally as well as object-orientedly doesn’t seem to me an argument that it’s not a good programming language. The simple answer is: don’t do that, then.

I just don’t agree. Go one way or the other, but don’t give people the choice of either. Not because I don’t think it can be done, but because I have little confidence that it will be done, and I, along with swarms of other people who were scarred from this aspect of VB6, have developed an alarmist type reaction to this mode of coding.

Choice is almost, but not quite, as overrated as Pink Floyd.

Choice sounds great in a warm and lovey-dovey “free-as-in-speech” way, but in reality makes decisions more difficult, and leaves people stuck, staring at a screen, wondering how to proceed. This is fine for things like spoken language where expression and mood are important, but not in a programming language where intention should be clear.

And now, if you’ll all excuse me, I have a flame-retardant suit to don :)

Published Friday, March 04, 2005 6:48 PM by Rory

Filed Under:

Comments

 

Clint said:

So I'll play fence-rider.

I agree that Python shouldn't play both fiddles (OO/Scripting). It complicates decisions if this is the only language you are using to build an app. Yet, I agree that having the option is pretty nice. I mean if I want to get jiggy with a inline script somewhere, that's cool.

Doesn't it come down to the Ward Cunningham approach of "I can write some 200 different languages"? I mean, I have a 20lb sledge hammer out in the garage. And let's say I'm working on the kitchen sink. I know for a fact that the sledge will take the kitchen sink out, literally out of the wall. But, I also know that I have a pipe wrench right in front of me in my "toolbox". I think, if I have a tool that keeps me from getting up and going to the garage to grab the sledge, it's probably a better tool to use. So you see, both work, but one is more appropriate. Unless, your just a crazed ass-crack meth-pipin plumber.

I stole this analogy from Kent Henderson's Guru to T-SQL book and I think of each time I hear people argue about which language is the cat's ass, and others suck hind tit.
March 4, 2005 7:21 PM
 

Kevin Daly said:

The choice thing is actually one of the reasons I prefer C# to VB.NET: I don't like the way VB.NET has a dollar each way by still supporting the (huge) old function set rather than just relying on the Framework, although I understand that's necessary as a nod toward backward compatibility, and I also understand that many (thousands) of people prefer it that way.
I'm just personally happy that C# isn't carrying that particular baggage (which oddly enough it coud be argued is itself an inheritance from C, since the latter is a small language with a rich set of libraries)
March 4, 2005 7:26 PM
 

Michael Giagnocavo said:

Rory, where/how would you eliminate some { } in C#?

Kevin: The VB intrinsic functions are not available in the framework. For example, VB's "casts" and so on contain a ton of conversion logic so that you can work in a type-free environment. :)
March 4, 2005 8:41 PM
 

Rory said:

Clint -

I agree that it's good to have a wide and varied toolbox, but ask yourself this: Would you rather use a dedicated screwdriver, or the weak-ass afterthought that's in your Swiss Army Knife?

They both work, but one is a piece of shit.

I feel like languages that mix are more akin to the Swiss Army Knife set of tools - there's a choice, but there's also a compromise in quality.
March 4, 2005 9:11 PM
 

Rory said:

Michael -

I wouldn't actually do much of anything to change C#. It's a C language, and I expect a lot of Cness.

The one thing I'd change right off the bat, though, is the naming of constructors. I still feel that there should be one standard constructor name.

I actually happen to *like* curly braces and semi-colons...

But I don't like that Python has similar baggage when it doesn't have anything to answer to but itself.
March 4, 2005 9:14 PM
 

Michael Giagnocavo said:

"C# can be targeted for similar pointless typing exercises, and most notably in the curly bracket ( {} ) department"

I just wondered if there was any place where the braces are pointless. I think perhaps the only place they could be eliminated would be for a bodyless constructor:

public ClassName; (instead of public ClassName {})

would work (but this looks dumb).
March 4, 2005 9:58 PM
 

Cliff said:

Dare I inject a Java based comment on this blog? Rory, I read your blog all the time and I'moften afraid to comment because of my religious ties the the Java platform. However I have to disagree on your comments regarding choice. As someone who recently switched to Linux and gets the joy of choice beaten bludgingly out of him daily from the various options of just playing an mp3 file, you'd think I'd agree with you. You're off on a few things.

Thing One:
Choice is NOT almost as overated as it appears. Choice gives freedom to innovate and explore new territory. Viewing it as overated leads to contention which ends up in status quo. I hate status quo more than I hate searching through a list of 15 different media players just to hear Fantasia's latest hits. So for that reason I'd pitch Windows MEdia player (and the whole OS for that reason) in the recycling reciptcle just so I don't end up part of a mindless society of people who are content with whatever DRM loaded crap Redmond decides to deliver.

Thing two:
(Has nothing to do with anything you're off on.) I love Windows and Hate Linux for the very reason you've outlined. While thing two here contradicts thing one entirely I have to voice it. The thing is I can't go whole hog with one extreme or the other. I wish there were a middle-of-the-road-have-your-cake-and-eat-it too technology that I could point to that would explain my point. Java comes pretty close. While it doesn't hinder choice, it provides a consistency and ease of use found in the Windows UI. If Java were to follow the choice-is-bad mentality we'd all be stuck with EJB and the language would have went to pot many moons ago. It's not perfect though.

Thing Three:
(And I've forgotten what these "things" referr to now.)
While Python is not perfect it doesn't suck. (How would I know? i've never coded with it before.) It's better at some things than other languages (including C-sharp and Java) but it's worse at some things. (What those things are I don't know, and I'm sure as hell not going to start a sub-thing list inline here.)

Thing Four:
I respect you for not being over zealous in your negative Python points. However you tend to be (and understandably so) over zealous in your hyping of other languages at times. A language is a tool of expression and we all have our preferences (which can become golden hammers). Mine is different than yours which is different than Stuart's. Noe of us is more right than the other. But you already knew that being the king of the universe that you are ;oP

Regards,
Cliff
March 4, 2005 10:07 PM
 

Cliff said:

One other thing...
While I'm numbering I'll make this thing 5:
Java has nothing to do with Python! So what in the H-E-double hockey stick am I talking about???!!!
March 4, 2005 10:10 PM
 

Bob Reselman said:

Rory, dude:

Please.

Listen to the piece, Several Species of Small Fury Animals Gathered in a Cave and Grooving with a Pict, from the Umma Gumma album

The problem with Pink Floyd is that the group did not stop at that Umma Gumma. Dark Side of the Moon was a crime against humanity. DSM's musical validity was of inverse proportion to its commerical success.

Nobody to blame really. In the past we needed patrons. Now we just need scratch.
March 4, 2005 10:40 PM
 

Somedude said:

You nerds need a hobby.

All this bickering over little nit-picky things makes me wonder how you actually get any work done after putting so much effort into complaining about is.

Makes me wonder how my computer ever turns on correcty with geeks like you at the wheel of this big ship we call technology.
March 4, 2005 10:41 PM
 

Rory said:

Michael -

C#'s curly braces could just be replaced with a Pythonish system of tabs, so they could certainly be removed.

However, at that point, it shouldn't be called C#.

But they *could* be removed...
March 4, 2005 10:42 PM
 

Rory said:

Cliff -

First of all, I *was* a Java developer, so you'll have a hard time offending me there :)

I was also a Linux zealot, so I know a bit about the choices available in that camp.

When I'm talking about choice, though, I'm not just talking about technology - I'm talking about *everything*. I don't know if you read Scientific American: Mind, but there was a great article in the last issue on choice, and it really hit home with me.

Basically, choice overwhelms and confuses people - even experienced people who know their subject matter in the area where the choice is being made, and it especially frustrates those who want to make the best possible choice available (some people don't actually care - they're willing to settle for things that are "good enough").

In the OSS world, I found myself frustrated and confused by the choices I had. I realize that I don't speak for everybody, but I hated it, and it had nothing to do with freedom or anything like it.

It bothered my sense of efficiency to find so many projects overlapping in functionality. Sure, competition is good, but there are limits.

I'm rambling now. I'm writing this on my phone, and I can't see most of what I'm writing, so I'm losing context, and I'm too lazy to go back and look at what I'v already put down :)

Point being, I really do think choice is overrated.

Consumers benefit from a lack of *abundant* choice. If you had to choose a car from 5,000 different brands, each of which had its own array of models, you'd go nuts. But, picking and choosing from a few large producers? That makes the process manageable.

I also feel that lack of choice in coding can be a good thing. I'd much rather have *one* way of doing a thing than twenty. That's part of what I hate about Perl: "There's more than one way to do it."

But I'm a stickler for efficiency, so I might not be the best example of what most people want...

Sorry about the rambling.
March 4, 2005 10:53 PM
 

Rory said:

Cliff -

To follow up on your "Java has nothing to do with Python" comment, I think one obvious connection is Jython.

Jython, as the kids are saying nowadays, is da pimp shit.

Stuck on an AS400 without a good scripting option? Take advantage of the tight Java integration and use Jython.

Very cool.
March 4, 2005 10:56 PM
 

Rory said:

somedude -

This *is* one of our hobbies.

Uninformed religious argument is a staple brain food of the professional nerd.

We're not like this when we're actually working.

We're much, *much* worse :)
March 4, 2005 11:01 PM
 

Andy said:

I like choice. Choice as in C++ style of choices. Work close to the machine or high above it depending on what you need. C++ is far from perfect but for me it's the best thing going so far. Java would be a close second except it doesn't give me the bare metal access I sometimes need to get something done well. C# would be third but it's quickly creeping in on Java as it becomes easier to use cross-platform.

All of these languages give you varying degrees of choice in your designs. I think where they vary from Python is how they give choice.

Choices can be clearly defined like in C++ you can code like C (procedurally)or you can code like Java(OO) but the choice in the code is very obvious as to how you are doing it to anyone with half a brain that reads it.

Python on the other hand is one of those muddied water choices like VB6 you can never really tell right away what it was they were trying to do. Choices like this are bad.

I think it is because dynamically typed languages try and be everything to everybody rather than having distinct boundaries.

C and C++ can be used like broadswords or like scalples but nobody will mistake one for the other when they read it in the code. Python on the other hand you read it and you aren't sure if they were trying to use a scalple, a screwdriver, or sledghammer because they all look about the same.

On platforms where I have a choice like Linux between dynamiclly typed languages I would actually use Lisp before I would use Python. But then again I'd use Python before I ever touched the pure, black, pit of evil more commonly known as Perl.
March 5, 2005 1:13 AM
 

Scott said:

I see a lot of people laying into Perl. While I'm hardly a Perl apologist, I think I've written maybe 10-12 lines of Perl in my life, I don't think it's as bad as everyone makes it out to be. I think it's MISUSED often and in..... creative ways. From what I understand Perl was never meant to be an application programming language, it was meant to be duct tape. Used sparingly, perhaps to stop a leak, perhaps to make a prom dress for an attention whore. You could build a house out of duct tape but it wouldn't be a happy house. You could build an enterprise application in Perl. You could also try writing one in Bash script.

All this Python bashing is justifying my Ruby decision though. :) I'm also learning Objective-C as a hobby, mainly so I can write stupid little applications on my Mac. Objective-C is a strange duck. It's all messege-ey like Ruby and WS, but it still provides me with the same howitzer that C does so I can shoot myself in the foot if I want......err I mean "get close to the metal". hehehe

I'm with ya on the Floyd bashing though, I like some of the radio friendly songs. But most of their music reminds of my friends foundly remembering conversations they've had while they were high. WTF were they thinking, they aren't THAT deep.
March 5, 2005 2:18 AM
 

Stuart Langridge said:

Rory said:
I feel like languages that mix are more akin to the Swiss Army Knife set of tools - there's a choice, but there's also a compromise in quality.

I agree you feel that. However, you have in no way *demonstrated* that, as far as I can see. You've said that simply because Python allows both procedural and OO ways of working, the OO way of working must *by definition* be inferior to that in a pure OO language. I'm unclear whence the grounds for this assertion came :-)
March 5, 2005 6:36 AM
 

Sriram said:

Rory - you know I'm a huge fan of yours - but I have to disagree here. Just use Python for a large project- learn to code the 'Python way' and trust me, you'll love it

*Trust me* :-)
March 5, 2005 11:46 AM
 

Syd Barret said:

Rory,
You are truly just another brick in the wall and from the dark side of the moon.
Syd
March 5, 2005 4:33 PM
 

Rory said:

Andy -

"Python on the other hand is one of those muddied water choices like VB6 you can never really tell right away what it was they were trying to do. Choices like this are bad."

That's *exactly* what I'm trying to say.

Just haven't been able to find the right words.

But those would be them...
March 5, 2005 9:35 PM
 

Rory said:

Scott -

"I don't think it's [Perl] as bad as everyone makes it out to be."

Oh, yes.

It is.

"I think it's MISUSED often"

This is a *big* philosophical argument. If we go down this road, we'll spend the next few months there as we try to determine what it is that the "average" Perl coder *wants* to accomplish with Perl, *how*, and just whan in the hell an "average" Perl coder is in the first place.

Anyway, we don't need to do that, as Perl really does suck :|

"and in.....creative ways."

Monkeys sometimes paint in "...creative ways."

Like with their feces.

Doesn't make it *good*, though :)
March 5, 2005 9:38 PM
 

Rory said:

Stuart -

"I agree you feel that. However, you have in no way *demonstrated* that, as far as I can see. You've said that simply because Python allows both procedural and OO ways of working, the OO way of working must *by definition* be inferior to that in a pure OO language. I'm unclear whence the grounds for this assertion came."

The assertion came from experience in another language (VB6) that made the same mistake, as well as the time I spent dabbling in Python.

It's not that there's anything specifically wrong with Python - it's that the whole *idea* of mixing the two styles stinks like poop.

At least in my opinion, but that's what this blog is all about anyway. I sure as hell don't claim to be *right* :)
March 5, 2005 9:41 PM
 

Rory said:

Sriram, my friend...

"Rory - you know I'm a huge fan of yours - but I have to disagree here. Just use Python for a large project- learn to code the 'Python way' and trust me, you'll love it"

I just... I just don't *like* it.

I wanted to. Honestly.

Just like I wanted to like pork, pesto, and avocados.

But I couldn't.

It's just not in me.
March 5, 2005 9:42 PM
 

Cliff said:

Rory,

I along with the government disagree with you on your philosophy on choice. Regarding the government? They split up Bell atlantic many moons ago to give people a choice. Why? Because choice leads not only to competition but also innovation and lower prices. But that's just choice of telephone services. How does that apply to coding? I'm sure if George H-dubyuh could program he'd back me when I say programming choice is not a bad thing. It's more of a preference. Many people, like yourself preferr to have one way of coding something. Other's like to have the option of coding more than one way. Why is this important? One good reason is probably the biggest driving force behind Pythons many choices. Retro-compatibility. When a language is upgraded there are two schools of thought. Clean it up and make it non-comatible or maintain compatibility for the millions of developers that use the language so as to not break their existing logic. (See the deprecated javadoc keyword for detail on this.) Cleaning it up is great for cutting edge folks like us but preserving functionality is the best option for the multitude. Even Joel would back me when you read his post on How Microsoft Lost the API war: http://www.joelonsoftware.com/articles/APIWar.html. So the thing is coding choice is a good thing in some ways and a bad thing in other ways. It's bad because it can confuse people. When you think about it, the only people that are confused are newcomers to the language. For example are you confused with whether or not you should use CSharp over VB.Net? I was when I first looked at them. VB.Net is sorta a compatibility bridge thingy for VB 6 folks. In summary I'll agree with you on this. Choice can be bad when it's over done (as in the case of the many flavors of Linux). The same thing applies for anything that's overdone. (Sex, medicine, reading, eating, playing, etc.) Regarding the choices you reference in Python, I can't say if they're overdone. I never coded with the language so I really shouldn't opening my flap. So why in the Hell am I still talking here?

Cliff
March 6, 2005 1:52 PM
 

UserName said:

"That said, self requires a lot more typing than { or }."

You can't have "{" without "}" (correct me if I'm wrong).

Unless you're using a smart feature within the editor, both "self" and "{}" require the same number of keystrokes UNLESS you do "{}" together thereby saving 1 keystroke. Not sure that falls into the "alot more typing" category unless you're adding it up over the length of the typed code.

I'll leave now.

UN


March 7, 2005 7:48 PM
 

Dean Harding said:

Choice is bad when you (as the desiner of a system) are just offloading the decision-making process to the end-user.

A good example of what I'm talking about is this post: http://blogs.msdn.com/aaronbrethorst/archive/2005/03/03/384590.aspx by someone on the Visual Studio.NET dev team. Now, they have two possible designs for the tabs in the tool windows, and they're soliciting feedback on which one people like the most. That's not a bad idea, but I did notice some comments mention that there should be an "option" to choose between the two. *That* sort of choice is bad.

It's the sort of mentality which keeps me away from a lot of open source projects because you have too many designers and when they can't agree on some seemingly unimportant facet of the software, they decide to offload the decision onto the end-user, and provide an "option" to choose between two essentially equivalent things. Then the argument turns to which should be the "default" option, and when that reaches a cresendo, someone will suggest there should be an option in the *installer* to choose between the two (an example of this is when you install Winzip, it asks *in the installer* whether you want "classic" winzip, or a "wizard-style" winzip). *Then* the argument turns to which should be the default-selected option in the *installer* and things really start to get ugly (you'll notice in the winzip installer, it doesn't select either by default, which means you have to actually make a decision when you install whether you want "classic" or "wizard-style" even though you may have no idea what either of those things mean - I wonder how the decided which of those options gets put on top?).

Anyway, that was a rather long paragraph, so I think I'll just close by saying that as a designer of a piece of software (be it Winzip, or the Python language) you need to make some *decisions* and then stick with them. If you want to turn Python from a prodecural language into an OO one, it should have been called something different and not just tacked on in version 2.0 (you're no better than C++ then :p~).
March 7, 2005 11:41 PM
 

Jonathan Ellis said:

I'm surprised nobody has mentioned just how common it is to see C# (or Java) code riddled with "this." to get code assist going. (Yes, I know most IDEs have a hotkey these days so this isn't necessary. Still, it's a habit for a lot of people I've worked with. Which has driven me a bit nuts at times.)

Given Python's penchant for "No, there is NOT more than one way to do it" I think this was a deliberate choice to remove potential ambiguity. "Explicit is better than implicit" is a Python design motto.

It IS foreign at first, but I got used to it quickly after 5 years of Java and C# and way too many years of C before that. If you're going to complain about python warts, I think len(L) instead of L.length() and the like is a much stronger argument for a genuine misfeature than the explicit self.
March 8, 2005 2:40 PM
 

TrackBack said:

Whole-Brain Coding
March 7, 2005 10:13 PM
 

TrackBack said:

Learning Python and Perl
March 8, 2005 3:33 AM
New Comments to this post are disabled

About Rory

I *own* this site, you loser.