Lady First 專欄(64)- 忽然之間
我有啲感情煩惱… … 唔知點算好… …
幾個月前,因為工作關係,我識咗個男仔,之後由於大家嘅公司成日有event,而我同佢都係搞手,所以開始熟絡咗。
我哋時不時約出嚟玩,上佢屋企打機丫,去行街丫,或者去
今個星期六(11/14)晚7pm ATV「智慳任務」
一件衣服如何對大自然造成破壞?若你把一件衣服的「一生」拆開來看,你就會
HK Blogger Con 2009 相片
橫琴.單車.蠔與文藝激盪的半日活動
My problem with the obvious solution to my unexposed types problem
In my last entry about solving my unexposed types problem , I sort of cheated; I left out one obvious solution.My problem was that I wanted to have a function with 'polymorphicarguments', one that could take either strings or compiled regularexpressions and then tell them apart.
Well, you know, one obvious solution is to not have such a crazyinterface in the first place. A clearer, simpler approach would be tohave two separate functions, one that takes compiled regular expressionsand a second one that
修羅場
周日與阿P一起表演
A gotcha with Bash on Ubuntu 8.04
Suppose that you have an Ubuntu 8.04 system where you have opted to make/bin/sh be bash, the way it used to be in 6.06, and you have an accountwith /bin/sh as the login shell (for example, you created it with plain useradd ). So you log in to the account and everything seems normal andbash-y, until you try to do filename completion and get:
$ cd / -sh: <( compgen -d -
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'