Pull Requests · Post #12
PR #1589: Clearer Docstrings for the Angle Type
Another small but meaningful contribution to Quantinuum’s Guppy — this time improving the documentation for the angle type.
The problem: Guppy represents angles in half-turns, which is an uncommon convention. The existing docstring for the angle class didn’t explain what that meant in practice — there was no mention of the conversion to radians, no worked examples, and no note about whether angles wrap around. For anyone not already familiar with the convention, the type was easy to misuse silently.
The fix: PR #1589 addresses Issue #1188 by rewriting the angle class docstring in angles.py to make the convention explicit:
- Conversion stated clearly — 1 half-turn equals π radians (180°), so
angle(0.5)gives π/2 radians - Concrete examples included — showing what common angle values actually represent
- Wrapping behaviour clarified —
angle(2)is not the same asangle(0); angles do not automatically reduce modulo a full rotation
For more technical details, refer to PR #1589.