Another advantage of Python builtins

I've talked before about the speed advantage that Python builtins have . But speed isn't the only way that Pythonprivileges things written at the C level; as dict.setdefault() illustrates , Python makes a usefulatomicity guarantee for them that it does not make for methods writtenin Python itself.

Does this guarantee matter? I think that it does, because it issimultaneously useful and cheap. A concurrent program can avoid lockingwhen dealing with shared data built carefully from builtin types, andduplicating the effects


What you can (probably) count on for concurrency in Python

A comment on the previous entry about how builtins are atomic asked a really good question:

Is there actually a guarantee in CPython that they're atomic,or is that a side-effect of implementation?

There are two answers, at least in my opinion. The legalistic answeris that there is no guarantee at all, because there's nothing inthe documentation. But this is because the CPython documentationdoesn't talk about concurrency issues at all; even the thread moduledocumentation doesn't really say anything


蘋果日報:失蹤 (蔡瀾)

香 港 書 展 開 到 當 今 , 也 有 十 數 屆 了 吧 。 參 加 過 幾 回 , 近 年 來 的 都 因 為 和 我 帶 團 出 國 撞 期 , 沒 趕 上 。 每 年 到 了 這 幾 天 , 都 是 日 本 水 蜜 桃 最 成 熟 的 呀 。
今 年 的 書 展 提 早 了 , 出 版 商 約 了 倪 匡 兄 和 我 做 一 個 講 座 , 之 前 兩 天 , 又 有 叫 我 們 出
Continue reading...

蜜柑倩影


別以為蜜柑像表面上可愛得意. 實際上, 此刻他正在發脾氣, 很惡的那一種


Continue reading...

Two Days in Paris


Julie Delpy演的Before Sunrise同Before Sunset我都非常喜歡
Two Days in Paris由她導演兼主演
風格跟Before Sunrise和Before Sunset一脈相承
故事講美國男子隨法國女友回巴黎探視
在兩日之中吵吵鬧鬧
雖然是小品格局
但整齣電影賞心悅目
Julie Delpy導與演俱佳
那一男一女的故事似喜似悲

The yum versionlock problem

Update : I'm wrong about this. See the comments for more details.

Since I alluded to this issue recently , hereis the problematic interaction between yum's versionlock plugin, whichis used to 'pin' a particular version of a package so that it won't getupgraded, and yum's installonly feature, which is used by Red Hat andFedora to keep only some number of kernels (by default 2).

Here is the problem sequence:

  • you are running version X of the kernel

7月24日


謝謝你。




外遊

近期疏 blog 的另一部份原因,是準備旅遊資料,今次目的地是英法,自由背包行十多天,今晚夜機起程。到達後有機會的話會 twitter 一下。

dict.setdefault() as a concurrency primitive

One of the things I do in the back of my mind is to keep my eyes openfor Python things that could be useful for concurrency (especiallysince I still have a concurrency problem that Ihave to solve one of these days). Because of what the GIL protects , one of the useful things to look for isinteresting operations on builtin types.

All of which is a roundabout way of saying that it recently struckme that dict.setdefault() is a limited test-and-set operation .All


20080725 網摘 – IT Beans

HK

  • IT戇豆 「以前提名單仲偕的人現在提名我」的邏輯

SF

New / Update

Google