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.

str(GridQubit) too similar to str(tuple)

See original GitHub issue

Was just waylaid in debugging an issue because I thought I was dealing with two-tuples but it was actually a GridQubit. Their str representation is indistinguishable. I suggest adding a subtle hint that it’s different.

The closest analogy I can think of is the difference between a python list and a numpy array

In[3]: l = [1, 2, 3]
In[4]: print(l)
[1, 2, 3]
In[5]: print(np.asarray(l))
[1 2 3]

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
cduckcommented, Apr 15, 2020

Qubits could have their own version of _circuit_diagram_info_ so the diagram isn’t dependent on the string representation. This would allow a more clear str(q) without changing diagrams.

0reactions
dabaconcommented, Apr 19, 2022

cirq.q added in #5181

Read more comments on GitHub >

github_iconTop Results From Across the Web

converting string to tuple - python
This approach takes not modules at all. But it's not very robust (if the input string will have some inconsistency, e.g. space between ......
Read more >
Python | Convert String to Tuple
Method #1 : Using map() + int + split() + tuple(). This method can be used to solve this particular task. In this,...
Read more >
3 Ways to Convert List to Tuple in Python
Learn how to convert python list to tuple in 3 different ways. ... a tuple with a single element, it will be similar...
Read more >
How to Convert Python Tuples To String | join() - YouTube
How to Convert Python Tuples To String | join() | map() | reduce() | Python BasicsTopics to be covered :How to convert Python...
Read more >
Python Tuples Tutorial: Create & Use ...
C : <class 'str'> 0 : <class 'int'> 0 : <class 'int'> K : <class 'str'> I : <class 'str'> E ... As...
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