如果您是python编码器,则可能会遇到寻找在子类别代码上更好地注释您的代码的方法。我用子类别代码的意思是,您可能有代码块,然后又有一个与前一个块相关的代码块。这是一个示例(请注意注释):
# Drink some water to keep your body hydrated:
initialize some parameters
# Choice a glass:
pick up the glass number one
if the glass was dirty:
wash the dishes # this would be difficult.
# Pour the glass with water:
while the glass is not filled up:
pour the glass
我想说的是我们正在寻找简单性,当您处于代码中间时,最好知道您的确切位置。再次查看评论,但这次作为标题:
# h1
initialize some parameters
# h2:
pick up the glass number one
if the glass was dirty:
wash the dishes
# h2:
while the glass is not filled up:
pour the glass
因此,当您看到注释h2
时,很容易知道这部分代码是h1
的子代码:
我通常将首字母大写作为h1
以供注释,而以下相关的代码块也不大写。让我们清除代码,只关注注释:
# Drink some water to keep your body hydrated:
... line of codes ...
# choice a glass:
... line of codes ...
# pour the glass with water:
... line of codes ...
有一些优点和优点:
专业人士:
硬币:
所以,我就像是“为什么不与其他人分享这一点,以了解他们的想法以及他们喜欢或使用的东西”,对自己说。
如果您是python编码器,则可能会遇到寻找在子类别代码上更好地注释您的代码的方法。我用子类别代码的意思是,您可能有代码块,然后又有代码块...
所以我正在检查类似的东西
我通常将代码拆分为python部分: