On 28/06/17 17:44, Henrique C. S. Junior wrote: > using dictionaries to store information. Here is an example: > > ........................ > basis_sets = { > "Pople-style basis sets": { > "3-21G": "Pople 3-21G (H-Cs)", > "STO-3G": "Minimal basis set(H-I)", > "3-21GSP": "Buenker 3-21GSP (H-Ar)", > "4-22GSP": "Buenker 4-22GSP (H-Ar)", > "6-31G": "Pople 6-31G and its modifications (H-Zn)", > "m6-31G": "Modified 6-31G for 3d transition metals (Sc-Cu)", > "6-311G": "Pople 6-311G and its modifications (H-Br)"}, > > "The def2 basis sets of the Karlsruhe group": { > "def2-SVP": "Valence double-zeta basis set with 'new' polarization > ........................ > > My question is: is this the correct approach? The dictionaries, after > finished, probably will not have to be changed for a long time and my idea > is to import them in the main code.
Using dictionaries is ok, but your keys are inordinately long. I'd probably define the strings as a set of variables(consts) that can then be used in the dictionaries and in your code. Otherwise you are likely to wind up with horrible looking code like: if "beunker" in lower(basic_sets["Pople-style basis sets"]["3-21GSP"]): ..... Which is verbose at the very least and likely to be error prone too. Whereas if you define something like POPLE = "Pople-style basis sets" ... basic_sets = {POPLE: {....}} The code becomes if "beunker" in lower(basic_sets[POPLE]["3-21GSP"]): ... Which, I think, is slightly easier on the eye. (And you can still use the longhand version if you think you need it) > A second question is regarding the creation os a GUI, what are your > recommendations (keeping in mind that I'm not an experienced programmer) > Glade, PyQt + QT Designer, Tkinter or something else (to run on Linux, Mac > and Windows)? For easy to learn wrapping of a CLI I'd suggest Tkinter but if you want to distribute the code to others then Qt probably looks nicer and has more features. But a steeper learning curve. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor