Skip to content

collections.deque status not matching documentation #9355

@mMerlin

Description

@mMerlin

CircuitPython version

Adafruit CircuitPython 9.0.5 on 2024-05-22; Adafruit PyPortal with samd51j20

Code/REPL

from collections import deque
a = deque((), 5)
len(a)
a.append(0)
a.append(1)
a.append(2)
a.append(3)
a.append(4)
len(a)
a[0]
list(a)

Behavior

0
5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'deque' object isn't subscriptable
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'deque' object is not iterable

Description

The circuitpython collection.deque package does not match the functionality described in https://docs.circuitpython.org/en/latest/docs/library/collections.html#collections.deque
Either the documentation is wrong, or deque is broken, at least for the pyportal build.

Additional information

The information in older issues seem to indicate that deque was implemented, including making it iterable, but that is not what I see. I see a few deque references in the Adafruit Learning System Guides repo:
grep -R --include="*.py" 'deque' .
but from my tests only one of them would actually work in this environment. The empty list with limit. Tests show that using a list for the iterable parameter does not work, and neither does specifying the maxlen keyword.
Another search in the circuitpython repo found some references in tests. Again, many would appear to fail from the repl tests I did. The comment in tests/cpydiff/modules_deque.py says "Deque not implemented", which is not accurate either. A hold over from the fork?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy