Skip to content

Evaluate keyword should take an optional list of modules to add into the namespace of the evaluated expression #240

Closed

Description

@spooning

Originally submitted to Google Code by @pekkaklarck on 25 Feb 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.

Activity

  1. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 23 Mar 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?

  2. added this to the 2.1 milestone on Jun 29, 2014
  3. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 23 Mar 2009

    We wecided to not add modules into the namespace automatically so this issue is done.
    Explicit is better than implicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions