[newbie] making rows of table with discrete values for different number systems

Jean Dupont jeandupont314 at gmail.com
Sun Feb 2 18:44:05 CET 2014


I'm looking for an efficient method to produce rows of tables like this:

for base 2
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
.
.
.
1 1 1 1

for base 3
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 0 2
0 0 0 0 1 0
0 0 0 0 1 1
0 0 0 0 1 2
.
.
2 2 2 2 2 2

As you can see the rows are always twice the size of the base
I _don't_ need to have all rows available together in one array which would 
become too large for higher value number bases. It's sufficient to produce
one row after the other, as I will do further data manipulation on such a row
immediately.

If someone here could suggest best practices to perform this kind of operations,I'd really appreciate it very much

kind regards and thanks in advance
jean




More information about the Python-list mailing list