A simplified summary of Python's method resolution order

Crudely summarized, method resolution order is how Python decides whereto look for a method (or any other attribute) on a class that inheritsfrom several classes. Python actually has two; a simple one for oldstyle classes and a rather complicated one for new style classes.

(Technically, method resolution order applies even for singleinheritance classes, it's just that they have a very boring one.)

With the old style class:

class Foo(A, B, C):    pass

Python will look up


A note about the ordering of mixin classes

In Python, when you have a class that inherits from both a primary classand some mixin classes (for example, if you're using the SocketServerstuff ),it's conventional to declare your class's inheritance list with theprimary class first:

class Real(primary, mixin1, mixin2):    ....

However, an important safety tip: if your mixin class overrides methodsof the primary class, it has to be first . Failure to observe thissafety tip can cause head


My zeroth law of compromised machines

If you can't find anything wrong, you haven't looked carefully enough.

The immediate corollary is also important:

If you can't find anything, the intruders are still there.

The leading cause for not finding anything wrong on a machine youknow is compromised is that you haven't detected the rootkit thatis hiding things from you.


浪漫與童話之間 — 宮崎駿 三鷹美術館

原先守護著天空之城的機械人,移居在此守候,感覺依然孤獨。

Continue reading...

我的化妝流程 (2007)

1. Jurlique Herbal Recovery Gel

2. Shu Uemura Eyebrow Pencil

3. Laura Mercier Foundation Primer (Hydrating)

4. Chantecaille Future Skin Foundation

5. Laura Mercier Undercover Concealer

6. Nars Blush (Orgasm)

7. Shiseido The Make Up Luminizing Powdery Foundation

8. Smashbox Eye and Lip Primer

9. Nars Eyeshadow (Himalayas)

10. Nars Eyeshadow (LuLu)

11. Nars Eyeshadow (Notorious)

12. Bobbi Brown Gel Eyeliner

13. Majolica Majolica Mascara

14. Nars Eyeshadow (Night Fairy

太多文章把東西推下去了。

搬屋依舊進行中。

1. 皇后碼頭到底是怎樣!
暗地裡傷心。就算我們的櫈阻街,貼在牆上的照片和詩礙著誰了。乘機拆走,爛仔行逕。睇少幾日都唔得。

Continue reading...

被吻

我喜歡被吻的感覺。

甚麼都不用說,就恣意的吻下去,用身體觸碰去教我明白。

閉上眼睛緊擁著輕輕咬著唇,我甚麼都不是,隨你想怎樣就怎樣。

對了,就這樣吻下去,直到世界末日直到我斷了氣也不要放手。

搬家中一次過

1. 文明單位:賀歲片
嘉賓:卓男

看過了《心想事成》,才懂得慶幸自己愛的是周星馳。

2. 明報meanwhile斑駁日常(週四、五、六)

眾所

眾所周知,李義山以下的中國古典文學傳統裡,「無題詩」通常指愛情詩。「愛情」是「無」,


Fixing Python's string .join()

The thing that has always irritated me about string .join() is that itdoesn't stringify its arguments; if one of the things in the sequence tobe joined isn't a string, .join() doesn't call str() on it, it justpukes. This is periodically annoying and inconvenient.

It recently occurred to me that this can be fixed, like so:

class StrifyingStr(str):  def join(self, seq):    s2 = [str(x

The quick overview of DiskSuite failover

Solaris 8 DiskSuite does failover on disks (logical or otherwise), notfilesystems or partitions. Solaris then gives you up to seven partitionsper disk (technically you get eight, but DiskSuite takes one for itsmetadata); you then use these partitions as the building blocks formirrors, stripes, and filesystems.

Disks are grouped together into metasets, and one machine in yourfailover cluster owns each metaset at any given time and is the onlymachine allowed to do IO to any of its disks. As a consequence,