<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ching on Medium]]></title>
        <description><![CDATA[Stories by Ching on Medium]]></description>
        <link>https://medium.com/@philfan?source=rss-e0216d33195e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7s6pQwPdmB2ju5nv</url>
            <title>Stories by Ching on Medium</title>
            <link>https://medium.com/@philfan?source=rss-e0216d33195e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 20:35:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@philfan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Co-Pilot360這樣用-人機介面順利上手]]></title>
            <link>https://medium.com/bits-to-blocks/co-pilot360%E9%80%99%E6%A8%A3%E7%94%A8-%E4%BA%BA%E6%A9%9F%E4%BB%8B%E9%9D%A2%E9%A0%86%E5%88%A9%E4%B8%8A%E6%89%8B-a6e191dacbb1?source=rss-e0216d33195e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6e191dacbb1</guid>
            <category><![CDATA[先進駕駛輔助系統]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ford]]></category>
            <category><![CDATA[smart-driving]]></category>
            <dc:creator><![CDATA[Ching]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 17:09:11 GMT</pubDate>
            <atom:updated>2020-01-13T17:09:11.201Z</atom:updated>
            <content:encoded><![CDATA[<p>智慧駕駛技術目前已經應用在市面上許多的車型上，但，一個系統除了硬體之外，人性化，易於操作的人機界面更扮演的與使用者溝通的重要橋樑。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qs08DVNhFh9cFApm" /><figcaption>Photo by <a href="https://unsplash.com/@jeremychen?utm_source=medium&amp;utm_medium=referral">Jeremy Chen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>在上一篇<a href="https://medium.com/bits-to-blocks/%E9%A7%95%E9%A6%ADford-focus-mk4-acc-lca%E4%B9%8B%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5-5536f674de67"><strong>駕馭</strong></a>駕馭<a href="https://medium.com/bits-to-blocks/%E9%A7%95%E9%A6%ADford-focus-mk4-acc-lca%E4%B9%8B%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5-5536f674de67"><strong>Ford Focus Co-Pilot360 ACC/LCA之完全攻略</strong></a>，提到ACC與LCA在作動時的狀況，並分析了ACC與LCA在一些情境中的反應。那我們現在就接著來看Ford Co-Pilot360如何與使用者進行互動，人機界面如何呈現。</p><blockquote>馬上接手！自行駕駛！跳脫ACC控制</blockquote><p>從定速巡航，到現在主動式全速域ACC Stop&amp;Go，車子幫駕駛分擔更多的駕駛工作。但，自動駕駛會顧慮到駕駛者安全，因此在很多程式設計的邏輯上會以保守的方式來撰寫。如果這時想來個超車或是親自駕駛，當然就必須停止這樣的保守設定。以福特Co-Pilot360來說，這種狀況ACC是不需要停止或取消，駕駛就能馬上順利接手油門。</p><p>駕駛只要透過踩下油門，ACC模式馬上就會被取消，並讓駕駛者自行控制油門，只要駕駛者鬆開油門，就會回復至ACC模式，而且速度也不會因為ACC的速度設定瞬間下降。基本上，如果鬆開油門時的時速高過ACC設定值，不會明顯感覺到電腦介入減速，除非前方有車輛到達設定距離，車輛才會較明顯的減速。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmxPwsgxV2Dk%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmxPwsgxV2Dk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmxPwsgxV2Dk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd5dcc7f08385ac88525a8401ecadef4/href">https://medium.com/media/dd5dcc7f08385ac88525a8401ecadef4/href</a></iframe><blockquote>跳脫LCA限制，順利變換車道</blockquote><p>LCA與ACC是一組連動設定，駕駛也可以透過方向盤上的按鈕將LCA功能取消。LCA的主要目的是讓車輛主動的維持在車道中央行駛。也就是說，車輛方向盤會由電腦控制，在控制期間，駕駛轉動方向盤時，會有一個明顯的力道回饋感受，告訴你電腦正在行駛。若駕駛想順利地變換車道，可以透過方向燈的啟用。當駕駛啟用方向燈，會發現在螢幕中的車道線，會由綠色轉為灰色，也就是暫時性的車道辨識取消。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJUk5yRtK1A0%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJUk5yRtK1A0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJUk5yRtK1A0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/28870360eb17aac26271a56e9ffca441/href">https://medium.com/media/28870360eb17aac26271a56e9ffca441/href</a></iframe><p>一但車道辨識取消，駕駛便能輕鬆地切換車道，車道轉換完成後，駕駛只要將方向燈取消，車輛便會自動回復LCA，讓車輛繼續自動行駛。</p><blockquote>LCA即將無法運作</blockquote><p>一套系統，難免有它的極限！Co-Pilot360的LCA當然也不例外。當在行駛的過程中，LCA遇到彎度過大的路段，會自動取消LCA功能。因此駕駛者在行駛這些路段時，還是得小心應對。那Co-Pilot360是如何有效地通知駕駛，LCA即將因為無法辨識即將取消呢？</p><p>當LCA遇到無法辨識車道的路段或是彎道過大的路段，會有一聲警示聲響起，並會在Co-Pilot360的介面中呈現取消的字樣，原本綠色代表LCA的方向盤圖示會轉為紅色，提醒駕駛者，此路段LCA無法運作，駕駛這時候必須接手駕駛，LCA即將取消。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdcieZBmIink%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdcieZBmIink&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdcieZBmIink%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5aee5207f12b55e28cef6eb38249763/href">https://medium.com/media/a5aee5207f12b55e28cef6eb38249763/href</a></iframe><p>當車輛駛離了這樣無法辨識的路段，若是ACC還在作動的情況下，LCA將自動再度啟動。</p><p>整個Co-Pilot360在裡面設計了許多小細節，必須靠駕駛者一一體會。掌握每個系統的特色，才有辦法盡情的使用它們。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6e191dacbb1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bits-to-blocks/co-pilot360%E9%80%99%E6%A8%A3%E7%94%A8-%E4%BA%BA%E6%A9%9F%E4%BB%8B%E9%9D%A2%E9%A0%86%E5%88%A9%E4%B8%8A%E6%89%8B-a6e191dacbb1">Co-Pilot360這樣用-人機介面順利上手</a> was originally published in <a href="https://medium.com/bits-to-blocks">bits-to-blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[駕馭Ford Focus MK4 ACC/LCA之完全攻略]]></title>
            <link>https://medium.com/bits-to-blocks/%E9%A7%95%E9%A6%ADford-focus-mk4-acc-lca%E4%B9%8B%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5-5536f674de67?source=rss-e0216d33195e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5536f674de67</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[軟體]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[自動駕駛]]></category>
            <category><![CDATA[ford]]></category>
            <dc:creator><![CDATA[Ching]]></dc:creator>
            <pubDate>Thu, 09 Jan 2020 14:19:16 GMT</pubDate>
            <atom:updated>2020-01-13T09:10:17.738Z</atom:updated>
            <content:encoded><![CDATA[<h3>駕馭Ford Focus Co-Pilot360 ACC/LCA之完全攻略</h3><p>Computer Vision電腦視覺，AI人工智慧，在時代的推進之下越趨成熟。明日世界的電影情節愈趨浮現，也越來越多的車廠都導入了自動駕駛或是半自動駕駛的科技。但每家的軟體不同，判定的邏輯一定也不同，藉著此篇，讓使用者更快瞭解Co-Pilot360的運作細節。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*41p1Pxw2VaNe8Gre" /><figcaption>ACC/LCA/Level2/AI智能駕駛可以說是當下熱門的研究領域之一。Photo by <a href="https://unsplash.com/@whykei?utm_source=medium&amp;utm_medium=referral">why kei</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>去年，最具話題型的車型莫過於Ford Focus MK4了。親民的價格再搭載上具備Level 2的半自動輔助駕駛，無論是在汽車業與科技業，都引發討論的熱潮。而我也被它功能強大的Co-Pilot360吸引，因此買了一部。</p><h3><strong>擔心</strong></h3><p>剛入手，其實對於半自動輔助駕駛還是不太放心，雖然各車評還有廣告都標榜著這套具備Level 2水準的半自動輔助駕駛的強大，但，事實是，每次接近前車時，都要擔心是否會煞停！是否會緊急煞車！是否會沒偵測到前車切入車道！太多太多的擔心，所以慢慢嘗試到建立信心，經過一段時間的使用，終於比較信任這套系統。</p><h3><strong>細節</strong></h3><p>現在，跟大家分享一些我對於這套系統的看法，並以軟體工程師的角度出發，分享在使用它的半自動輔助駕駛功能時，要注意的細節，也希望透過這篇文章，幫助大家更了解這套系統。</p><blockquote><strong>支援超過200KM/hr的全速域ACC</strong></blockquote><p>Co-Pilot360 ACC作動範圍可以從時速0開始啟動，並依據前車速率，調節本身速率。在使用ACC的過程中有以下幾個特色與細節可以分享：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FssYRfL7xRdIyrmUgQu3ug.jpeg" /><figcaption>ACC功能與LCA都集中在方向盤左側，易於使用</figcaption></figure><p><strong>RES按鈕。</strong>一但跟車到停超過3秒，ACC會自動停止作動。ACC停止動作後，就算前車移動，ACC並不會主動啟動，駕駛者可藉由輕踩油門或是按下在方向盤上的Resume按鈕，便能再度啟動。算是滿人性化的設計。</p><p><strong>200KM/h的全速域支援。</strong>一般來說，當然不太可能在公路上行駛200KM/h。不過這樣的速域支援範圍，也代表著它有著更快的雷達掃瞄頻率，更快的鏡頭擷取影像頻率以及更快的處理器工作效率。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qEuzgK_qSwSaoO1Fmq7PZg.png" /><figcaption>靠著設定格數與前車保持距離</figcaption></figure><p><strong>四種不同間距模式。</strong>ACC設定的過程中，可以依據實際需求設定四種與前車的間距模式。這些間距的模式，根據我實際測試，會依照不同的速度調整與前車不同間距。</p><p><strong>加速與減速。</strong>ACC在減速的過程中，可以說是相當的線性，並非屬於急煞急停的類型。整個煞車的過程猶如具備駕駛經驗的司機一般，使用起來安心感很足夠。但是要注意的是，在加速的過程中，以人的角度來看，稍微有點猛爆。因此在操作上，特別是前車突然駛離，前面形成淨空區，最好是注意使用。</p><p>前方突然淨空有兩種情形，會造成本身車輛前方產生淨空區，而這兩種情形，在使用上的感受也有所不同：</p><p>前方車輛切換車道。當前方車輛駛離本身車道時，電腦判定前方無車，便會以較線性的方式，直線加速至你要的速度，若前方又有車輛，車輛便會進入ACC減速煞停。整體感受還算線性與和緩。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*6NE2zxHDZB6NUV1tiO_Eig.png" /><figcaption>當車輛前方形成淨空區，車輛在ACC的作動下會呈現線性的加速，須注意前方車輛。 (Icons made by <a href="https://www.flaticon.com/authors/mynamepong">mynamepong</a>)</figcaption></figure><p>主動切換至前方淨空車道。這發生在主動變換車道時。當主動變換到前方淨空的車道。車頭還沒完全擺正，這時候車輛就會開始加速。因為這時候電腦期望加速至指定速率。也因為本身主動變換車道，若駕駛是處於較低速的環境中，車輛的加速確實會嚇到駕駛者本身。畢竟，周遭的車輛都很慢。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*swUd1Oeub15Ishm_BKJBdQ.png" /><figcaption>主動切換車道，照成前方區域淨空時，若是車輛本身處於低速的情形下，很容易被系統突如其來的加速嚇到。 (Icons made by <a href="https://www.flaticon.com/authors/mynamepong">mynamepong</a>)</figcaption></figure><blockquote>辨識車道 LCA</blockquote><p>Co-Pilot360如同Ford官網介紹，擋風玻璃上的攝影機有著重要的角色。靠著這台攝影機，可以辨識車道，讓車輛持續且主動的維持在車道中行進。達到主動式的車道維持置中功能。既然是靠攝影機，那如果遇到進入隧道，通過隧道出口，逆光以及大雨的情形下，是否會產生車道無法辨識的情況呢。</p><p>逆光常常會因為相機白平衡的調整，產生畫面暗部增多且整體亮度變較暗。但依據實測結果，車道辨識並未受到影響。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSSml4HFNcm4%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSSml4HFNcm4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSSml4HFNcm4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a13322e2a49c123bcfccefb47ba71d60/href">https://medium.com/media/a13322e2a49c123bcfccefb47ba71d60/href</a></iframe><p>根據實測結果在進入隧道，光線變暗，離開隧道時，光線明顯變亮，車道辨識也不會產生辨識中斷的情形。</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fbz7apbUKRig%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dbz7apbUKRig&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fbz7apbUKRig%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/141c3e54325fdf8903d0e1353283c4f9/href">https://medium.com/media/141c3e54325fdf8903d0e1353283c4f9/href</a></iframe><p>大雨的情形，因為寫此篇時，並沒有遇到，所以無法拍下影片。不過在大雨情境下的使用經驗中，基本上小雨並不太影響車道辨識。但若是大雨的情境下，的確會有可能發生無法辨識車道的情形。因此若遇到下大雨，還是建議提高警覺自行進行駕駛。</p><blockquote>LCA與ACC啟動限制</blockquote><p>雖然Co-Pilot360是全速域系統，但是啟動機制還是有一些條件。</p><p>靜止狀態，前方有車。ACC與LCA可在靜止狀態被啟動。ACC偵測到前方靜止狀態，將自動進入停止模式。等待使用者按下RES，將繼續啟動工作。</p><p>靜止狀態，前方無車。ACC與LCA無法被啟動。使用者須將車輛加速，再進行啟動ACC與LCA。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5S40wPzyunSjuyzd3Z1mng.png" /></figure><h3>信任</h3><p>有人說軟體開發是一門藝術，軟體設計師靠著分析與設計，實現出自認為趨近完美且被市場接受的作品。軟體設計師靠著無數的邏輯判斷與一連串的If….Else組出一連串的程式代碼，建構出智能駕駛輔助系統。每一個系統都具有著唯一性與獨特性。</p><p>每個系統在設計上所思考的點不同，每個人組出來的代碼也不相同，Focus的Co-Pilot360就是眾多系統中的其中一個智能駕駛之作。也因為不同的建構思維，就會造就出不同的功能執行的特性。</p><p>所以建議使用者在使用這套系統時，先慢慢摸索，先了解特性，才能真正安心的使用這套系統，建立對系統的信任。不過，畢竟只是輔助駕駛系統，一切只是輔助，駕駛人還是必須提高注意力在駕駛行為上，才能確保安全。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5536f674de67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bits-to-blocks/%E9%A7%95%E9%A6%ADford-focus-mk4-acc-lca%E4%B9%8B%E5%AE%8C%E5%85%A8%E6%94%BB%E7%95%A5-5536f674de67">駕馭Ford Focus MK4 ACC/LCA之完全攻略</a> was originally published in <a href="https://medium.com/bits-to-blocks">bits-to-blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python中的underscore _ 與 __及實例剖析]]></title>
            <link>https://medium.com/bits-to-blocks/python%E4%B8%AD%E7%9A%84underscore-%E8%88%87-9b40caf32483?source=rss-e0216d33195e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b40caf32483</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[軟體開發]]></category>
            <category><![CDATA[科技]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ching]]></dc:creator>
            <pubDate>Thu, 01 Nov 2018 09:46:20 GMT</pubDate>
            <atom:updated>2018-11-01T12:58:43.218Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python中的underscore _ 與 __ 及實例剖析</h3><blockquote>__ 或是 _，在python code中常常看到，在class命名中寫成 __class_ 感覺可以讓程式碼看起來更專業，但～究竟代表什麼意義</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fx1_d_1M36z6wFYL" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>要了解_ / __的實質作用，就必須先看python公布的程式碼風格指引(PEP 8)，以下就是說明與實際範例：</p><pre>_single_leading_underscore: weak &quot;internal use&quot; indicator. E.g. from M import * does not import objects whose name starts with an underscore.</pre><pre>single_trailing_underscore_: used by convention to avoid conflicts with Python keyword</pre><pre>__double_leading_underscore: when naming a class attribute, invokes name mangling (inside class FooBar, __boo becomes _FooBar__boo; see below).</pre><pre>__double_leading_and_trailing_underscore__: &quot;magic&quot; objects or attributes that live in user-controlled namespaces. E.g. __init__, __import__ or __file__. Never invent such names; only use them as documented.</pre><p><strong>前置單一底線 </strong><strong>_$(object)</strong> ：用於類別內部使用，from M import *並無法直接使用此類的物件。此種用法類似於在class中定義private的method或是attribute。</p><p>Common.py</p><pre>def _gcd_core(a, b):<br>    if b == 0:<br>        return a<br>    else:<br>        return _gcd_core(b, a % b)</pre><pre>def find_cd(a):<br>    cd_list=[]<br>    for x in range(1, (a + 1)):<br>        ans = a % x<br>        if ans == 0:<br>            cd_list.append(x)<br>    return cd_list</pre><pre>--------------------------------------------------------<br>&gt;&gt;&gt; from CommonDivisor import *<br>&gt;&gt;&gt; find_cd(60)<br>[1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60]<br>&gt;&gt;&gt; _gcd_code(54,30)<br><strong>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>NameError: name &#39;_gcd_code&#39; is not defined</strong></pre><blockquote><em>一但在method中加入前置單一下底線，那其他程式就無法直接引用 😒</em></blockquote><p><strong>後置單一底線 </strong><strong>$(function)_</strong>：避免與python的關鍵字衝突<br>以下是python keyword列表</p><pre>[&#39;False&#39;, &#39;None&#39;, &#39;True&#39;, &#39;and&#39;, &#39;as&#39;, &#39;assert&#39;, &#39;async&#39;, &#39;await&#39;, &#39;break&#39;, &#39;class&#39;, &#39;continue&#39;, &#39;def&#39;, &#39;del&#39;, &#39;elif&#39;, &#39;else&#39;, &#39;except&#39;, &#39;finally&#39;, &#39;for&#39;, &#39;from&#39;, &#39;global&#39;, &#39;if&#39;, &#39;import&#39;, &#39;in&#39;, &#39;is&#39;, &#39;lambda&#39;, &#39;nonlocal&#39;, &#39;not&#39;, &#39;or&#39;, &#39;pass&#39;, &#39;raise&#39;, &#39;return&#39;, &#39;try&#39;, &#39;while&#39;, &#39;with&#39;, &#39;yield&#39;]</pre><p>透過加入下底線可以避免與關鍵字衝突。如：import_ , pass_, assert_</p><p><strong>前置雙底線 </strong><strong>__$(attribute)</strong> ：透過這樣的宣告，讓變數命名具有唯一性，也就是在類別中具有一個獨立的名稱。可以參考<a href="https://zh.wikipedia.org/wiki/%E5%90%8D%E5%AD%97%E4%BF%AE%E9%A5%B0">name mangling</a>。透過以下的範例可以更清楚了解。</p><p>首先宣告兩個不同的class， class Math()以及class Calculator(Math)。其中在Math宣告offset並給一個預設值100。</p><pre>#mathlib_procA.py</pre><pre>class Math():<br>    offset = 100<br>    <br>    def readOffset(self):<br>        print(&quot;the Math function offset has returned&quot;)<br>        return self.offset</pre><pre>#mathlib_procB.py</pre><pre>class Calculator(Math):</pre><pre>def addValue(self, a, b):<br>        self.offset = 20<br>        print (&quot;the object is %s, __offset at %s&quot;%(self, self.offset))<br>        return (a + b + self.readOffset())</pre><p>接著執行以下程式：</p><pre>&gt;&gt;&gt; from mathlib_procB import *<br>&gt;&gt;&gt; m = Calculator()<br>&gt;&gt;&gt; m.addValue(20, 30)<br>the object is &lt;mathlib_procB.Calculator object at 0x101e93c50&gt;, __offset at 20<br>the Math function offset has returned<br>70</pre><p>可以看到Calculator與Math都會共同參考到同一個變數offset，也就是說當Calculator變更offset時，是更動到Math中的offset。因此得到相加之後的結果是70，這樣的使用會使得兩個class中的offset具有相同的記憶體位置。</p><p>接下來，讓我們將Math的offset變更為__offset。如以下片段：</p><pre>#mathlib_procA.py</pre><pre>class Math():<br>    __offset = 100<br>    <br>    def readOffset(self):<br>        print(&quot;the Math function offset has returned&quot;)<br>        return self.__offset</pre><pre>#mathlib_procB.py</pre><pre>class Calculator(Math):</pre><pre>def addValue(self, a, b):<br>        self.__offset = 20<br>        print (&quot;the object is %s, __offset at %s&quot;%(self, self.__offset))<br>        return (a + b + self.readOffset())</pre><p>現在我們在用同一段程式碼來執行：</p><pre>&gt;&gt;&gt; from mathlib_procB import *<br>&gt;&gt;&gt; m = Calculator()<br>&gt;&gt;&gt; m.addValue(20, 30)<br>the object is &lt;mathlib_procB.Calculator object at 0x10c780c88&gt;, __offset at 20<br>the Math function offset has returned<br>150</pre><p>可以看到結果不同，相加之後變成150。也就是說，offset的定義在Math以及Calculator是不同的，因為Math與Calculator因為__(double_underscore)的宣告具有不同的記憶體空間，也就是程式在編譯時，就把他劃為兩個不同的實體。雖然名稱相同，但是歸屬在不同的class之中。</p><p><strong>前置與後置加上雙底線 </strong><strong>__$(variables)__</strong> ：簡單來說，就是python已經定義好使用雙底線的關鍵字，如__init__; __new__; __file__; __eq__。這些關鍵字都有特殊的用途，大家可以在<a href="https://www.python.org/dev/peps/pep-0207/">PEP 207</a>以及<a href="https://www.python.org/dev/peps/pep-0008">PEP 8</a>之類的文件中找到。在這邊也提醒使用者不要自己創建新的關鍵字。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b40caf32483" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bits-to-blocks/python%E4%B8%AD%E7%9A%84underscore-%E8%88%87-9b40caf32483">Python中的underscore _ 與 __及實例剖析</a> was originally published in <a href="https://medium.com/bits-to-blocks">bits-to-blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[如何在mac隱藏檔案]]></title>
            <link>https://medium.com/bits-to-blocks/%E5%A6%82%E4%BD%95%E9%9A%B1%E8%97%8F%E6%AA%94%E6%A1%88-98e26417ece4?source=rss-e0216d33195e------2</link>
            <guid isPermaLink="false">https://medium.com/p/98e26417ece4</guid>
            <category><![CDATA[中文]]></category>
            <category><![CDATA[科技]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[教學]]></category>
            <category><![CDATA[mac]]></category>
            <dc:creator><![CDATA[Ching]]></dc:creator>
            <pubDate>Wed, 17 Oct 2018 16:31:03 GMT</pubDate>
            <atom:updated>2018-11-01T12:59:25.556Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>在mac中如何透過指令設定檔案或資料夾的隱藏屬性</blockquote><p>隱藏檔案或資料夾，開啟終端機後，如下圖以下兩個步驟，進行設定</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3a6DqofWyui_Ffv51YTgw.png" /></figure><pre>chflags hidden DCIM        //將DCIM資料夾隱藏，將中間的參數調整為nohidden<br>                           //可將檔案或資料夾隱藏</pre><pre>killall Finder             //關閉並重開檔案視窗</pre><p>利用chflags設定檔案或資料夾屬性之後，並無法直接在視窗上看到立即的效果，必須重新開啟視窗才會看到效果</p><p>利用killall Finder可以快速地關閉並且重開桌面上的視窗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4rUH_wVx8hsxBwA5NUXKQ.png" /></figure><p>若看不到隱藏的檔案夾或是檔案，可以透過下面指令設定開啟或是關閉顯示隱藏檔案</p><pre>//顯示所有檔案<br>defaults write com.apple.finder AppleShowAllFiles True</pre><pre>///關閉並重開檔案視窗<br>killall Finder</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98e26417ece4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bits-to-blocks/%E5%A6%82%E4%BD%95%E9%9A%B1%E8%97%8F%E6%AA%94%E6%A1%88-98e26417ece4">如何在mac隱藏檔案</a> was originally published in <a href="https://medium.com/bits-to-blocks">bits-to-blocks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>