question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use namedtuples in schedules

See original GitHub issue

What is the expected enhancement?

Often when working with schedules come across objects like (1, SamplePulse(p0, duration=5)), a Tuple[int, ScheduleComponent]. This happens when looking at instructions or children of a schedule, for instance. The request is to use a named tuple, so instead of doing sched_pair[0] and [1] I could use sched_pair.time and sched_pair.schedule

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lcapellutocommented, Oct 1, 2019

No one is working on it afaik 😄 I think it will be fine to keep the entire implementation in the file qiskit-terra/qiskit/pulse/schedule.py. After implementation, I think there are some tests that would be easier to understand if we made use of the names. If you have any questions, or if you need some resources and pointers for getting started, just let me know in this thread!

0reactions
taalexandercommented, Jan 7, 2020

I’m considering this stale, as we will likely replace explicitly timed instructions with relatively timed instructions removing the need for tuples in the first place. Feel free to reopen if you disagree.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Write Pythonic and Clean Code With namedtuple - Real Python
With namedtuple() , you can create immutable sequence types that allow you to access their values using descriptive field names and the dot...
Read more >
Understand how to use NamedTuple and Dataclass in Python
It has attributes sender, receiver, date, amount and _fields , which allow us to access the attribute by both name and index. Create...
Read more >
python - When and why should I use a namedtuple instead of ...
Tuples are immutable, whether named or not. namedtuple only makes the access more convenient, by using names instead of indices. You can only...
Read more >
Python namedtuples and Set Operations - BoTree Technologies
Let us say we have a schedule of a room in form of time-slots and each slot ... created by using the namedtuple()...
Read more >
_replace method of namedtuple class from the ... - Pythontic.com
The _replace() method replaces one or more values with the given new values and returns a named tuple with the updated values. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found