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

发布网友

我来回答

1个回答

热心网友

明智的做法是:

在bug旁边写一个“#todo: computer will explode while running the program for 24+ hours”,然后继续写代码。
为了防止你今后忘掉这个bug,pycharm会在3个地方提示你:
<img src="https://pic1.mg.com/de3b59e9b056e6b2b441507bc7bff4ac_b.png" data-rawwidth="968" data-rawheight="553" class="origin_image zh-lightbox-thumb" width="968" data-original="https://pic1.mg.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.mg.com/cece7b8eea2ba4335de15f40fbed118e_b.png" data-rawwidth="503" data-rawheight="309" class="origin_image zh-lightbox-thumb" width="503" data-original="https://pic3.mg.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.mg.com/8a6ed87701d7a2df5791d60bfd071006_b.png" data-rawwidth="297" data-rawheight="269" class="content_image" width="297">

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com