发布网友
共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">