May 31st, 2011 § § permalink

(photo courtesy of Sean MacEntee via flickr)
Some interesting bits and pieces (leftovers) from the weekend — I have a tendency to queue up a pile of “read later” stuff or emailing myself a pile of things to talk about/link to/etc. Sometimes, I actually get to go through it all. Today — I get to share it to!
First up — Michael Foord (fuzzyman) did two excellent posts — the first is on privacy in Python — not big-P privacy, but rather the programming/object privacy. It’s a good read because it reenforces the point that even if you think you’re being clever and hiding something in a closure to make it private, you can still get access to it. Remember too — dunders (__foo) are just name-mangling. In Python, nothing is private (insert bad tasting joke about Python being facebook here).
Michael’s second post is on the NamedTuple kerfluffle that was stirred up Kristjan Valur’s post on the use of exec() and namedtuple (short version: namedtuple creates a string defining the class and then calls exec to create the object. I think Michael is spot on — I think exec() gets a bad rap frankly, sure — it’s something of a hand-grenade, if you use it wrong, you’re going to get hurt, but in this case I have to agree with Raymond in his comment on bug 3974 — the current implementation is clear and maintainable. I don’t like the sternness of the reply — but he is right. Kristjan’s use-case is an interesting one, but I don’t think it’s one that warrants the removal of the existing implementation. I’m wondering if a “fallback if exec doesn’t exist” is worth inclusion.
Then again, I’ve spoken to people who refuse to use namedtuples because they now know how the sausage is made. I still think the sausage is delicious.
Next is a pretty interesting discussion on a presentation that came out of Pixar on getting over embarrassment in order to get things done — I don’t have much to add above the comments on hacker news, except to say I think the same mental blocks they talk about for animators apply to programmers, writers, etc. We hide from code reviews, we hide our writing until we think it’s “Pitch Perfect” — when in reality, we shouldn’t. We should be sharing, discussing and collaborating earlier, more frequently and more often.
Share and Ship early and often — see also “Don’t Go Dark”.
Finally, I was happy to see the “Quick and Easy Debugging in Python” post from Jeet Sukumaran — it’s always nice to evolve past sprinkling print fairy dust all over your code for debugging — even if we all still do it despite knowing or using PDB. Just to add to his post, if you want to increase your PDB-Fu, I recommend this “Debugging in Python” post by Steve Ferg, and the official documentation for PDB. We should really add a HOWTO for this.
p.s. For additional good-reading, check out “Priorities Don’t Exist in a Vacuum” and “First Care”- while not germane to what’s I’ve already written about, they’re a good essays on priorities. Thanks to the latest “Back to Work” podcast.
(photo courtesy of Sean MacEntee via flickr)
Some interesting bits and pieces (leftovers) from the weekend - I have a tendency to queue up a pile of "read later" stuff or emailing myself a pile of things to talk about/link to/etc. Sometimes, I actually get to go through it all. Today - I get to ...
May 25th, 2011 § § permalink
Preamble
There’s been some recent discussion about DjangoCon(.eu | .us) and whether or not speakers should have to pay for admission as well — see Chris Wanstrath’s (of Github) tweets (here and here) and this Convore thread for examples. Obviously, as PyCon is the “big dog” so to speak for Python conferences, everyone looks to “us” for a model to work from, or how we manage things. I’ve seen a lot of poop slung towards the DjangoCon organizers, mainly due to a lack of knowing “why” certain policies (such as “Everyone Pays”) exist for DjangoCon, PyCon, and other conferences.
As co-chair and program committee chair last year, and program committee chair the year before, and now chair for the next two years — I figured it might be good to take a moment to explain the rationale behind PyCon’s approach — as well as some statistics about the budget. I’m not going to state that this policy is perfect; nor that it won’t be changed; I also will not release the budget publicly — I don’t think giving everyone a spreadsheet without the context of the hundreds of man hours of work that go into it is useful, at all.
Important Note: PyCon is organized and managed by the Python Software Foundation — this means that, as part of being a 501c3 charity, some of the financials from past PyCon is available as part of publicly accessible financial documents of the foundation. You can find those on the PSF’s site.
The same reasoning may not apply to a conference that is organized by a commercial entity or is done for profit. OSCON is a commercial conference, so having speakers get in free is generally expected. DjangoCon.us is in the middle — it is organized for profit by a commercial entity, but it also contributes heavily back to the Django Software Foundation. DjangoCon.eu is managed differently as well.
» Read the rest of this entry «
Preamble
There's been some recent discussion about DjangoCon(.eu | .us) and whether or not speakers should have to pay for admission as well - see Chris Wanstrath's (of Github) tweets (here and here) and this Convore thread for examples. Obviously, as PyCon is the "big dog" so to speak for Python conferences, everyone looks to ...
May 22nd, 2011 § § permalink
I had a bit of an idea that almost turned into another crank based on yesterday’s blog post “On Family, Cranking and Changing” — the “code equivalent” for the idea stemming from the Artists Way’s concept of “Morning Pages”/750Words and the Writing Down the Bones concept of “Keeping the Hands Moving”.
I made the mistake however, of asking on twitter — never, ever ask a bunch of programmers quote “What do you think the char count or line number of a reasonably sized Python module is?” — never. Just don’t. I’m not even asking that here. Instead, I’m giving you a simple idea for a web application. Take the implementation of github’s gist’s/pastebin, mash it up with a built in code editor (such as Ace), and kick out a programmer’s version of 750 Words. The goal is not to force people to share code publicly — if they want, let them flip that bit (or just post/link to github’s gist system). The goal is to encourage programmers/hackers to explore/write some new:
And I mean new — not something bogged down by their every day projects. It could just be a clever one liner ala Raymond’s python tips. It could be a few-hundred-line piece of code that just tracks how many times they’ve watched their favorite show using some cool module. Just keep the hand moving; just take 3, 10 or 30 minutes a day and keep a private code journal of new ideas, concepts, etc. Write some morning pages.
Project Euler is algorithm problem solving, so it doesn’t fulfill the goal. Code Kata’s come damn close (see also Coding Horror’s take) — but again, those are focused on providing a problem, and then having someone come up with a solution. I’d like something that just sets forth the ideas exposed for writers above, and sets it in a programming context.
If you want, allow users to seed it with suggested ideas. So that when a user logs in, they might have set a “preferred programming language(s)” and get a a little javascript popup with a problem sourced from another user, like say “use python threads” or “write an application that forks”. This latter part ties into an idea I had stemming from Zed’s original “Learn Python The Hard Way” posting — too many of these practice sites focus on algorithms and mathematical things that probably won’t help you in the next 8 hours. Something that had problems like “send a receive UDP messages from a socket” and the like — focusing on common, practical things.
Anyways so what are the requirements for “XXXcode” or “xxxlinesaday”/etc:
- Allow signup/signin
- Allow public sharing of journals/non public
- Allow submitted “ideas”
- Outline the idea stemming from the Artists Way/Writing Down the Bones.
- Make it look decent (I’m tired of ugly programmer sites. Go get something from themeforest if you need it)
There ya go. Take it and run with it if you want. Just stop bothering me about lines of code in a module. Man you guys can be pedantic.

I had a bit of an idea that almost turned into another crank based on yesterday's blog post "On Family, Cranking and Changing" - the "code equivalent" for the idea stemming from the Artists Way's concept of "Morning Pages"/750Words and the Writing Down the Bones concept of "Keeping the Hands Moving".
I made the mistake ...
May 21st, 2011 § § permalink
Introduction
Sometime on May 6th — over two weeks ago now — I shot out a innocuous tweet asking what might be a good blog topic. I think I said something like “python, family, .…” — the overwhelming majority of them responded with “write something on family”, ironically, as I was reading those responses sitting at a stop light (yeah, I know — don’t yell at me) I got a phone call from my wife asking me to come home immediately. You see, my wife is very, very pregnant with our second child, and it’s not been an easy pregnancy for her. We’ve had a lot of scares, and we’ve spent a fair amount of time in and out of our local hospital — so when she said “come home right now” — you can expect that everything else pretty much evacuated my brain except that.
I guess the twitter responses acted as sort of a cosmic hint as to what was coming — the abbreviated version being that my wife, bless her soul, was deemed “high risk” and admitted to the hospital on the 6th — with the expectation that she would not leave until she gave birth. Fast forward two weeks in the hospital, a myriad of tests, blowing out budgets on gas (what the hell) and being a “Single Dad” for most of that that time, and I can happily report that mommy and baby are stable, but still hanging out inside my wife.
These past two weeks taught me a lot about myself, about my family — some things that I thought I knew were brought to task and tested — heck, some of the things I was going to write about were put to the ultimate test. You may not really care about any of this — I’d go someplace else at this point if that’s the case. I do hope to outline my thoughts on balancing things (though I remain terrible at it) and finding the time. You’re not going to find a cure all, or a hack that will “just make things work” — that doesn’t exist.
» Read the rest of this entry «
Introduction
Sometime on May 6th - over two weeks ago now - I shot out a innocuous tweet asking what might be a good blog topic. I think I said something like "python, family, ...." - the overwhelming majority of them responded with "write something on family", ironically, as I was reading those responses sitting ...
May 5th, 2011 § § permalink
Preamble
A recent post on Hacker News entitled “Why I still don’t contribute to open source” raised a series of thoughts in my head — but then, before I could even take the time to generate the smallest of replies, Brian Curtin swooped in and made probably one of the single best comments in reply, and on the subject of contribution that I’ve ever read. The original post; and Brian’s excellent reply were enough to get me obsessing about this subject again — eager to share my thoughts and feelings on it.
A while ago (almost exactly a year, oddly enough) I posted a question here to my blog — “Why aren’t You Contributing (to Python)” — the replies to that post, both in the original comments, Hacker News, Reddit and other thoughtful responses by Tim Golden, Yaniv Aknin and Brian Curtin made me sit back and think for a long time what we — as a “python core” team could do to help reduce the friction and overall barrier to contributing to core itself. It also made me take a step back and ask myself why I contribute to Python — not just via core, but also to PyCon and the PSF.
» Read the rest of this entry «
Preamble
A recent post on Hacker News entitled "Why I still don't contribute to open source" raised a series of thoughts in my head - but then, before I could even take the time to generate the smallest of replies, Brian Curtin swooped in and made probably one of the single best comments in reply, ...
May 1st, 2011 § § permalink
On Friday of last week, a new post I wrote for my employer (Nasuni) went up — “Encryption Keys, User Data and Subpoenas”. In that post, I got to outline, in clear “non slippery” language how my employer manages encryption keys, what data they have access to, etc. One of my favorite quotes:
If a customer has provided their own encryption key(s) — Nasuni, or the cloud provider, do not have those keys, and can not provide them as part of a subpoena or other legal process. We can not decrypt or access your data. We can not supply a key which we do not have. This is not policy or trust level protection: It’s impossible.
We offer auto-generated and escrowed keys as a convenience to the user — the benefits of having this feature outweigh the cost. A user or company who knows nothing about encryption keys and key escrow can still have strong data security and instantaneous disaster recovery, they can install a Filer in minutes and immediately be up and running.
» Read the rest of this entry «
On Friday of last week, a new post I wrote for my employer (Nasuni) went up - "Encryption Keys, User Data and Subpoenas". In that post, I got to outline, in clear "non slippery" language how my employer manages encryption keys, what data they have access to, etc. One of my favorite quotes:
If a ...
April 30th, 2011 § § permalink
I — like most people comfortable with my relatively sane (yet limited) knowledge of Python — rarely go and read the python docs except when I know what I’m looking for. For example, I have a window open to itertools and collections open a lot more than I care to admit (I love you namedtuple. I loves you so much), but I rarely go off looking for new things/stuff that’s changed.
For those few of you (and really, it should only be a few of you) who don’t know — Raymond Hettinger is a python core developer and author/maintainer of quite a few interesting modules within the standard library (and a constant stream of ASPN recipes). Raymond is also highly active on python-dev and other lists the subject of this post being python-list (the one list I refuse to join just due to the time/attention tradeoff).
Oh, he’s also a current member of the Python Software Foundation board of directors. To say he’s active would be an understatement.
Back to the subject at hand: Docs.
Raymond posted something I think should see a little bit more attention — as I stated in my opener, many of us are guilty of not reading much in the way of Python docs unless we are looking for something specific. We miss out on gems/updates to older docs that really make them shine. We also miss out on new examples, and other things that really help make Python’s docs some of the best out there.
As I said in my forward to Doug Hellmann’s “The Python Standard Library By Example” -
The standard library’s documentation is good, and constantly improving/evolving. Given the size and breadth of the standard library, it’s amazing for what it is. It’s awesome that we have hundreds of pages of documentation contributed by hundreds of developers and users that are used every single day by hundreds of thousands of people to create things – things as simple as one-off scripts, and as complex as the software that controls giant robotic arms.
In Raymond’s post to python-list, he listed some new/newly updated docs that are really interesting:
The newly added/revised logging howto by Vinay (author/maintainer of the logging module) is really good to note (You have visited the python docs howtos, right? It’s here.). The additional logging cookbook nicely compliments Vinay’s revised logging module documentation.
Oh, and if you were wondering — yes, there is an easy to read list in the “What’s new” document for 2.7 (curated by Raymond) that lists out all the new Python 3 features back ported to python 2.7 for your reading pleasure.
Last night, an additional resource popped up on my radar — pyth0n.org — a site, while needing some CSS love (oh, the CSS love it needs) is an excellent way to jump to just about anything within Python (docs, classes, methods, built-ins, etc). I think I killed it with load from tweeting about it last night, so be gentle. It really is a cool site, it’s like a uber-index of Python.
As an addendum — Raymond has also become very active on posting interesting bit of python knowledge/protips on his twitter account, which have been a joy to see pop up in my tweet stream (Given how guilty I am of saying things that might be construed as “noise”). Some of highlights:
- factoid: random.sample() automatically chooses an algorithm, remember-previous-picks or remove-picks-from-the-population
- pro-tip: deque’s optional maxlen argument useful for n most recent items, moving averages, sliding windows, tailing files
- pro tip: def mean(s): return math.fsum(s)/len(s) # don’t lose precision while adding large numbers of small values.
- Dirt simple map/reduce utility for :
So, take a look around the latest docs and follow him, and other python developers such (Barry Warsaw, David Beazley, Nick Coghlan, R. David Murray, Guido Van Rossum) on twitter (you can follow me if you want). Brett Cannon (another core committer) has a twitter list of committers.
There’s been a lot of work done across the board to improve the docs, add to them and clean them up. A lot of excellent people contribute changes almost daily to them. They are a fantastic resource, and are greatly complimented by work like the Python Module of the Week (Doug Hellmann) and other tutorials spread across the web.
If you know of a particularly good tutorial, or explanation of a module, you might consider submitting a ticket citing it, and suggesting it be included into the standard library docs as well. What are some of your favorite documentation gems, or examples for Python?
I - like most people comfortable with my relatively sane (yet limited) knowledge of Python - rarely go and read the python docs except when I know what I’m looking for. For example, I have a window open to itertools and collections open a lot more than I care to admit (I love you ...
April 25th, 2011 § § permalink

For a 5 month update, check out: “The Standing Desk Experiment 5 Months in”
For about the past year or two, I’ve been working on improving my “state of being” for lack of a better term — focusing on more productivity, health, etc — I think everyone goes though this at one point or another. Various events of the past year — an incoming second kid, badly dislocating/injuring my knee and rehabilitating that, realizing that being an overweight, unhealthy geek probably wasn’t in my, or my families’ long term interest and seeing my little girl grow up faster than anything I’ve ever seen (see this excellent post by Merlin Mann — “Cranking”) has triggered me to make a series of changes, the most recent of which is directly interesting to a lot of you — I’ve switched over to a standing desk setup at work.
» Read the rest of this entry «
For a 5 month update, check out: "The Standing Desk Experiment 5 Months in"
For about the past year or two, I've been working on improving my "state of being" for lack of a better term - focusing on more productivity, health, etc - I think everyone goes though this at one point or another. ...
April 17th, 2011 § § permalink
Introduction
It’s been over a year since I was elected by the PSF membership to be a member of the board of directors of the Python Software Foundation — this past week, I was lucky to be reelected. In that year, and even in the years prior to my election, I’ve long wanted to write down my thoughts and feelings about the foundation. This includes what it is, what it does and what it should do. You’d be stunned how many people — PSF members included — who don’t know the answer to these three things. Worse still, you’d probably be even more surprised to find out many people who don’t think the PSF should exist — or even that it exists at all.
Before we start, I want to clarify a few things:
- What follows is my opinion; and may be shared by some — or none — of the current 13 PSF board members.
- What follows is not the opinion of my employer (not that I need to say that…).
- What follows has no relation or bearing on my role as co-chair and program committee chair of PyCon.
- What follows may be incomplete, I reserve the right to amend or make clarifying statements.
- None of this is meant as a criticism of any past directors, members, etc.
With that pile of disclaimers done, I will state this: what follows is my official opinion of the PSF and it’s duties and role in the Python Community as a director of the PSF — this means that if you are a PSF member, and disagree with what follows, consider voting against me when the election comes up this year. I will state that it is my goal to not only express what I think the PSF is, does and should do but also to provide something that:
- Helps explain the fundamentals of the PSF.
- Helps explain what the Board of Directors is.
- Helps make the argument why companies should become sponsors.
- Helps make the argument as to why you should donate to the PSF.
Much of what I will be writing may be a simplified or updated version of the information that is also on the main Python Software Foundation page. I’d like to note that this post has spanned several months of on-and-off writing — and PyCon 2011 right in the middle of it, so there is some information shear as time passed.
» Read the rest of this entry «
Introduction
It's been over a year since I was elected by the PSF membership to be a member of the board of directors of the Python Software Foundation - this past week, I was lucky to be reelected. In that year, and even in the years prior to my election, I've long wanted to write ...
April 10th, 2011 § § permalink
I posted the Python Mentors — Python Core Mentorship site last night. It’s pretty bare/minimalist (intentionally) right now — if there’s information you think is missing, or something you would like to see, drop me a comment or an email. Feel like hacking on the source? Check out the bitbucket repo — it’s a simple blogofile site right now, and I don’t think we need much more for the forseeable future.
Many thanks goes to OSUOSL for the free hosting.
I posted the Python Mentors - Python Core Mentorship site last night. It's pretty bare/minimalist (intentionally) right now - if there's information you think is missing, or something you would like to see, drop me a comment or an email. Feel like hacking on the source? Check out the bitbucket repo - it's a ...