Archive for the ‘Uncategorized’ Category

Tricks with iterators.

2010/02/25 1 comment

This post is a follow up to Iterators and Iterables Clarified. If you’re not sure how iterables and iterators differ, how to create them, or why you’d care, start there.

OK, so files are iterators which can be exhausted. Once you’ve looped over a file, it’s done. But let’s say I want to implement a file object that can be restarted. There are a couple things you can do: Probably the simplest technique is that you can create a wrapper around a file object that rewinds the file each time it gets iterated over:

A rewinding file iterable

#/usr/bin/env python

class RewindingFileIterable(file):
def __iter__(self):
return self

>>> f = RewindingFileIterable(‘names.txt’)
>>> for __ in xrange(2):
>>> for line in f:
>>> print line,

Unfortunately, this technique has two problems.
Read more…

Categories: Uncategorized

Water utilities and pricing rates

2009/11/22 5 comments

I read recently in an article in the Carrboro Citizen that OWASA is trying to increase rates because people are getting too good at conserving water, and they’re not making money. It seems patently ridiculous to me that people should be punished for saving water. On the other side of the same coin, it also seems ridiculous that the utility company should be punished for people saving water. Especially considering that most likely they had some hand in people saving water: imposing drought restrictions, offering free or reduced cost rain barrels, low-flow shower heads, and so on.

The way things are set up, that’s how it goes. The utility company and the populace are at odds with each other. One or the other has to suffer if water consumption goes down. And we want water consumption to go down. By all reasonable measures, that’s a good thing. It seems strange that even so progressive a community as Orange County hasn’t resolved this issue.

This conundrum points to a certain silliness in the system. Our water utility should be in the business of managing our water resources, but presently what they do is simply sell our water to us. The more we use, the more we get charged, and the more money they make. It incentivizes the consumers to use less water, but it incentivizes the utility to get us to use more water. In the Carrboro Citizen article, Town Alderman calls this “The cost of doing good.”

So what can we do about it? Is there some way we can separate the amount of water used from the amount of income the utility brings in? If the water company earned a flat fee per residence (or per resident, I’m not sure which makes more sense), they would not have a financial incentive to make people use more water, nor to impose a punitive effect on the public for doing the right thing in using less water. There would be no “cost of doing good.”

On the other hand, if households paid a flat fee for water, what would the average person’s incentive be for using less water? There should be a cost for doing bad. Warm fuzzy feelings haven’t proven particularly effective at lowering resource usage.

Could people pay on a per-gallon basis, while the utility receives a flat rate? Then both the customer and the utility would have an incentive to use less water. But then where would the variable rate income go? To general city/county coffers?

Better yet, perhaps the government could come up with a reward structure for some combination of quality of service provided and care taken of the water supply (measured by some combination of amount of water saved (relative to some baseline), quality of water provided to the public, and outbound water quality). Whatever the metric, the utility could be paid by how well they met that standard. Thus their financial interests could be aligned with the public good.

Just noticed: the Carrboro Citizen article says that Owasa is looking to find ways to avoid imposing usage restrictions on customers during droughts, rather than trying to raise rates. The point still stands though, that the current pricing scheme disincentivizes the utility from practicing proper stewardship of our water supply. We should find a way of rewarding them that gets them on our side, taking care of both our citizens and our resources.

Categories: Uncategorized