Physical constants

2006-11-03 Thread Tommy Grav
I have some code for doing orbital computations. The code is kind ofextensive with many classes, each having several functions. In thesefunctions I need to use constants (like the gravitational constant). What is the best way of implementing a solution when constants areused in several different

Re: Physical constants

2006-11-03 Thread Rares Vernica
Hi, I am not sure how the constants are implemented in math, but here is how I would do it. The main idea is to declare the constants as globals in some file. Declare all the constants in a file: const.py --- pi = 3.14 Whenever you want to use pi from another file, just do: somecode.py ---

Re: Physical constants

2006-11-03 Thread Jean-Paul Calderone
On Fri, 3 Nov 2006 18:57:49 -0500, Tommy Grav [EMAIL PROTECTED] wrote: I have some code for doing orbital computations. The code is kind of extensive with many classes, each having several functions. In these functions I need to use constants (like the gravitational constant). What is the best way

Re: Physical constants

2006-11-03 Thread Steven D'Aprano
On Fri, 03 Nov 2006 18:38:33 -0800, Rares Vernica wrote: Hi, I am not sure how the constants are implemented in math, import math math.__file__ '/usr/lib/python2.4/lib-dynload/mathmodule.so' Looks like it is all done in C. It's probably just a binding to your platform's C floating point

Re: Physical constants

2006-11-03 Thread Steven D'Aprano
Apologies for breaking threading, but my ISP seems to have eaten the original post from Tommy. Hence I'm replying to a reply. Tommy Grav wrote: I have some code for doing orbital computations. The code is kind of extensive with many classes, each having several functions. In these functions I