|
Python Coding
Guidelines/ Standards
|
|
Python is a case sensitive
language
|
|
Identifier: Name of
variable, method, module, class, object etc is called identifier.
Identifier can have letters,
number, _, can start with underscore and alphabets
Identifier cannot have other
special characters
Class name should start with
capital letter other identifier start with small letter
If identifier start with _,
means it need to be private
If identifier start with __,
means it need to be strongly private
If identifier start and end
with __ , means identifier has
language defined special name
Eg: __init()__
|
|
Blocks in python does not
use braces, for blocks we use indentation
|
|
Statement in python does
not end with semicolon, each line shows a separate statement
If
we want to write statement in multiple line we can use line continuation
symbol(\),
statement contains []{}()
does not need line continuation symbol
|
|
Comments is created by
using # symbol
|
|
String can be placed in ‘’ or “” or(triple) ‘’’ ‘’’ or “”” “”” , triple is used when string
exists in more than 1
line
|
|
raw_input(“enter data”) its
is used to take user from input @runtime
print(“HELLO”) command is used to print something on
console
num = raw_input("Enter a number :") |
|
Multiple statements in
single line can be placed by separating through semi colon
|
Sunday, September 14, 2014
Python for Testers: Python coding guidelines
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment