PTT推薦

[問卦] Cython是什麼鬼玩意兒?

看板Gossiping標題[問卦] Cython是什麼鬼玩意兒?作者
SukaBlyat
(Noble Wolf)
時間推噓 5 推:5 噓:0 →:14

我是來問程式語言啦。
我發現了一個Python社群裡面的鬼東西,名字叫做Cython。

它的wikipeida 內容節錄於下面:
Cython (/aɪθɒn/) is a superset of the programming language Python,
which allows developers to write Python code (with optional, C-inspired
syntax extensions) that yields performance comparable to that of C.

翻譯:
Cython是Python程式語言的一個超集,它允許程式開發人員寫Python代碼,卻
能夠達成C語言的效能。

各位知道Python之所以被瞧不起,就是因為它是一行一行執行的直譯式語言,速
度很慢。可是Cython卻說它能夠達成C語言的效能。

那這到底是編譯式語言還是直譯式語言呀?

有沒有Cython的八卦?

--

※ PTT留言評論
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.129.75.207 (臺灣)
PTT 網址

plutox 02/17 17:45就是

lucifiel1618 02/17 17:46python本來就是cpython編譯成c再編

lucifiel1618 02/17 17:46譯成機器碼的啊

lucifiel1618 02/17 17:46cython只是多加一些syntax讓你可以

lucifiel1618 02/17 17:47繞過cpython一些安全檢查而已

lucifiel1618 02/17 17:47比方說你一個純python的code直接用

lucifiel1618 02/17 17:47cython編譯通常是會比cpython來得

venomsoul 02/17 17:47是說,最近力叩python的處理時間都大

venomsoul 02/17 17:47幅縮短,不知道為何

lucifiel1618 02/17 17:47慢的

lucifiel1618 02/17 17:48你要得到很大的速度提升都是要加很

lucifiel1618 02/17 17:49多static type,跟寫c已經差不太多

s0914714 02/17 17:49不同版本的Python也會有效能優化

lucifiel1618 02/17 17:49

lucifiel1618 02/17 17:51主要的意義相當於讓你用純c取代一

kashiwa27 02/17 17:51中國版的python啦

lucifiel1618 02/17 17:51部分的cpython轉譯,盡可能讓你用

lucifiel1618 02/17 17:51最小的努力得到最大的提升

喔喔,原來如此。但我覺得我還是得學C++。

mastoid 02/17 17:53蟒蛇

※ 編輯: SukaBlyat (220.129.75.207 臺灣), 02/17/2025 17:56:36