Remove `QCDType.iteration_length_or_zero` hack

Open
#1,716 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Search the repository for iteration_length_or_zero and inspect its call sites and the QCDType annotations. The issue proposes narrowing the dtype type or adding general minimum and maximum value methods, then updating usages accordingly. Done means the hack is removed and affected code uses the appropriate typed attribute or value bounds; no specific tests are named.

Written by the indexing model from the issue text.

Description

area/qdatatype

This was added to fix some type checking issues.

  • investigate usages of dtype.iteration_length_or_zero ... can the qcdtype python annotations be improved to narrow dtype to e.g. BQUInt and then just use the iteration_length attribute?
  • In general, we could add (more general, appropriate) methods to get the minimum and maximum value encodable by the dtype
  • If this tack is used, modify usages of iteration_length_or_zero to use e.g. dtype.max_val - dtye.min_val or whatever it expects
Dominant language
Python
Stars
397
Forks
127
Avg merge
2d 22h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/Qualtran

All issues in quantumlib/Qualtran

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.