Skip to main content

Posts

How To Stop Me From Buying An iPod Touch

So I've been looking at the new line of iPods and thinking about how much I wanted an iPhone without the phone, so the iPod Touch seemed to be exactly what I wanted. Thankfully, Morgan Webb pointed me to this story about why I might be reconsidering. Now, I run both Windows and Linux. My wife is the one in the household who refuses to run Windows at all, how about that? On both operating systems I already have players that can use the old iPod lines. I use WinAmp and Amarok , although I am anxious for Amarok on Windows to be stable enough to move to. Sorry, Nullsoft ! Where am I left now? I guess I need to look at my options, and I'm not really excited over the UI itself on the Touch, but the hardware. Do Nokia Internet Tablets include an MP3 player with decent battery time? I could import a miniOne from China. Thank you eastern friends! How quickly can Apple break their high horse's legs?

How to Confuse _ and locals()["_[1]"]

So, after posting about the exception raising list comprehensions, I got this: Kevin has left a new comment on your post " How to Add Memory Leaks to Python ": Doesn't '_' only exist in the interactive interpreter? Kevin has a misunderstanding here in that there is a huge difference between the expressions _ and the locals()["_[1]"] . You might spot why they are so different, or you might not. The second, the one from the list comprehension, is unable to be accessed by name directly. You can only get at it via the locals() and globals() functions, depending on your scope (locals() always works right after the LC in question, though). The name is intentially something that, if tried to resolve as an actual name in the scope, won't find the object in question. Python will look for _ and then do a subscript lookup on key 1 on it. This is completely different than actually looking up the name _[1] in the dictionary where names are stored and grabb...

How to Pretend Zope Doesn't Exist

I'm doing my best to ignore that I just read Well-kept secrets of Zope , which lists all sorts of things I'm interested in seeing developed and how Zope did it. Zope is our Simpson's to South Park's Python community. All of this ORM wild fire and debates about unicode support and web frameworks seem really petty when someone reminds us that Zope, which most of us never really look at, has been doing some of these things for over a ten years . That's practically a decade in software time! Will I settle back into a comfortable hole in the ground, cover my years, and chant "There's no such thing as Zope" or am I going to bite some pride and surround myself with Zope? The first talk for a CharPy meeting is going to be on Zope, and I'm going to ask a lot of questions about why it gets ignored and how someone really familiar with Python can get into Zope so late into the game. Now, I am not planning to drop everything else. I still think CouchDB has some...

How to Add Memory Leaks to Python

One of our greatest bragging rights is the lack of memory management in our Python code and the wonder of garbage collection, so when we find a way to get a memory leak in Python, it should be made well known. I don't know if this is already known, or not. In actuality, these situations are known as reference leaks, sometimes, and they are cases where we forget to remove a reference to an object we don't want to keep around anymore. The following session will cause this problem. Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(): ... for i in xrange(100): ... yield i ... raise Exception("oh no!") ... >>> [x for x in f()] Traceback (most recent call last): File " ", line 1, in ? File " ", line 4, in f Exception: oh no! >>> globals()['_[1]...

Python, Concurrency, and My Two Cents Today

This is not the first and it will not be the last that I write about the state of concurrency in Python, comment about some debate going on in the community, and outline what I think we need to solve any apparent problems and capitalize on what a lot of us think is the future of software development. Anyone following the Python blogs is bound to have caught wind of the Guido-Eckle debate about what Python 3.0 has become, compared to what it could have been. This was followed immediately by an open letter from Juergen of SnapLogic about the GIL. I feel sure this has all happened again and that all parties involved are just playing some recorded macros. The most compelling case we have right now against the arguments to remove the GIL are two. Firstly, it was already done! A branch of Python removed the GIL many years ago and actually found a two core/cpu system would run the same code slower, due to all the locking involved to protect mutable structures. So, while people continually s...

How to Shop for a Portable Device

What do I want? Do I even need a phone? When the iPhone came out, my first reaction was wishing it wasn't a phone. If I want a touch screen in my pocket, shouldn't I safe money and open my options with a Nokia Internet Tablet? The iPod Touch and the iPhone will be open, eventually. They can be coerced into running new things, already. The Nokia has a huge library of software, and can be made to run linux with lots of apps I already use. The price is undeniably better, of course. Everything says "Don't get the expensive Apple device," and yet, I want to buy it. I even want the phone model, when I don't want a phone. What great marketting. If I could find any decently open e-paper device, I'd jump on it before anything else.

How to Exploit All of You For Traffic

People go through a few different stages of programming Python, and one of the last is learning to optimize well and without sacrificing the quality of the code. When a piece of code is bottlenecking, it comes time to look at how you can really turn a turtle into a hare. Or, should that be the other way around? I want to showcase ways this transformation is possible so I'm going to make a call for anyone to submit code that needs optimized. The next post in this series will show how the code was optimized, what techniques might have been tried and would have failed, and maybe some tips about why the changes worked. There will also be a sample of unoptimized code at the end, with the challenge for improvements to be sent in. From there, if the series has interest, it will continue and maybe evolve. Send in samples of code you think could be faster. They can be real world or fake, as long as they are realistic. It doesn't matter how poorly written they are, but we need to know wh...