Size: 1309
Comment:
|
Size: 1633
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 33: | Line 33: |
{{{#!python import scipy scipy.pi # pi is in the name space of scipy |
|
Line 34: | Line 37: |
from scipy import pi pi # pi is in the active name space from scipy import * pi # all identifiers of scipy are in the active name space del(pi) # Deletes pi from the active name space reset # ipython function to delete all identifiers }}} |
Contents
Variable names
Allowed names for identifier (name of variable or function):
Any sequence of alphabetical character, number, or underline character _
- First symbol has to be a character
- Case sensitive
- Not a python built-in keyword
Name space
The Python interpreter maps the name of an identifier in the active name space. The active name space depends on the active code block (module, function). The identifier can be local or global with respect to the active code block.
1 import scipy
2 scipy.pi # pi is in the name space of scipy
3
4 from scipy import pi
5 pi # pi is in the active name space
6
7 from scipy import *
8 pi # all identifiers of scipy are in the active name space
9
10 del(pi) # Deletes pi from the active name space
11 reset # ipython function to delete all identifiers
Built-in
Scalar
Plain integer: 9
Long integer: 9**99, 1L
Hex integer: 0x10
Floating point: 0.1
Exponential floating point: 1e-3
Complex: 3+2j
Casting
- int()
- long()
- float()
- complex()
- str()
Sequences
String
Tuple
List
Dictionary
Extended data types
Array