Pycharm里面的TODO功能有什么作用

 我来答
幸福999快乐
2016-04-07 · TA获得超过5.1万个赞
知道大有可为答主
回答量:7610
采纳率:89%
帮助的人:4176万
展开全部
明智的做法是:

在bug旁边写一个“#todo: computer will explode while running the program for 24+ hours”,然后继续写代码。
为了防止你今后忘掉这个bug,pycharm会在3个地方提示你:
<img src="https://pic1.zhimg.com/de3b59e9b056e6b2b441507bc7bff4ac_b.png" data-rawwidth="968" data-rawheight="553" class="origin_image zh-lightbox-thumb" width="968" data-original="https://pic1.zhimg.com/de3b59e9b056e6b2b441507bc7bff4ac_r.png">
另外,在多人协作的项目中,todo还可以用来区分“谁要去修复这个bug”。PyCharm官方文档介绍如下:

create several filters, which you will use to show the TODO items, say, for each of the developers, and not for your good self. For this purpose, in the Filters section, click , and specify the filter names, for example, For John, For Bob, and not for me. Associate these filters with the patterns:
<img src="https://pic3.zhimg.com/cece7b8eea2ba4335de15f40fbed118e_b.png" data-rawwidth="503" data-rawheight="309" class="origin_image zh-lightbox-thumb" width="503" data-original="https://pic3.zhimg.com/cece7b8eea2ba4335de15f40fbed118e_r.png">
Now, in the source code, create TODO items: in the line of code, where you want to add a note, press Ctrl+Slash, or Ctrl+Shift+Slash, and type TODO that matches one of the patterns, followed by some meaningful description:
<img src="https://pic3.zhimg.com/8a6ed87701d7a2df5791d60bfd071006_b.png" data-rawwidth="297" data-rawheight="269" class="content_image" width="297">
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式