pyshell and unum hint

Stephen_B stephen at theboulets.net
Tue May 15 08:49:14 EDT 2007


I like to have unum units imported automatically on my PYTHONSTARTUP
since I'm always converting things, and I also like to use pyshell.

They conflict for some reason I don't understand (pyshell doesn't like
the Unum.as method, maybe since it will be a keyword):

1.0*IN.as(M)
  File "<input>", line 1
    1.0*IN.as(M)
            ^
SyntaxError: invalid syntax

Instead I put this in my PYTHONSTARTUP:

from unum.tools.calc import *
Unum.to = Unum.as

Which gives:

1.0*IN.to(M)
0.0253999368687 [m]

Stephen




More information about the Python-list mailing list