Comments (5)
我提供一些使用案例 (目前工作以 Python 為主)
-
copy
e.g. Python 語言內建的 copy 模組,其中有:shallow copy, deep copy
都是複製物件的值 -
clone
沒印象、可能太少遇到,不過我常用的一個框架 PyTorch 中有一個案例:
https://pytorch.org/docs/stable/tensors.html#torch.Tensor.clone
用法和意思跟 Python 原生的.copy()
幾乎一樣 -
duplicate
Diablo2 的 soj 之類的 (誤)
或是 IDE 的 複製一整行
我的經驗、感覺是 duplicate 似乎和另外兩個有明顯的不同,但是 copy 和 clone 好像沒有?
按照字典好像也是可以完全互通的字,好像差別在 copy 比較通俗一點?
https://www.ldoceonline.com/dictionary/copy
https://www.ldoceonline.com/dictionary/clone
https://www.ldoceonline.com/dictionary/duplicate
看起來 duplicate 似乎會有 "重複" 的意味?
討論一下
from english-for-programmers.
我的 感覺 是, clone 與 duplicate 似乎更強調「整體、過程複雜的複製」。
而 copy 相對地可以是只複製一部分。
例如說,
- 上下文脈絡在談「一份很多頁的文件」,我們只需要複製其中一句、一段、一頁時,我會說 "copy" 。
- 上下文脈絡在談「一台伺服器」,我們需要再組一台完全一樣配備的機器時,我會說 "clone" 或 "duplicate" 。
duplicate
Diablo2 的 soj 之類的 (誤)
😆😅
from english-for-programmers.
查了些語源學資料:
- copy
- 14 世紀後期,「抄寫、複製 文字/文件」
- 1640 年代,「模仿 (它人的例子)」
- 1953 ,「複製電腦資料」
- 1983 ,「送一份文件、信、 email 給第三方」
- clone
- 1903 ,植物學,「出枝、出芽複製的植物」
- 1970 ,「複製人、動物基因」
- 1978 ,「 slavishly 模仿它人例子」
- slavishly: > in a way that shows no attempt at originality
- 或許可譯為「照本宣科」
-
照著本子念經文。比喻刻板的照著現成的文章或稿子宣讀,不知靈活運用。
- slavishly: > in a way that shows no attempt at originality
- duplicate
- 15 世紀早期,「雙份的」
- 15 世紀晚期,「重覆(repeat)/複製一份」
- https://www.etymonline.com/word/copy
- https://www.etymonline.com/word/clone
- https://www.etymonline.com/word/duplicate
from english-for-programmers.
我的用法,供參:
- copy 我僅有用在從網頁中複製文字的按鈕的方法名稱「copyFromXXX」
- clone 變數 ex:
var clonedData = Object.assign({}, data);
- duplicate 整個資料,且有操作到 API 且 DB 真的出了內容相同的新資料
var datumId = 1;
var duplicatedDatum = await duplicateDatum(datumId);
from english-for-programmers.
我的用法,供參:
- copy 我僅有用在從網頁中複製文字的按鈕的方法名稱「copyFromXXX」
- clone 變數 ex:
var clonedData = Object.assign({}, data);
- duplicate 整個資料,且有操作到 API 且 DB 真的出了內容相同的新資料
var datumId = 1; var duplicatedDatum = await duplicateDatum(datumId);
很有意思,我的理解如下:
- copy: 單一 value
- clone: 比「單一 value」範圍更廣的「物件」
- duplicate: 比「物件」範圍更廣、跨抽象層的資料
這樣與你描述的相符嗎?
from english-for-programmers.
Related Issues (20)
- 各個「產生」的差異與應用:Create, Make, Generate HOT 6
- 「必要的」: necessary vs. required
- 771. Jewels and Stones HOT 4
- 1342. Number of Steps to Reduce a Number to Zero HOT 3
- 1528. Shuffle String HOT 9
- 1365. How Many Numbers Are Smaller Than the Current Number HOT 3
- 1281. Subtract the Product and Sum of Digits of an Integer HOT 7
- 1603. Design Parking System
- 1313. Decompress Run-Length Encoded List
- 1614. Maximum Nesting Depth of the Parentheses
- 1389. Create Target Array in the Given Order
- 1486. XOR Operation in an Array
- 1640. Check Array Formation Through Concatenation HOT 2
- 1221. Split a String in Balanced Strings
- 1290. Convert Binary Number in a Linked List to Integer
- 938. Range Sum of BST
- 1588. Sum of All Odd Length Subarrays HOT 2
- 啟用「釋出(Release)」功能以減少通知信
- 如何命名「幾小時內更新」變數 HOT 3
- 啟用「討論區(Discussions)」來試用看看
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from english-for-programmers.