Hi Stan,

On 24 Okt., 17:21, Stan Schymanski <[email protected]> wrote:
> udict = {h_c: h_c*joule}
>
> Traceback (click to the left of this block for traceback)
> ...
> NameError: name 'joule' is not defined
>
> Does anyone know how I can get around this error without re-typing the
> whole dictionary and adding "units.xxx." in front of every single
> unit?

Why not simply defining
  sage: joule = units.energy.joule
?

Of course, you could be more radical and automatically export anything
in units.energy into the global name space:
  sage: for s in units.energy.trait_names():
  ....:     globals()[s] = getattr(units.energy,s)
  ....:
  sage: joule
  joule
  sage: british_thermal_unit
  british_thermal_unit

Best regards,
Simon

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to