Skip to content

Conversation

fchapoton
Copy link
Contributor

found using
`
gg "^\s*[[a-zA-Z0-9, ]*] = " src/sage/

`

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.

Copy link

github-actions bot commented Sep 1, 2025

Documentation preview for this PR (built with commit 07ed645; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@@ -11258,7 +11258,7 @@ def is_equivalent(self, other):
False
"""
A = self.minimization().relabeled()
[initial] = A.initial_states()
initial, = A.initial_states()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure it's the correct syntax ?

sage: a, = [2, 3]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 1
----> 1 a, = [Integer(2), Integer(3)]

ValueError: too many values to unpack (expected 1)
sage: a, *_ = [2, 3]
sage: a
2
sage: a, *_ = [2, 3, 4]
sage: a
2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it works to unpack a list or tuple with one element
sage: moulinsart, = [421]

@@ -680,7 +680,7 @@ def representation_matrix_for_simple_transposition(self, i):
M = matrix(self._ring, digraph.num_verts())
for g in digraph.connected_components_subgraphs():
if g.num_verts() == 1:
[v] = g.vertices(sort=True)
v, = g.vertices(sort=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here. may be you can use v = g.vertices(sort=True)[0]

@@ -2460,7 +2460,7 @@ def bridges(G, labels=True):
if len(b) == 2 and not tuple(b) in ME:
if labels:
if multiple_edges:
[label] = G.edge_label(b[0], b[1])
label, = G.edge_label(b[0], b[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again

@@ -1548,7 +1548,7 @@ cdef class TreelengthConnected:
cdef frozenset reduced_cut

if len(cc) == 1:
[v] = cc
v, = cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v = cc[0] ?

Copy link
Contributor

@dcoudert dcoudert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

vbraun pushed a commit to vbraun/sage that referenced this pull request Sep 4, 2025
sagemathgh-40747: fix some wrong syntax
    
found using
`
gg "^\s*\[[a-zA-Z0-9, ]*\] = " src/sage/

`

### 📝 Checklist

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
    
URL: sagemath#40747
Reported by: Frédéric Chapoton
Reviewer(s): David Coudert, Frédéric Chapoton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants