Python代码完成 [英] Python Code Completion

查看:150
本文介绍了Python代码完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#很久以后,我终于决定切换到Python。
我目前面临的问题是关于自动完成。
我想我被C#,特别是resharper所宠坏,我期待Python中存在类似的东西。



我的编辑选择是emacs,之后一些研究我发现 autocomplete.pl yasnippet 和绳索虽然我不清楚,如果和如何可以安装在基于cygwin的系统中,这是我使用的,因为所有相关的文档似乎都是linux特定的...



我目前使用的emac的版本是23.2.1这个python模式捆绑,尽管有用的远远落后于任何研究。



我的问题,python用户必须做的自动完成与手动打字(在可能的情况下使用 M - /



我正在考虑只记忆蟒蛇,附件,扩展等的python内置函数,恢复接近预自动完成编辑模式。

解决方案

我发现这篇文章


我的Emacs Python环境


是最有用和最全面的说明和参考列表,如何设置一个体面的Python无论操作系统平台,Emacs的开发环境。至少它仍然是一些工作,但至少它涵盖了通常推荐用于提供自动完成功能的Emacs中的Python的流行软件包和组件。



我松动使用这个帖子作为使用Emacs 23.2.1和Python 2.6.5在Windows机器上进行设置的指南。虽然在某些情况下,我也安装了Cygwin,而不是运行这个帖子中提到的* nix shell命令,我只需通过网络浏览器下载软件包,并将其解压缩为7zip,并将其复制到我的Emacs的plugin目录中。 p>

另外,为了安装Pymacs,Rope和Ropemacs,我使用了Python的 EasyInstall 包管理器。要使用它,我下载并安装了 setuptools 包使用Windows安装版本。一旦安装,在命令行,cd到各自的下载位置并运行命令

easy_install。



而不是帖子中显示的shell命令。



通常,我保存了任何 *我的〜\.emacs.d\plugins 中的.el 文件(例如%USERPROFILE%\Application Data\.emacs.d\ ),然后更新我的 .emacs 文件以引用它们,如文中所述。



尽管如此,有时候,我已经使用 DreamPie ,因为它确实比Emacs设置完全自动完成自动完成。


After using C# for long time I finally decided to switch to Python. The question I am facing for the moment has to do about auto-complete. I guess I am spoiled by C# and especially from resharper and I was expecting something similar to exist for Python.

My editor of choice is emacs and after doing some research I found autocomplete.pl, yasnippet and rope although it is not clear to me if and how they can be installed in a cygwin based system which is what I use since all the related documentation appears to be linux specific...

The version of emacs I currently use is 23.2.1 which bundles the python mode that although useful is far behind from whatever research has to offer.

My question to python users has to do about how common is autocomplete vs manual typing (using M-/ where possible) ?

I am thinking about just memorizing python build-in functions like len, append, extend etc. and revert close to a pre-autocomplete editing mode. How different such an approach is from what other pythonistas are doing?

解决方案

I found this post

My Emacs Python environment

to be the most useful and comprehensive list of instructions and references on how to setup a decent Python development environment in Emacs regardless of OS platform. It is still a bit of work to setup but at least it covers the popular packages and components generally recommended for Python in Emacs that provide auto-completion functionality.

I loosely used this post as a guide to do the setup on my Windows machine with Emacs 23.2.1 and Python 2.6.5. Although, I also have Cygwin installed in some cases instead of running the *nix shell commands mentioned in the post, I just download the packages via a web browser, unzip them with 7zip, and copy them to my Emacs' plugin directory.

Also, to install Pymacs, Rope, and Ropemacs, I used Python's EasyInstall package manager. To use it, I downloaded and installed the setuptools package using the Windows install version. Once installed, at the command line, cd to their respective download locations and run the command

easy_install .

instead of the shell commands shown in the post.

Generally, I saved any *.el files in my ~\.emacs.d\plugins (e.g. in %USERPROFILE%\Application Data\.emacs.d\) and then updated my .emacs file to reference them as documented in the post.

Despite all this, on occasion, I've used DreamPie since it does have overall better auto-completion out of the box than my Emacs setup.

这篇关于Python代码完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆