3

为什么云计算厂商倾向于提供 Go 的 API 封装而不是 Python 的?

 3 years ago
source link: https://www.v2ex.com/t/778518
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Python

为什么云计算厂商倾向于提供 Go 的 API 封装而不是 Python 的?

  theklf4 · 1 天前 via iPhone · 3603 次点击
DigitalOcean 和 Vultr 官方都只提供了 Go 语言( DO 还有 Ruby )的 API 封装。为什么不是 Python ? Python 不是运维第一语言么?
27 条回复    2021-05-23 17:35:59 +08:00

putaozhenhaochi

putaozhenhaochi   1 天前 via Android

Go 是云第一语言

coolcoffee

coolcoffee   1 天前   ❤️ 1

我自己也在干着半个运维的活,我更喜欢用 Golang 而不是 Python,虽然 Python 是我入门语言。

Python 需要 Runtime,并且还需要安装对应依赖,而 Golang 编译好了就能直接运行。

wzw

wzw   1 天前

@coolcoffee #2 同感, 我是 py 开发全面转 Go

liprais

liprais   1 天前 via iPhone

Phishion

Phishion   1 天前

文档呢,我怎么没看到,Ruby 都有 Python 没有?

theklf4

theklf4   1 天前 via iPhone

@Phishion #5 developers.digitalocean.com/documentation/v2/ Google 一下不就有了吗?
@wzw #3 我没学过 Python,Rust 转 Go 的。
@coolcoffee #2 我记得 Python 也能打包成不要 Runtime 的可执行文件?

ericls

ericls   1 天前 via iPhone   ❤️ 1

主要还是生态关系 docker k8s 都是 golang

coolcoffee

coolcoffee   1 天前

@theklf4 Python 的动态语言注定很难被静态分析出依赖,所以就算能打包可执行程序也会带上整个 Runtime 和依赖的所有包功能而已。

以前 Python 、PHP 所依赖的就是开发效率快,包生态好。但是现在 Golang 各种操作网络、文件 IO 都封装的非常好,开发效率也不差,生态支持一点点起来之后, 自然而然的能作为一个优先级更高的选择。

Phishion

Phishion   1 天前

这个帖子挺有意思,因为我发现我完全看不懂。

首先看标题,**为什么云计算厂商倾向 “提供 Go 的 API 封装”**

按照我的理解,提供 XX 语言的 API 封装,不应该是比如 DigitalOcean 提供开发者调用的 A 功能,B 功能,是用 XX 语言实现的么?

如果这样理解,那么下面大伙儿回复的大概是 Go 在服务端开发中比其他语言的优势,这个是说得通的。

问题是,楼主下面贴的 D 站的 API 文档,developers.digitalocean.com/documentation/v2/,我扫了一眼,右边的 Example 边栏好像对应楼主说的,仅仅提供了 Go 和 Ruby 的东西,没有 Python 的,可是。。。

可是,卧槽。。。这个不就是调用示例么,属于你写了我看心情复制粘贴一下,你不写就不写了,这个可不是“封装”啊?

那如果“按照提供 XX 语言的示例来理解”,那微信的 API 连 CURL 都没给找谁说理去啊? PHP 找谁说理去啊?

那楼主如果是这个意思,底下留言的网友不就变成自说自话了么?

ipwx

ipwx   1 天前   ❤️ 3

@Phishion https://developers.digitalocean.com/libraries/

楼主估计说的是这里,Official API 只有 Go 和 Ruby,其他的是社区提供的。

但是,这难道不能说明其他语言社区比同时期 Go/Ruby 好很多,所以官方都不用动手就有 Binding 了吗 。。。。

theklf4

theklf4   1 天前 via iPhone

@theklf4 #11 但上面的 API 文档只有 Go 和 Ruby 的调用实例也能一定程度上说明他们认为用这两门语言的运维(?)比 Python 多

shoaly

shoaly   1 天前

其实提供一个 curl 的 就可以让语言之争消停了, 大家都能看懂

Phishion

Phishion   1 天前

@theklf4
那他们如果一定要做一个客户端版本的 API 调用工具,挑一个性能更好的静态语言有什么问题呢,况且 Go 的并发能力比 Python 强不少。

你不需要性能用 Python 手写本身也简单的很,甚至我认为这样的情况占大多数,作为官方的话,客户端本来也不是必选项,如果一定要做一个,肯定要先满足专业市场,我并不觉得 Python 在这方面有特别的优势。

janxin

janxin   1 天前 via iPhone

主要是因为 DO 的主要开发语言就是 Go/Ruby 吧…具体你看一下他们的招人 JD…

chloerei

chloerei   1 天前

说明这家公司用 Go 和 Ruby 的人多。

charlie21

charlie21   1 天前 via iPhone

今晚吃炸酱面

SenLief

SenLief   1 天前   ❤️ 1

这种 restful 的 sdk 应该取决于写这个的人主语言用的是啥吧。。。

hoyixi

hoyixi   1 天前

云 API 通常是通用的,官方提供的开箱即用的 SDK 有哪些语言看心情

echo1937

echo1937   1 天前

1 、说明这家公司用 Go 和 Ruby 的人多。
2 、说明这家公司业务还比较小,AWS 有 C++、Go 、Java 、JS 、.net 、nodejs 、php 、python 、ruby 。

datou

datou   1 天前

百度云就没有 golang sdk....

bthulu

bthulu   1 天前

因为云厂商里的开发人员用 go, 自然优先支持 go

yanzhiling2001

yanzhiling2001   1 天前

he Vultr API v2 is a set of HTTP endpoints that adhere to RESTful design principles and CRUD actions with predictable URIs. It uses standard HTTP response codes, authentication, and verbs. The API has consistent and well-formed JSON requests and responses with cursor-based pagination to simplify list handling. Error messages are descriptive and easy to understand. All functions of the Vultr customer portal are accessible via the API, enabling you to script complex unattended scenarios with any tool fluent in HTTP.

pzzrudlf

pzzrudlf   17 小时 13 分钟前 via iPhone

rust 转 go ?楼主认真的吗?

theklf4

theklf4   16 小时 6 分钟前 via iPhone

@pzzrudlf #26 Rust 目前用的人太少不好找工作(包括国外)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK