0
Months    X       Y       Z
June      a       b       c
July            
August
Sept
Oct 
Total   Sum(x)  Sum(y)  Sum(z)

I want this table in my webapp. a,b and c are provided and rest of the values are calculated from them. What should I use here list or dictionary.
Using list I would pass different lists for X Y and Z and sum that using sum value.
Ques 1->Is it ok to initialize a long list even when all the values have to be calculated from a,b and c?
Ques 2->If not what is a better method to do this?

Anand S Kumar
  • 88,551
  • 18
  • 188
  • 176
  • Why do you think you should initialize a long list instead of adding to it as you go? –  Jul 24 '15 at 16:11
  • is it ok to process and add values to list in template? actually I thought calculations should be avoided in template. – Tarun Trikha Jul 25 '15 at 05:33

1 Answers1

0

Question #1) How long is the long list? The maximum size of a python list on a 32-bit machine is 536,870,912 according to this post... How Big can a Python Array Get?

However I would think the first bottleneck you'll going to hit is actually getting that data to the browser. Here's discussion on size limits with regards to various browsers... Browser limitation with maximum Page length

Question# 2) If it's ultimately going out to a web app JSON format is going to be easier to work on with most front end frameworks.

Community
  • 1
  • 1
abaldwin99
  • 903
  • 1
  • 8
  • 26