Closed geertn444 closed 5 years ago
What kind of API would you want for this? It gets kind of complicated to have to specify arbitrary column spans for a table.
Although we could possibly do this assuming that data passed in nested iterables would need to get expanded:
>>> data = ["A", ("B1", "B2", "B3")]
>>> tp.row(data)
--------------
| A | B1 |
| | B2 |
| | B3 |
--------------
(right now, the above produces an error)
yes, that is exactly the case. I have these nested lists and they contains ip subnets, like this:
data= ["10.0.0.0/8", ("10.0.1.0/24","10.0.2.0/24", "10.0.3.0/24")]
As you can see, left is mostly the supernet, right the smaller subnets, but it can also be visa versa:
data = [("11.0.1.0/24","11.0.2.0/24","11.0.3.1/32"),"11.0.0.0/8"]
and each of such "data" would need to be printed in a single row of a table
After thinking about this some more, there is an ambiguity that is hard to disentangle. For example, let's say your data is: [[1, 2, 3], [4, 5]]
. If you want to put an empty string in a column, you need some way of specifying which column to use. For example, should the table print:
1 2 3
4 5
or
1 2 3
4 5
This can get arbitrarily complicated as you can have this occur multiple times in a table.
For simplicity, I think it is better if the user currently specifies this by explicitly passing in an empty string to denote an empty spot. Going to close this issue, but feel free to reopen if you can think of a clever way to deal with the ambiguity.
Something like:
if A elements are the same, but B1 & B2 elements are different. (in fact, table is a result of a "group by column 1" ) I can try to simulate this by inserting rows with zero value for column A, but i don't know that order will be kept.