Skip to content

Proposed improvements to script_repr #297

Description

@jlstevens

There are a few warts in how script_repr works that I think are due to its history starting with where it started in Topographica.

  • Firstly, the only example of a toplevel entry point to generate a script that I have found so far is the one on Simulation. Param could offer a user friendly entry point that can add the import text at the top.

  • Secondly, the script_repr method seems to skip the toplevel import and not fully qualified (e.g "from %s import %s" form is being used when historically we could have just done import topo). A fully qualified import is the safest thing in the general case.

  • Thirdly, it looks like it is up to the downstream classes from param to append to the imports list appropriately. Can't the logic in this branch be extended to support classes and objects (by looking up the corresponding class) in a general way that can be supported at the param level?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions