Re: create global variables?-the full story

2006-11-07 Thread Alistair King
Happy pythoning! > > Cheers, > Cliff > Thanks Cliff, this is what i need, it seems to make much more sense to do this way. I think once i learn to include datastructures within each other im gonna try to make up this 3D 'array' (i think this is a word from C, is there a python equ

Re: create global variables?-the full story

2006-10-31 Thread Alistair King
Steve Holden wrote: > Alistair King wrote: > >> Steve Holden wrote: >> >> >>> [EMAIL PROTECTED] wrote: >>> >>> >>> >>>> J. Clifford Dyer wrote: >>>> >>>> >

Re: create global variables?

2006-10-31 Thread Alistair King
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > >> J. Clifford Dyer wrote: >> >> >>> Alistair King wrote: >>> > > [... advice and help ...] > > >> this worked a treat: >> >> def monoVarcalc(atom): >> &

Re: create global variables?

2006-10-30 Thread Alistair King
Gary Herron wrote: > Alistair King wrote: > >> Hi, >> >> is there a simple way of creating global variables within a function? >> >> >> > Use the "global" statement within a function to bind a variable to a > global.

Re: IE7 skulduggery?

2006-10-30 Thread Alistair King
refox hangs and wont reopen until i restart. Is this likely to be anything related to IE7? -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Science P.O. Box 55 (A.I. Virtasen aukio 1) FIN-00014 University of Helsinki Tel. +358 9 191 50392

create global variables?

2006-10-30 Thread Alistair King
.. it seems to work but again i can only print the values of Xma and Xaa ? Alistair -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Science P.O. Box 55 (A.I. Virtasen a

Re: dict problem

2006-10-30 Thread Alistair King
Peter Otten wrote: > Alistair King wrote: > > >> the code works great now. I know these things are quite simple to learn >> from books etc.. but i would be lost without this mailinglist, from lack >> of time. Hopefully soon i can give something more complicat

Re: dict problem

2006-10-30 Thread Alistair King
Fredrik Lundh wrote: > Alistair King wrote: > > >> Is there any other way of removing double and single quotes from a >> number, as a string, to give the float value again? >> > > help(str) describes what you can do with a string (an object of type >

dict problem

2006-10-30 Thread Alistair King
Ben Finney wrote: > Alistair King <[EMAIL PROTECTED]> writes: > > >> Ben Finney wrote: >> >>> Even better, work on a minimal program to do nothing but reproduce >>> the unexpected behaviour. If you get to such a program and still >>> do

Re: dict problem

2006-10-25 Thread Alistair King
ou get to such a program and still don't > understand, then post it here so others can run it themselves and > explain. > > ive checked the values and XDS is actually returning a string where i want a float ie '123.45' not 123.45. -- Dr. Alistair King Research Chemist,

dict problem

2006-10-25 Thread Alistair King
Jon Clements wrote: > > Alistair King wrote: > > > > > >> >> Hi, >> >> >> >> ive been trying to update a dictionary containing a molecular formula, >> >> but seem to be getting this error: >> >> >> &

dict problem

2006-10-25 Thread Alistair King
, XDS) updateDS1v(FHas, H, XDS) updateDS1v(FOas, O, XDS) updateDS1v(FNas, N, XDS) updateDS1v(FSas, S, XDS) updateDS1v(FClas, Cl, XDS) updateDS1v(FBras, Br, XDS) updateDS1v(FZnas, Zn, XDS) print DS1v I know there is probably a simple solution but im quite new to python and am lost? Ali -- Dr

variable creation

2006-08-08 Thread Alistair King
f the dictionary containing typical elements: pt = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811} Ali -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Scien

Re: help - iter & dict

2006-08-05 Thread Alistair King
thanks to Simon Forman, his solution worked, the key value pairs were entered the wrong way round in the dictionary...Doh! -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Science P.O. Box 55 (A.I. Virtasen aukio 1) FIN-00014

Re: help - iter & dict

2006-08-04 Thread Alistair King
gt; float, in line 142 of your code (in the findClosest function). So the problem > is > that 'target' is a float while 'v' is a string. > > 'v' should be a float as well, but it's a string since the values in your > dictionary are strings instead

Re: help - iter & dict

2006-08-04 Thread Alistair King
= abs(z - exvalue) # Create a var to store the closest key result = u # Iterate through the rest of the dict. for u, z in diter: # Compute the closeness. v = abs(z - exvalue) # Check if it's closer than the closest. if v < closest: # If so, store the new closest. closest = v # And stor