My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 240: `Evaluate` keyword should take an optional list of modules to add into the namespace of the evaluated expression
  Back to list
Status:  Done
Owner:  pekka.klarck
Closed:  Mar 2009
Type-Enhancement
Target-2.1
Priority-Low


Sign in to add a comment
 
Reported by pekka.klarck, Feb 25, 2009
It's possible, but a bit awkward and really ugly, to use __import__ like:

| ${res} = | Evaluate | __import__('math').ceil(${res}/2) |

It would be nicer to have an optional argument that specifies what modules
(separated with comma) to import like:

| ${res} = | Evaluate | math.ceil(${res}/2) | math |

We could also automatically import often used modules like os, sys and
above math.

Implementing this would be really simple since we can pass imported modules
to eval as a namespace dictionary.

Comment 1 by pekka.klarck, Feb 25, 2009
(No comment was entered for this change.)
Owner: ---
Comment 2 by pekka.klarck, Mar 23, 2009
Added the possibility to give a list of modules to Evaluate in r1479 (and tests in
r1480). This implementation doesn't add any modules to the namespace automatically.
Should we do that or not?
Summary: Evaluate keyword should take an optional list of modules to add into the namespace of the evaluated expression
Status: Started
Owner: pekka.klarck
Comment 3 by pekka.klarck, Mar 23, 2009
We wecided to not add modules into the namespace automatically so this issue is done.
Explicit is better than implicit. 
Status: Done
Comment 4 by janne.t.harkonen, Apr 20, 2009
(No comment was entered for this change.)
Summary: `Evaluate` keyword should take an optional list of modules to add into the namespace of the evaluated expression
Sign in to add a comment

Hosted by Google Code