Opened 6 months ago

Closed 6 months ago

#26704 closed enhancement (fixed)

Py3 : database.oeis implement __getitem__ to replace __getslice__

Reported by: vklein Owned by:
Priority: major Milestone: sage-8.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 vklein)

Fix database.oeis module for python3 :

  • Remove a useless test
  • Define __getitem__ method with for FancyTuple 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 6 months ago by vklein

  • Description modified (diff)

comment:2 Changed 6 months ago by vklein

  • Branch set to u/vklein/develop

comment:3 Changed 6 months ago by git

  • Commit set to ad8e0b89b7941c3f8d8ad002e0d2369905285196

Branch pushed to git repo; I updated commit sha1. New commits:

ad8e0b8Trac #26704: Define __getslice__ for python2

comment:4 Changed 6 months ago by vklein

  • 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 6 months ago by vklein

  • Branch set to u/vklein/26704

comment:6 Changed 6 months ago by vklein

  • Commit set to ad8e0b89b7941c3f8d8ad002e0d2369905285196
  • Status changed from new to needs_review

New commits:

840f17aTrac #26704: Fix database.oeis module for python3 :
ad8e0b8Trac #26704: Define __getslice__ for python2

comment:7 Changed 6 months ago by chapoton

Please add documentation and doctests to the new __getitem__ method.

comment:8 Changed 6 months ago by vklein

It would be the same doctests as those of __getslice__.
What do you think is the most appropriate ? :

  1. Leave as it is.
  2. Add documentation.
  3. Add documentation and doctests and then have the sames tests two times.
Last edited 6 months ago by vklein (previous) (diff)

comment:9 follow-up: Changed 6 months ago by chapoton

either duplicate the doc or add a doctest for when the argument is not a slice but just one element

comment:10 Changed 6 months ago by git

  • Commit changed from ad8e0b89b7941c3f8d8ad002e0d2369905285196 to 34c80dcd140975475e731c20f4db3651933bfedd

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

e3499b4Trac #26704: Fix database.oeis module for python3 :
9cae5bbTrac #26704: Define __getslice__ for python2
34c80dcTrac #26704: Add doctests for __getitem__.

comment:11 in reply to: ↑ 9 Changed 6 months ago by vklein

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 follow-up: Changed 6 months ago by chapoton

manque une ligne vide en dessous de TESTS::

comment:13 Changed 6 months ago by git

  • Commit changed from 34c80dcd140975475e731c20f4db3651933bfedd to af1e0300d0490ab75ef27a21fee0873eac034a89

Branch pushed to git repo; I updated commit sha1. New commits:

af1e030Trac #26704: Add a mising Blankline after TESTS::.

comment:14 in reply to: ↑ 12 Changed 6 months ago by vklein

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'.

Last edited 6 months ago by vklein (previous) (diff)

comment:15 Changed 6 months ago by vklein

  • Status changed from needs_review to needs_work

comment:16 Changed 6 months ago by git

  • Commit changed from af1e0300d0490ab75ef27a21fee0873eac034a89 to 7d03e293f5dc32578d9ec35ac9b24135ea3a162b

Branch pushed to git repo; I updated commit sha1. New commits:

7d03e29Trac #26704: Fix __getitem__ doctests for python2

comment:17 Changed 6 months ago by vklein

  • Keywords thursdaysbdx added
  • Status changed from needs_work to positive_review

Fixed

comment:18 Changed 6 months ago by vklein

  • Status changed from positive_review to needs_review

comment:19 Changed 6 months ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, thanks

comment:20 Changed 6 months ago by vbraun

  • Branch changed from u/vklein/26704 to 7d03e293f5dc32578d9ec35ac9b24135ea3a162b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.