A logical consequence of def being an executable statement

I've mentioned before that in Python, def is actually an executablestatement (in FunctionDefinitionOrder ). A logical consequences of thisis that default values for function arguments are evaluated only once,when the def runs.

I say this because expressions generally get evaluated when any Python statement runs, so the expressions in things like ' deffoobar(a, b=greeble(c), d=None): ' are not being an exception. Theexception would be if they were not evaluated then and were instead


Notes on getting a Solaris hardware inventory

Being able to find out what hardware is in a random machine is one ofthose things you don't think about very much until you inheritresponsibility for a bunch of machines that you didn't build yourself.

The best hardware inventory program I've used is SGI's hinv (although it doesn't have enough disk information). Linux has decenthardware inventory support, but not bundled into a single command; youhave to look through a bunch of /proc files and know a few commandslike


WTO後 ( 一)

WTO後 ( 一)

過了wto在港的會議已經有十日多了,到今晚在回家的路程中才花點時間去整理一下13日至18日的前後,及當中的感覺/位置。總是會有好多原因同理由唔去寫的,不過,今晚就想寫吧!
再次回想那幾天的(所謂)

再與太皮談文學

姓名: 太皮

留言:

寂然哥:
我忘了前天才在文化廣場翻過《聚龍里》呢本小說,我見我越來越沒記性了。說到文學的受到重視與否,你一時說人哋潑你冷水,一時說我自求我道,好像有點矛盾呢?在我認為,有人批評好過沒人批

On Lisp's fundamental data structure

One of the joys of learning new programming languages is the ahamoments when something really clicks. The biggest aha moment I've everhad was with Prolog, when an assignment went from nigh impossible totrivial in a blinding flash of obvious insight.

But the one I remember most distinctly is from years ago, when I waslooking at Lisp (again), and finally realized that the fundamentaldata structure of Lisp is not lists but cons cells .

While the major use of cons cells is building lists, cons cells


A Python surprise: the consequences of variable scope

The comment on my AClosureConfusion entry brought up a little Pythonsurprise that I had known about in the back of my mind but neverthought about fully before: the consequences of Python's scoping rulesfor variables.

Ignoring closures for the moment, Python only has two scopes forvariables: global to the module and local to the entire function.(Closures introduce additional scopes for the variables of the 'outer'functions.)

Well, sure, you know that. But the consequence is that any variablein a function


書鈔.未完

1.理性,不是冷漠和抽離,尤其不應是勝利者的凝視

「此處,真實(veracity)(正確性——知識的妥當性)與真理之間的區別是關鍵所在。讓我們以馬克思主義的命題『一切歷史都是階級鬥爭的歷史』為例:這個命題已經預設了投

我和太皮關於澳門文學的討論(希望更多人來參與)

我的文章"文化,走出去"刊出後,吾友太皮專就澳門文學的發展在我的新聞台與我討論,真有意思,我喜歡這樣的討論,也希望各路有心人多給意見.

以下是到目前為止我們討論的情況:



姓名: 太皮

留言:澳門文學連《澳門日

少年夫妻老來伴

我是電視婆媽劇集的忠實觀眾,

今天晚上的《識法代言人》,

讓我眼紅紅鼻酸酸。

伯伯陪著患有老人痴呆症的太太,

對身邊的年輕人說上人生小道理:「唔通十八廿二時靚就愛,老左醜左就唔愛咩。」

狀媽看著伯伯急步跑回去照

What I use asserts for

Somewhat recently a discussion came up about the proper use of asserts over on Ned Batchelder's blog, with a number of people feeling thatthey were overused or outright misused by being applied to situationsthat really should have actual error recovery. (One nice phrase usedwas 'exploding comments'.)

I'll admit it: I use asserts in my code. I use them when I don't thinksomething can happen in an algorithm, but I'm not absolutely sure andif I turn out to