Operating environment
Xeon E5-2620 v4 (8 cores) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 and its-devel
mpich.x86_64 3.1-5.el6 and its-devel
gcc version 4.4.7 (And gfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.Use 1.
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
Python 3.6.0 on virtualenv
--Method 1: Process with double for in list
code
test_python_170323d.py
atuple = ((3, 1, 4), (1, 5, 9), (2, 6, 5))
print(atuple)
# 1
res = [ flatten for inner in atuple for flatten in inner ]
res = tuple(res)
print(res)
# 2
res = ()
for rows in atuple:
res = res + rows
print(res)
result
$ python test_python_170323d.py
((3, 1, 4), (1, 5, 9), (2, 6, 5))
(3, 1, 4, 1, 5, 9, 2, 6, 5)
(3, 1, 4, 1, 5, 9, 2, 6, 5)
Method 1 takes a long time to understand (Time-till-understanding in Readable code) after reading the code.
For the time being, let's use the implementation of Method 2.
Recommended Posts