Opened 10 years ago

Last modified 10 years ago

## #9989 closed enhancement

# easier access to operands of a symbolic expression — at Initial Version

Reported by: | burcin | Owned by: | burcin |
---|---|---|---|

Priority: | major | Milestone: | sage-4.7.1 |

Component: | symbolics | Keywords: | sd31 |

Cc: | jpflori | Merged in: | |

Authors: | Burcin Erocal | Reviewers: | |

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

Attached patch adds an `op`

attribute to symbolic expressions which gives easy access to its operands. We now have:

sage: x,y,z = var('x,y,z') sage: e = x + x*y + z^y + 3*y*z; e x*y + 3*y*z + z^y + x sage: e.op[1] 3*y*z sage: e.op[1,1] z sage: e.op[-1] x sage: e.op[1:] [3*y*z, z^y, x]

Using `__getitem__()`

directly was not an option since it breaks conversion to numpy.

**Note:**See TracTickets for help on using tickets.