So interesting is python...
I'm gonna record down what I find in python while I'm learning it.
The first one is...... the comment
When I was trying to "comment" some lines of code, I found there was only line comments in python. There isn't syntax of multi-line comment like "/*..*/" in C, in Python.
Then I came up with an idea, there did exist a method to make some lines "invalid" which is to put them into quotes. Just like this:
"""
print 'THIS IS WHAT I DONT NEED CURRENTLY"
"""
In fact this is not any kind of "comment". It would be intepreted as a string and have an negative affect upon effeciency. As python is slow indeed, certainly the case can be ignored:)
Python注释技巧
本文探讨了Python中的注释方法,特别是在Python中缺乏多行注释语法的情况下如何有效地使用单行注释及字符串来达到注释的目的。作者还讨论了将不需要的代码段用三引号括起来的方法,尽管这种方法实际上被解释为字符串而非注释。

被折叠的 条评论
为什么被折叠?



