• submit to reddit
Fredrik Håård01/23/12
1908 views
0 replies

What's the Point of Properties in Python?

A few days ago I was asked by a collegaue what the point of properties in Python is. After all, writing properties is as much text as writing getters and setters, and they don't really add any functionality except from not having to write '()' on access. On...

Swizec Teller01/22/12
4981 views
2 replies

Are you a boy scout coder?

The Boy Scouts have a rule: “Always leave the campground cleaner than you found it.” If you find a mess on the ground, you clean it up regardless of who might have made the mess. /../ the original form by Robert Stephenson Smyth Baden-Powell, was...

Steve Ferg01/22/12
1352 views
0 replies

Newline Conversion in Python 3

I use Python on both Windows and Unix.  Occasionally when running on Windows  I need to read in a file containing Windows newlines and write it out with Unix/Linux newlines.  And sometimes when running on Unix, I need to run the newline conversion in...

Julien Danjou01/22/12
2019 views
0 replies

Python sets comparisons

This week I lost some time playing with Python's sets. After digging into Python source code, I finally discovered there is what seems to be little bug. Anyway, it has been "fixed" in Python 3, fortunately. I did not find if it was reported...

Eli Bendersky01/21/12
5096 views
0 replies

Python threads: Communication and Stopping

A very common doubt developers new to Python have is how to use its threads correctly. Specifically, a large amount of questions on StackOverflow show that people struggle most with two aspects:

Rick Copeland01/20/12
5607 views
2 replies

Lazy Descriptors in Python

Today I had a need to create a property on an object "lazily." The Python builtin property does a great job of this, but it calls the getter function every time you access the property. Here is how I ended up solving the problem: First of...

Giuseppe Vettigli01/20/12
6057 views
0 replies

Face and Eye Detection in OpenCV

The goal of object detection is to find an object of a pre-defined class in an image. In this post we will see how to use the Haar Classifier implemented in OpenCV in order to detect faces and eyes in a single image. (Note: this article is part of a series...

Swizec Teller01/20/12
17216 views
18 replies

DZone Top Article of 2011: Programmers are f***ing lazy

With the possible exception of philosophers, programmers are the laziest bunch of people I know. It seems like everyone else I speak to has some sort of labor intensive profession. Think about it, biologists do all those experiments … giving a drug to...

Tony Russell-rose01/19/12
10999 views
0 replies

Designing Search (Part 1): Search Box Design

This is the first installment in a series of tutorials on creating the right search utility for your use case.  In this part, you will learn how to make the right decisions when picking a design for your search box.

John Esposito01/18/12
22530 views
23 replies

DZone Top Article of 2011: Ask DZ - What's the best programming advice you've ever got?

For example, Travis Griggs' blog post explains some of the best OOP advice he ever received.What is the best piece of advice anyone ever gave you, and why it was so good? Maybe include some particular projects the advice helped you with, or how the advice...

Steve Ferg01/18/12
1606 views
0 replies

Read-Ahead and Python Generators

One of the early classics of program design is Michael Jackson’s Principles of Program Design (1975), which introduced (what later came to be known as) JSP: Jackson Structured Programming. Back in the 1970′s, most business application programs did their...

Stoimen Popov01/17/12
7260 views
0 replies

Algorithm of the Week: Data Compression with Bitmaps

In my previous post we saw how to compress data consisting of very long runs of repeating elements. This type of compression is known as “run-length encoding” and can be very handy when transferring data with no loss. The problem is that the data must...

Eli Bendersky01/17/12
1845 views
0 replies

Shared Counter with Python’s Multiprocessing

One of the methods of exchanging data between processes with the multiprocessing module is directly shared memory via multiprocessing.Value. As any method that’s very general, it can sometimes be tricky to use. I’ve seen a variation of this question...

Giorgio Sironi01/17/12
4124 views
0 replies

Python Hello World, for a web application

python -m SimpleHTTPServer is a very handy command that sets up a server listening on a port (by default 8080) having as document root the current directory. However it does not count for the purpose of this article: producing our first dynamic page with...

Eric Genesky01/16/12
3100 views
0 replies

PyPy Team Trying to Go Multicore

The PyPy team has updated their progress on getting rid of the infamous Global Interpreter Lock in Python.  According to their previous post, the team was attempting to approach the problem using Software Transactional Memory, a relatively recent development...