STEM 隨筆︰古典力學︰模擬術【小工具】二

『箱子』 boxes 是一個『奧秘』的觀點,有如《打開黑箱!!》之所言︰

科學追求真理,為的是打開大自然的黑箱;然而真理明白若昭,就是透明的白箱。我們總在求真的旅途上一知半解,努力灰箱為白箱。如果偵錯就是科學,除錯即求真理,那這一段話用在『偵錯』與『除錯』上來講依然合適。這也說明為什麼人們喜歡用不同的灰度,來表達對『箱內之物』的認識與了解了。

千萬不要隨便對

Black box

In science, computing, and engineering, a black box is a device, system or object which can be viewed in terms of its inputs and outputs (or transfer characteristics), without any knowledge of its internal workings. Its implementation is “opaque” (black). Almost anything might be referred to as a black box: a transistor, algorithm, or the human brain.

The opposite of a black box is a system where the inner components or logic are available for inspection, which is most commonly referred to as a white box (sometimes also known as a “clear box” or a “glass box”).

……

□ □ 『性質』與 ○ ○『內涵』隨意假設。最好本著

知之為知之,不知為不知

的精神,『如實』的探索這些『箱子』的『功能』以及其『出入 』之連接『方式』,如是或可避免某些『誤解』的吧!無須發生

………

───《勇闖新世界︰ W!O《卡夫卡村》變形祭︰品味科學‧教具教材‧【專題】 PD‧箱子世界‧出入

 

『吉多』創造的世界裡,派生終究並沒有『魔法』!

吉多·范羅蘇姆 Guido van Rossum 先生喜歡看『蒙提·派森的飛行馬戲團』── Monty Python’s Flying Circus,所以把他創始的程式語言叫做 『 Python 』 。Python 巨蟒,《爾雅·釋魚》蟒,王蛇。又《註》蟒,蛇最大者,故曰王蛇。正是『小王子』一書上所說的︰

吞了象,看起來像帽子的那個。

吉多的 Python 『非同』於其他程式語言,居然把『空白』符號寫進了它的『文法』裡,竟然用『對齊的空白』表示程式區塊。如是種種『見地』,匯聚成一條稱作『非同的』pythonic  Way 大道 。吉多他的『中心思想』,集中的表現在由 Tim Peters 先生所寫的『 Python 的禪』,收錄在『 this模組 module 裡︰

import this

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
美比醜好

Explicit is better than implicit.
明白比晦暗好

Simple is better than complex.
簡單比複雜好

Complex is better than complicated.
複雜比複雜化好

Flat is better than nested.
平直比疊套好

Sparse is better than dense.
薄落比濃縮好

Readability counts.
可讀性能加分

Special cases aren’t special enough to break the rules.
特例不夠特殊到能夠破壞規矩

Although practicality beats purity.
雖然獨特性能打敗純粹性

Errors should never pass silently.
錯誤不該無言放過

Unless explicitly silenced.
除非指明它是靜默寡詞

In the face of ambiguity, refuse the temptation to guess.
面對含混,拒絕揣測意圖

There should be one– and preferably only one –obvious way to do it.
總有一個,最好是唯一的一個,明白的作法

Although that way may not be obvious at first unless you’re Dutch.
即使起初那條道路並不明顯,除非你很「好辯」

Now is better than never.
當下好於從不

Although never is often better than *right* now.
雖然從不也常常好過馬上

If the implementation is hard to explain, it’s a bad idea.
如果一件事很難說明怎麼做成的,那這個想法不好

If the implementation is easy to explain, it may be a good idea.
反之如果一件事怎麼做,很容易說明白,也許是個好想法

Namespaces are one honking great idea — let’s do more of those!
「名字空間」的理念──響亮著的偉大號角,就讓我們多多用它吧

─── 摘自《『騛罿』── 非同的禪!!

 

祇不過『留白』的理念和單純之『禪』,積累貫串常常讓人感覺『神奇』?為什麼呢??舉例講,底下三行程式

def f(x):
return x

interact(f, x=10);

 

表面文字清晰又簡單,事實 interact 『工廠』幕後早已安排事先該做些什麼之『流程』!!

因此即使逐詞逐條解釋,且非三言兩語所能為也!況且亦不符合 Pythonic Way 哩?方才邀讀者『參禪』的呦◎