谷歌应用引擎 – Go vs. Python 的推荐?

huangapple go评论130阅读模式
英文:

Google App Engine - Go vs. Python recommendations?

问题

我正在考虑编写我的第一个Google App Engine应用程序。C#是我的“母语”,所以用Java编写应用程序当然是最合乎逻辑的选择。但是,作为一个极客,我想借此机会学习一些新东西。

因此,我在Python和Go之间犹豫不决。

  • 根据经验,您是否有强烈的偏好(最好是在App Engine上编写的上下文中)?

  • 如果您来自C#(或其他类似的语言),过渡过程如何?

英文:

I'm looking into writing my first application of Google App Engine. C# is my 'native' language, and so writing the app in Java would of course be most logical. BUT, I'm a geek and would like to take to opportunity to learn something new.

Therefore its a toss-up between Python and Go.

  • Do you have a strong preference based on experience (ideally in the context of writing on App Engine).
  • If you've come from C# (or another similar language), how was the transition?

答案1

得分: 13

最近发布的App Engine的Go运行时被标记为实验性的原因是:Go和Go-on-appengine都是新的,并且处于变化中的状态。

如果你想尝试使用Go在云端运行Go应用程序,可以去试试。如果你想在App Engine上编写生产应用程序,请使用Python或Java。

英文:

The recently-released Go runtime for App Engine is labelled experimental for a reason: Both Go and Go-on-appengine are new and in a state of change.

If you want to experiment with Go and running Go apps in the cloud, go for it. If you want to write a production app on App Engine, use Python or Java.

答案2

得分: 5

这个问题非常主观,但我还是会回答。

Python更容易学习,拥有更庞大的开发社区,成熟稳定,并且有很多第三方库可供您集成到应用程序中。它绝对是一个赢家。

话虽如此,Go是一种设计非常出色的语言。远远超过Python。Go专门设计成在编译时能够捕捉到大多数错误,而Python则以其掩盖错误的能力而闻名。Go代码更容易维护。Go比Python更高效,速度快几倍甚至几个数量级,具体取决于您的操作。

这两种语言都非常强大,编写代码也非常快速 - 您可以在很短的时间内完成很多工作。但是Go还未完成,仍处于不断变化的状态,核心API仍在变动。它的开发者基数相对较小,几乎没有“真实世界”的使用示例。尽管如此,在开发的早期阶段,它已经显示出是一个具有明确用例的引人注目的替代方案。

英文:

This question is about as subjective as they come, but I'll bite anyway.

Python is easier to learn, has a much larger development community, is mature, and has a lot of third-party libraries available for you to integrate into your application. It's a winner for sure.

That said, Go is an extremely well-designed language. Far, far more so than Python. Go was specifically designed to allow you to catch most mistakes at compile time, while Python is almost legendary for its ability to mask your mistakes. Go code tends to be easier to maintain. Go is also dramatically more efficient than Python -- several times faster or even several orders of magnitude faster, depending on what you're doing.

Both languages are very powerful and very fast to write code in -- you can accomplish a lot in a short amount of space. But Go is unfinished and still in a state of flux, with core APIs still changing. It has a comparatively small developer base, and very few "real world" usage examples. Nonetheless, even this early in its development, it's already shown to be a compelling alternative with a clear use case.

答案3

得分: 5

我最近为GAE做了一个Python应用程序,由于我之前有一些Python的经验,所以从C#转过来并没有遇到什么问题,只是花了几天时间阅读文档和使用SDK进行实验。Python相当直观,它是命令式和面向对象的,可能需要稍微改变一下从C#过来的思维方式,但没有什么革命性的变化-使用交互式解释器可以让你在一天内掌握它。学习如何使用数据存储和理解其他GAE特定的API(如blobstore、image、mail)可能需要更多的工作(比如事务/组、一致性模式等),但你可以在需要时逐步了解这些内容。

需要注意的一点是,最近宣布的定价方案使得Python在GAE上成为一个不好的选择,因为它目前无法处理请求,这导致每个请求都需要一个“实例”。据我所知,Go语言也是如此。然而,JVM可以同时处理大约20个请求,如果我记得邮件列表的讨论正确的话。而且你将按实例/小时付费。如果你计划在不久的将来发布你的应用程序,这使得JVM成为最实用的选择。

此外,使用JVM,你可以使用Scala(一种新的、酷的语言)和像Lift这样的框架,理论上应该可以让你移植代码/避免锁定(免责声明:我只是刚开始接触Scala,并没有实际经验)。

所以我建议你在邮件列表上看看其他人对最近变化的看法。

英文:

I did a Python app for GAE recently and coming from C# I had no problems/was able to pick it up in a few days tinkering with the docs and playing with the SDK (I had some previous experience with python).
Python is pretty intuitive, it's imperative and OO, might require a slight change in thinking from C# but nothing revolutionary - using the interactive interpreter will allow you to pick it up in a day IMO.
Learning how to use the datastore and figuring out other GAE specific API's (blobstore, image, mail) will probably be more work (it's specifics like transactions/groups, consistency modes ...) but you can figure that stuff out as you go/when you need it in your app.

One thing to note - recently announced pricing scheme makes Python a bad choice on GAE ATM because it cannot handle requests currently and this leads to one "instance" per request. This is also true for Go ATM (as far as I know). JVM OTOH can handle ~20 simultaneous requests per instance if I remember the mailing list conversations correctly. And you will be paying per instance/hour. This makes JVM the most practical choice if you plan on publishing your application in the near future.

Also using JVM you could use Scala (a new/cool language) and a framework like Lift which should theoretically allow you to port your code/avoid lock-in (disclaimer : I say theoretically because I'm only starting out with Scala and have no practical experience with Lift).

So I would recommend to look around the mailing list and see what other people are saying about the recent changes.

答案4

得分: 4

个人而言,我更喜欢Python,因为它比Go成熟得多。

过去,我以艰难的方式学到了选择不太成熟的技术的风险。

警告,我有偏见地推荐Python,因为我喜欢它,但你也应该小心,因为我听说很多人抱怨Google对Python-App-Engine的支持不够。人们多年来一直要求升级Python支持,但没有人听到他们的声音。

话虽如此,也许Java会是一个更明智的选择,特别是因为你习惯了C#。

英文:

Personally I would prefer Python because is much, much more mature than Go.

In the past, I learnt, the hard way, what are the risks of choosing a not-so-mature technology.

Warning, I am biased to recommend Python because I like it but you should also be careful because I heard many complains about how much support does Google put on Python-App-Engine. People are asking for years to upgrade Python support and nobody hears them.

These being said, probably Java would be a smarter choice, especially because you are used to C#.

答案5

得分: 3

Go在GAE上仍处于实验阶段,所以可能不是学习新语言的最佳平台。Python绝对是一个不错的选择。

考虑到选择一门新语言时,请不要忘记选择Java可以获得JVM,它不仅允许使用Java代码,还可以使用其他语言,如Scala、Grails、Clojure、JRuby等等。

英文:

Go is still experimental on the GAE - so maybe not the best platform to learn a new language. Python is definitely a good choice.

Considering a new language do not forget that by choosing Java you get the JVM which allows not only Java code but also oder languages like: Scala, Grails, Clojure, JRuby any many others.

答案6

得分: 1

Python在GAE上得到了长时间的支持-有很多经过测试的信息、基础设施等。Go是GAE上的新语言。

我会更多地根据语言层面来决定。如果你来自C#,选择Python会更加“高级”,而选择Go则更加“低级”。更低级的控制,但也更关注这一点。如果你对应用程序开发感兴趣,选择Python;如果更关注系统开发,选择Go。对我来说,一个重要的方面是Go内置了类似于actor的并发性,尽管我不知道这在GAE上的支持情况如何。

英文:

Python is since long supported on GAE - lots of tested information, infrastructure, etc. Go is new to GAE.

I would decide more on the language level. Coming from C#, choosing Python you go a bit more "high-level", whereas choosing Go goes more into the "low-level" direction. More low-level control, but also more concern about that. Choose Python if your interest is on application development, and Go if it's more about systems development. One important aspect for me would be that Go has actor-style concurrency built in, though I don't know how well supported this on GAE will be.

huangapple
  • 本文由 发表于 2011年5月29日 16:15:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/6166660.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定