ski wrote:
hello,
i have created this function that compares the values of a csv file against a dictionary, you can see the code, here

http://paste.lisp.org/display/76705

the affiliations list has 130 items.

is there a better way to build the 'items' list?

Please define "better".

If you mean less code, create a list of just the variable values:

values = [['AAC', 'Association of Airline Cons.'], ['AALA', 'Adv. Activity Licence. Auth.'], ...]

then provide some code to read the list and construct the dicts. In the above I assume all is_selected are False so there is no need to include that.

But why a list of dictionaries? Would not the values list be sufficient?

Or possibly even better define a class (Cls) and make each list entry an instance of the class.

Then values = [Cls('AAC', 'Association of Airline Cons.'), Cls('AALA', 'Adv. Activity Licence. Auth.'), ...]

That I think would be far more useful in the long run.

--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to