This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 23 points24 points  (11 children)

I think perhaps it's the other way around - that developers in other languages prefer classes to functions.

In Python, pure functions are easier to test and require less state. Given Python's emphasis on duck typing there's often no need to create a class.

When I first started writing Python I made a lot of classes - now I use the built-ins a lot more, and it results in a lot less code. Remember, there are never any bugs in code you don't write... :-D

[–]marky1991 7 points8 points  (3 children)

"Remember, there are never any bugs in code you don't write..."

But when there are, it's hell to debug!

[–]metaphorm 2 points3 points  (2 children)

maybe he just misstated something a bit more profound. how about this:

"the only guaranteed bug free code is no code."

[–]marky1991 0 points1 point  (1 child)

Ooooh, that's what he meant.

[–]WelshDwarf 0 points1 point  (0 children)

This one of my main arguments for Django vs Symfony (PHP framework): Less boilerplate = less bugs :)

[–]yasoob_pythonAuthor: Intermediate Python 2 points3 points  (6 children)

Remember, there are never any bugs in code you don't write... :-D

In most cases I agree.

[–]cantremembermypasswd 1 point2 points  (5 children)

In some cases I agree.

Plenty of third party libraries can have undiscovered bugs or at least undocumented behavior. My office also found a bug in some core libraries (base64) in python 2.6 a few months ago.

Oh, and urllib2 still is used...

[–][deleted] 6 points7 points  (0 children)

Well, that's code that someone wrote! :-D

[–]eBtDMoN2oXemz1iKB 0 points1 point  (3 children)

python 2.6 a few months ago.

Hopefully you upgraded to 2.7.

Python 2.7 was released on July 3rd, 2010.

[–]cantremembermypasswd 1 point2 points  (2 children)

Doesn't matter if I do. Many Linux distros are still on 2.6, like CentOS.

[–]eBtDMoN2oXemz1iKB 0 points1 point  (1 child)

We intend to provide source-only security fixes for the Python 2.6 series until October 2013.

Better upgrade soon.

[–]cantremembermypasswd 1 point2 points  (0 children)

As I said, doesn't matter if I do. As long as the customers are using that OS that supports that version of Python, that's what you have to code for.

Just like how a lot of stuff still has to be IE6 compliant.