Solving unexposed types and the limits of duck typing

When I ran into the issue of the re module not exposing its types , I considered several solutions to my underlyingproblem of distinguishing strings from compiled regular expressions.For various reasons, I wound up picking the solution that was the leastannoying to code; I decided whether something was compiled regularexpression by checking to see if it had a .match attribute.

This is the traditional Python approach to the problem; don't checktypes as such, just check to see if the object has the behavior thatyou'


向好處想

向好處想

小兒的病一發不可收拾。本來光滑的臉兒,一早起來受病菌感染,紅通通的,媽媽看了難過得掉眼淚。爸爸說:「星期三不是約了看專科嗎?他的病發出來也好,讓醫生看了,知道其嚴重性,才可以對症下藥。」

~ ~ ~
Continue reading...

反平反《下女》


金綺泳《下女》的情節, 很容易令我想起今村昌平的《赤色殺意》. 《赤色殺意》的女主角是個其貌不揚的肥師奶, 親人無不想踩多兩腳. 但今村昌平肯定出於同情、並佩服女人的生存之道 . 可是金綺泳比今村昌平更絕. 他的電
Continue reading...

A shell script thing that I have learned the hard way

Here is a note to myself about shell scripting, especially things that Iwrite on the fly on the command line: under no circumstance should I useany ' for ... ' loop index variable apart from $i .

I say this because, based on experimental evidence so far, I amcompletely sure to use $i in the body of the for loop, no matterwhat sensible variable name I picked as the loop index in the for statement. And, of course, the Bourne shell will let me


說服的勝利者

「你岩晒啦!」如果有個人是這樣說,那麼可以肯定,跟他對話的人,人際失效了。

可不是嗎?令得一個人失態地說出這種賭氣的說話,他必然是欠缺了對人的體察,以為憑著充份的道理,就可以說服得別人五體投地?說服,本

從官恩娜到speed dating

時:2009年10月21日下午2時半

地:銅鑼灣西苑酒家

人:正在享受day off的空姐兩名


「喂﹗灌湯餃要趁熱食㗎,$56得兩隻咋。」

「得得得﹗我睇緊雜誌。」

「睇雜誌緊要定食嘢緊要呀?」

「唔係呢,我讀俾你聽 —— Speed

某個下午我在澳大圖書館讀李維史陀



知道李維史陀去世的消息,我是傷感的。

他「終於」離開了。

我說「終於」並非黑心,而是源於我年輕時的無知。有一段時間我以為他是一位古人呢!後來讀朱天文在《荒人手記》提到他未死,我也大吃一驚,這個跟沙特和羅蘭

川澄舞

(本文已在女神ONLINE引起熱烈討論!)

川澄舞是誰?或許我並不知道。川澄舞的造型是一雙兔耳、粉銀長髮、白色和服、持一把長長的銀西洋劍,騎斑紋大虎,平時不多話,往往回人以一個大笑臉或者大哭臉。川澄舞的真實面目沒

你說

你說

我們要堅強,給孩子正能量,那麼才可以和孩子一起好好地打這一場仗。
Continue reading...

Why the NFS client is at fault in the multi-filesystem NFS problem

In yesterday's entry , I said that theNFS clients were at fault in dealing with the duplicate inode numberproblem. Now it's time for the details, because on first look thisappears a bit odd; how can it be the client's responsibility to avoidduplicate inode numbers, when the server gives it the inode numbers?

In the NFS v3 specification ,inode numbers only appear in one spot; they're part of the fileattribute structure that the server returns for GETATTR requests.While