So far, I have been using Eclipse for some years, and most of my time has been spent writing Python (installing the Pydev plug-in) and C++ (installing the CDT plug-in).
Recently I heard about PyCharm and its new free community version logr from a friend. This friend of mine has been using Eclipse for a long time and praised PyCharm highly, so I decided to at least try to use PyCharm when working from home. So far, I have fallen in love with it and even use PyCharm in my daily work (the community version is licensed by Apache2).
Below I will introduce some of the things that surprised me when using PyCharm.
Statement
I don't mean to criticize Eclipse or PyDev, I've used them for years and they are great! Please keep in mind that this is my personal experience and yours may be different.
Real-time comparison
PyCharm keeps track of changes you make in a file in real time by displaying a blue marker in the left column of the editor.
This is very convenient. I have been using the command "Compare against HEAD" in Eclipse to compare the changes before and after a file.
In PyCharm, you can see your changes at a glance. At the same time, clicking on the mark will display the previous content and a toolbar:
You can easily roll back these changes, view them in a detailed dialog box or paste the previous text to the clipboard.
Comparison preview when submitting
In Eclipse, when you commit changes, a commit dialog box shows you the list of files that will be committed.
You can double-click any of the items to view a comparison of the changes: At this time, if you see something in the code that you want to modify (such as a misspelled word, a paragraph
missing documentation, etc.), it’s not fun: you have to close everything (including the commit box with your carefully written commit comments), find the offending bit of code, correct it, and start over do it again.
PyCharm has the same features, but your changes are editable. I can't stress enough how great it is to be able to fix those mistakes on the spot!
I can easily fix typos like the ones above during the submission process.
An added bonus is that no matter what reason you close the commit dialog, when you try to commit again, it will retain those commit comments you just filled out.
Check
when submitting During the commit process, we can also perform some other options before the actual commit, such as "optimize imports (sort and remove unused imports)", check the pending items in the change set, etc.
An interesting point is the item "Perform Code Analysis". . .
Code review
You can ask PyCharm to perform "code review" operations on a file, directory, or entire project. It will
without actually executing the program. Find out the existing problems and corresponding improvement methods, such as type checking, static methods, violations of code specifications, etc.
As explained in the previous section, this can also be done automatically in the changed files at commit time. This is the result of a file review:
For some of these review results, you can also apply a fix recommendation. For example, for the suggestion "Function call can be replaced with set literal()", we can select the corresponding option to fix it.
PyCharm will interpret this sentence:
extensions = set(['.avi', '.mp4', '.mpg', '.mkv'])
Automatically replaced with:
extensions = {'.avi', '.mp4', '.mpg', '.mkv'}
You can turn off any review you don't want, including at the project level.
Refactor
I've been trying to rename a module, but I can't find that item in the menu. . . F2 doesn't help either.
Suddenly I noticed the "Refactor/Rename" item under the file submenu and thought. . . Could it be it? Indeed it is!
When you rename a module, PyCharm will ask you if you want to automatically modify all projects associated with it. Blessed!
There are many other refactoring projects, but so far I haven't had a chance to try them all.
关于过时代码的提示以及改进建议
PyCharm可以告诉你代码里面过时的结构块,并且提出一些改进建议。比如,我有像下面一段这样的代码:
with nested(open(filename1), open(filename2)) as (f1, f2): <代码块>
PyCharm会明显的标注出nested:
我用的是Python2.7,事实上你可以使用嵌套上下文管理器,但是,唉,我还得支持python的一些老版本,就保留了nested。
但PyCharm提醒了我,这个事情本身还是很酷的。
任务+特性 分支
如同Eclipse一样(需要Mylin支持),PyCharm也支持基于任务的工作流(包括任务感知的上下文)。
然而PyCharm本身自带了很多直接可用的连接器(GitHub,Mantis,Jira,Bugzilla,等等)。
而且,当你开启一项任务时,它会询问你是否想要创建那个任务的一个特性分支,分支的名字可以配置。
这就避免了必须手动创建一个新的分支,而这个操作确实挺繁琐的(拿到任务的ID,选择名称,等等)。
这个是加分项。
快速
我观察到PyCharm在执行代码的自动完成时扫瞄代码的速度要远快于Eclipse,而且还不打断你当前的工作。
当你想保存一个文件时,Eclipse会阻止你这么做因为它正在后台执行一个任务,这有多惹人烦。。。
快速查看文档
当你把光标挪到一个函数、方法,类或者别的什么上的时候,你会得到一个选项来浏览”快速文档“。看一眼:
正如你看到的,它会用一种赏心悦目的格式展示方法的文档说明,还从代码使用说明中提示了参数的类型。。。即使该函数没有对应的文档说明,你还是会得到像下面这样的一个说明:
很好!
Docutils 支持
PyCharm 还包括了对于doctils的一流支持,这让它很容易从集成开发环境中直接再生成文档。
另一方面,它还包括了一个非常好的富文本(译者注:ReST即reStructuredTexteditor)编辑器(比Eclipse的IMHO好用的多):
完善的插件系统
跟据我的使用经验,在Eclipse里面安装插件是件挺痛苦的事情:
很难找到你想要去的地方(提示: 帮助/安装新软件。。。);
你没有一个单一的索引,所以你得去网上去找那些插件源;
系统有时会因为库的依赖问题而崩溃,结果我就没装上那些我想要的插件(工作中还有其他人也同样遇到这个问题,最后不得不放弃);
PyCharm的插件体验则要流畅地多。
首先,它位于一个你认为它有可能会存在的地方:就在”设置”下面的一项:
你可以很容易地浏览插件:
我快速安装了一个标记编辑器(和ReST一样),一个临时存放代码片段的插件,可以让我直接从选择的文本中快速地剪贴,并且预览代码,和SublimeText类似,还用一个漂亮的代码外观。
结语
目前为止就这些了。我会向我的朋友尽力展示一切我认为“看这有多酷”的事情。我使用PyCharm的时间很短,如果我发现还有更多有趣的事情值得再写一篇发表的话,我会继续写。
原文链接: Bruno Oliveira 翻译: 伯乐在线 - 高磊
The above is the detailed content of Python IDE: A breakdown of the practical functions in PyCharm. For more information, please follow other related articles on the PHP Chinese website!

解决pycharm找不到模块的方法:1、检查python解释器;2、安装缺失的模块;3、检查项目结构;4、检查系统路径;5、使用虚拟环境;6、重启PyCharm或电脑。PyCharm找不到模块是一个常见的问题,但通常可以通过一些步骤来解决,这个问题可能由多种原因引起,比如Python解释器配置不正确、模块没有正确安装或者PyCharm的项目设置有问题。

pycharm打不开可以通过检查系统要求、重新启动计算机、检查防病毒软件和防火墙设置、检查日志文件、更新PyCharm、检查系统环境变量、重置PyCharm设置、检查日志文件和报错信息、卸载并重新安装PyCharm和向PyCharm官方支持寻求帮助来解决。详细介绍:1、检查系统要求,确保计算机满足PyCharm的最低系统要求;2、重新启动计算机等等。

pycharm可以通过使用搜索和替换功能、结合正则表达式进行高级替换、使用代码重构功能、使用Structural Search and Replace和导入外部工具进行批量替换来批量替换。详细介绍:1、使用搜索和替换功能,打开PyCharm,打开要进行批量替换的项目或文件夹等等。

pycharm注释快捷键有:1、单行注释,使用“#”;2、多行注释,使用三引号“””;3、批量注释,选择要注释的文本行,背景变化后,同时按“Ctrl+/”;4、取消批量注释,选择已注释的文本行,背景变化后,同时按“Ctrl+/”;5、批量缩进,选择要缩进的文本行,背景变化后,按下“TAB”键;6、取消批量缩进,选择要缩进的文本行,背景变化后,按下“SHIFT+TAB”键。

pycharm改变背景颜色的方法:1、使用主题设置,在PyCharm设置对话框中,选择 "Editor",选择喜欢的主题,点击 "Apply"即可;2、使用自定义背景颜色,在 "Editor"选项卡中,点击"Background",选择喜欢的颜色,确认即可;3、使用快捷键快速更改背景颜色,按下 "Ctrl+Alt+S" 组合键打开设置对话框,跟上面一样选择型号的颜色即可等等。

pycharm和python区别是:1、PyCharm是一款软件开发工具,而Python则是一种编程语言;2、PyCharm提供了丰富的功能和工具,而Python本身提供了各种库和模块;3、PyCharm主要用于编写、调试和运行Python代码,而Python语言可以应用于各种开发场景等等。

pycharm切换python版本的方法:1、通过项目配置,在“New Project”或“Open”对话框中,可以指定Python解释器的版本;2、使用虚拟环境,虚拟环境为每个项目提供了一个隔离的Python环境,可以在不影响其他项目的情况下更改和升级库和依赖项;3、使用系统环境变量,可以添加一个新的系统环境变量,指向使用的Python解释器的路径;4、使用第三方插件等等。

pycharm闪退可以通过检查系统要求、升级PyCharm版本、检查插件、检查日志文件、检查Java环境、重置PyCharm配置、检查操作系统更新、启动时清除缓存和重新安装PyCharm解决。详细介绍:1、检查系统要求,确保计算机满足PyCharm的系统要求;2、升级PyCharm版本,官方会不断修复和改进软件,新版本可能会修复一些已知的问题;3、检查插件等等。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor
