Opened 2 years ago
Closed 2 years ago
#26704 closed enhancement (fixed)
Py3 : database.oeis implement __getitem__ to replace __getslice__
Reported by:  vklein  Owned by:  

Priority:  major  Milestone:  sage8.5 
Component:  python3  Keywords:  thursdaysbdx 
Cc:  Merged in:  
Authors:  Vincent Klein  Reviewers:  Frédéric Chapoton 
Report Upstream:  N/A  Work issues:  
Branch:  7d03e29 (Commits)  Commit:  7d03e293f5dc32578d9ec35ac9b24135ea3a162b 
Dependencies:  Stopgaps: 
Description (last modified by )
Fix database.oeis module for python3 :
 Remove a useless test
 Define
__getitem__
method with forFancyTuple
object. It replace__getslice__
method in python3.
As __getslice__
is still defined in tuple in python 2.7 we still need a __getslice__
method in FancyTuple
to override it.
__getslice__
is deprecated since python 2.6 and removed in python 3.x
Change History (20)
comment:1 Changed 2 years ago by
 Description modified (diff)
comment:2 Changed 2 years ago by
 Branch set to u/vklein/develop
comment:3 Changed 2 years ago by
 Commit set to ad8e0b89b7941c3f8d8ad002e0d2369905285196
comment:4 Changed 2 years ago by
 Branch u/vklein/develop deleted
 Commit ad8e0b89b7941c3f8d8ad002e0d2369905285196 deleted
 Description modified (diff)
 Summary changed from Py3 : database.oeis replace __getslice__ by __getitem__ to Py3 : database.oeis implement __getitem__ to replace __getslice__
comment:5 Changed 2 years ago by
 Branch set to u/vklein/26704
comment:6 Changed 2 years ago by
 Commit set to ad8e0b89b7941c3f8d8ad002e0d2369905285196
 Status changed from new to needs_review
comment:7 Changed 2 years ago by
Please add documentation and doctests to the new __getitem__
method.
comment:8 Changed 2 years ago by
It would be the same doctests as those of __getslice__
.
What do you think is the most appropriate ? :
 Leave as it is.
 Add documentation.
 Add documentation and doctests and then have the sames tests two times.
comment:9 followup: ↓ 11 Changed 2 years ago by
either duplicate the doc or add a doctest for when the argument is not a slice but just one element
comment:10 Changed 2 years ago by
 Commit changed from ad8e0b89b7941c3f8d8ad002e0d2369905285196 to 34c80dcd140975475e731c20f4db3651933bfedd
comment:11 in reply to: ↑ 9 Changed 2 years ago by
Replying to chapoton:
either duplicate the doc or add a doctest for when the argument is not a slice but just one element
I ve done the second one.
comment:12 followup: ↓ 14 Changed 2 years ago by
manque une ligne vide en dessous de TESTS::
comment:13 Changed 2 years ago by
 Commit changed from 34c80dcd140975475e731c20f4db3651933bfedd to af1e0300d0490ab75ef27a21fee0873eac034a89
Branch pushed to git repo; I updated commit sha1. New commits:
af1e030  Trac #26704: Add a mising Blankline after TESTS::.

comment:14 in reply to: ↑ 12 Changed 2 years ago by
Replying to chapoton:
manque une ligne vide en dessous de TESTS::
My bad.
And my newest tests won't work in py2 as sage: ft[0]
return '\xc3\xa9'
.
comment:15 Changed 2 years ago by
 Status changed from needs_review to needs_work
comment:16 Changed 2 years ago by
 Commit changed from af1e0300d0490ab75ef27a21fee0873eac034a89 to 7d03e293f5dc32578d9ec35ac9b24135ea3a162b
Branch pushed to git repo; I updated commit sha1. New commits:
7d03e29  Trac #26704: Fix __getitem__ doctests for python2

comment:17 Changed 2 years ago by
 Keywords thursdaysbdx added
 Status changed from needs_work to positive_review
Fixed
comment:18 Changed 2 years ago by
 Status changed from positive_review to needs_review
comment:19 Changed 2 years ago by
 Reviewers set to Frédéric Chapoton
 Status changed from needs_review to positive_review
ok, thanks
comment:20 Changed 2 years ago by
 Branch changed from u/vklein/26704 to 7d03e293f5dc32578d9ec35ac9b24135ea3a162b
 Resolution set to fixed
 Status changed from positive_review to closed
Branch pushed to git repo; I updated commit sha1. New commits:
Trac #26704: Define __getslice__ for python2