| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Follow-up to PR python#146407. Calling .clear() on a tuple, frozenset, or frozendict now suggests the mutable counterpart (list / set / dict), mirroring the existing append/extend/insert/remove/discard/update entries for the same immutable types. Triggered by @henryiii noticing that .clear() was the first method they tried on these types and got no useful suggestion, and @vstinner agreeing it was worth adding. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
There was a problem hiding this comment.
LGTM.
@ZeroIntensity @picnixz: Do you want to double check the change?
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Follow-up to #146407. Calling .clear() on a tuple, frozenset, or frozendict now suggests the mutable counterpart, mirroring the existing append/extend/insert/remove/discard/update entries for the same immutable types.
Requested by @vstinner after @henryiii flagged that .clear() was the first method they tried on these types in the new hint table from #146407 and got no useful suggestion.
>>> (1, 2, 3).clear() AttributeError: 'tuple' object has no attribute 'clear'. Did you mean to use a 'list' object? >>> frozenset({1, 2, 3}).clear() AttributeError: 'frozenset' object has no attribute 'clear'. Did you mean to use a 'set' object?Verified locally: ./python.exe -m test test_traceback 434/434 passing.