2.3. Variable and keywords, variable syntax

Python has some conventions for variable names. You can use any letter, the special characters “_” and every number provided you do not start with it. White spaces and signs with special meanings in Python, as “+” and “-” are not allowed.

Important

Python variable names are case-sensitive, so EcoRI and ecoRI are not the same variable.

>>> EcoRI = 'GAATTC'
>>> ecoRI
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'ecoRI' is not defined
>>> ecori
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'ecori' is not defined
>>> EcoRI
'GAATTC'
	    

Among the words you can construct with these letters, there are some reserved words for Python and can not be used as variable names. These keywords define the language rules and have special meanings in Python. Here is the list of all of them:

         and      assert   break    class    continue def      del      elif   
         else     except   exec     finally  for      from     global   if 
         import   in       is       lambda   not      or       pass     print 
         raise    return   try      while    yield