Skip to content

Instantiate extension operations from an OpDef in python #1512

Closed
@aborgna-q

Description

@aborgna-q

So we can use the parametric extension operations

op_def: OpDef = hugr.std.collections.EXTENSION.get_op("push")
# Instantiate `push` with some element type
# This method does not exist
concrete_op: ExtOp = op_def.instantiate(args, sig=optional_signature)
builder.add_op(concrete_op, list, elem)

The current workaround requires manually instantiating ops.ExtOp with a signature and arguments, and setting the private _op_def field.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestpythonPull requests that update Python code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions