rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.39k stars 341 forks source link

feat: Add `get_attribute`, `set_attribute` `__getitem__` and `__setitem__` methods to `DefFrame` #1714

Closed MarquessV closed 7 months ago

MarquessV commented 7 months ago

Description

Closes #1710

Checklist

rigetti-githubbot commented 7 months ago

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7073 6201 88% 87% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
pyquil/quilbase.py 93% 🟢
TOTAL 93% 🟢

updated for commit: 56bd079 by action🐍

MarquessV commented 7 months ago

I'm not against this change, but wouldn't implementing the appropriate dunder methods be the "Pythonic" way to do this?

I went back and forth on that. I wanted to make it more clear that a bit of computation is going on (crossing the FFI and converting the value), though the guidelines don't really suggest any patterns around that. Since we were both thinking it, I'll go ahead and add it.