Opened 5 years ago

Closed 5 years ago

#16118 closed enhancement (invalid)

__len__ method for sage.misc.lazy_list

Reported by: MatthieuDien Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: misc Keywords: days57
Cc: Merged in:
Authors: Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: u/MatthieuDien/__len___method_for_sage_misc_lazy_list (Commits) Commit: ed1b53af550d86584632ef53bf07ec5d2a361344
Dependencies: Stopgaps:

Description (last modified by MatthieuDien)

Currently, the only way to obtain the cache's length of a lazy_list is to call info method which print on the standard output :

sage: from sage.misc.lazy_list import lazy_list
sage: l = lazy_list(NN)
sage: l[42]
sage: l.info()
cache length 43
start        0
stop         2147483647
step         1

The goal of this ticket is to provide a __len__ method to obtain this length :

sage: from sage.misc.lazy_list import lazy_list
sage: l = lazy_list(NN)
sage: len(l)
0
sage: l[42]
42
sage: len(l)
43
sage: l[36]
36
sage: len(l)
43

Change History (11)

comment:1 Changed 5 years ago by MatthieuDien

  • Component changed from PLEASE CHANGE to misc
  • Keywords days57 added
  • Type changed from PLEASE CHANGE to enhancement

comment:2 Changed 5 years ago by MatthieuDien

  • Description modified (diff)

comment:3 Changed 5 years ago by MatthieuDien

  • Description modified (diff)

comment:4 Changed 5 years ago by MatthieuDien

  • Branch set to u/MatthieuDien/__len___method_for_sage_misc_lazy_list

comment:5 Changed 5 years ago by MatthieuDien

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

New commits:

ed1b53aadd __len__ method for lazy_list

comment:6 Changed 5 years ago by MatthieuDien

After some discussions, this ticket need to be closed See #16137

comment:7 Changed 5 years ago by MatthieuDien

  • Milestone changed from sage-6.2 to sage-duplicate/invalid/wontfix

comment:8 Changed 5 years ago by mmezzarobba

  • Status changed from needs_review to positive_review

comment:9 Changed 5 years ago by vbraun

author/reviewer names

comment:10 Changed 5 years ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba

comment:11 Changed 5 years ago by vbraun

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.