Permalink
Browse files

Added declaration of constants object to rmgpy.quantity Cython header.

This is needed for efficient access to the attributes of the constants
object. Some trickery is needed to also expose constants as a regular
Python module-level variable, as this seems to be a neglected feature of
Cython.
  • Loading branch information...
1 parent 97269cb commit 8844d61882592ad28c6c05bedd15cfbadc7385f8 @jwallen jwallen committed Nov 28, 2011
Showing with 5 additions and 0 deletions.
  1. +1 −0 rmgpy/quantity.pxd
  2. +4 −0 rmgpy/quantity.py
View
@@ -50,3 +50,4 @@ cdef class Constants:
cdef public double Na, kB, R, h, c, pi
+cdef Constants constants
View
@@ -438,3 +438,7 @@ def __init__(self):
# An instance of the Constants class providing easy access to the physical constants
constants = Constants()
+
+globals().update({
+ 'constants': constants,
+})

0 comments on commit 8844d61

Please sign in to comment.