I lurk in #python. It gets a lot of questions that are, shall we say, frequently asked. This is my attempt to catalogue interesting and useful questions. The answers will gradually become separate posts—perhaps on other blogs if someone else gets to them first. Let me know if there should be other questions, if the answers are unclear, or the answers have bugs in them!
Consider this a companion article.
I love Python. It’s healthy and thriving and attracts a lot of clever people. It has its warts, but they’re mostly manageable.
Unfortunately, it still strikes me as a bit invisible. I haven’t really been able to articulate why, but after reading a bunch of those Perl blogs that bring up CPAN, I think it might actually be the software.
For example: there’s no good Python forum software. I’m sure there are some bits and pieces here and there, but nothing that’s attractive, feature-rich, and easy to deploy. That last one is a bitch, I know, but it’s important. Right now, if I want to throw up a forum, my viable options are really phpBB, vBulletin, and some other crappy PHP things. I think MyBB might be Perl, but who even uses that?
I’ve touched on this kind of thing before, but I just saw it come up again, and I think it’s worth its own post not buried in an avalanche of armchair psychology. Plus, I remembered that Blogofile does syntax highlighting.
If you’ve been linked here, you’ve probably complained that this doesn’t work as you expect:
|1 2 3 4 5 6 7 8||for i in range(4): def f(): print i funcs.append(f) for f in funcs: f()|
The output will be
3, repeated four times. Gasp! Python is totally broken! It doesn’t support closures!
Well, no. Python supports closures all too well, and that’s causing the problem here. The issue is with scoping.
There are plenty of people who have trouble expressing themselves well enough to get answers in the first place, but those are just communication problems. (That’s a good read if you ever ask nerds for help, by the way.) More subtle, more insidious, and more common are people who just ask questions that shouldn’t be asked in the first place.
These are architectural fallacies: logical flaws in the very process of building or designing something. They lead programmers towards solutions that are hard to understand, are inefficient, or just don’t work. And they confuse the heck out of the people trying to help.