Opened 9 years ago
Closed 9 years ago
#25093 closed New feature (fixed)
utils.datastructures.OrderedSet doesn't implement __len__
Reported by: | Keryn Knight | Owned by: | Sambhav Satija |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | django@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
>>> x = set([1, 2]) >>> len(x) 2 >>> from django.utils.datastructures import OrderedSet >>> y = OrderedSet([1, 2]) >>> len(y) TypeError: object of type 'OrderedSet' has no len()
Given the implementation of __iter__
, it seems like it would be plausible to re-use that:
>>> len([z for z in y]) 2
Change History (5)
comment:1 by , 9 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Version 0, edited 9 years ago by (next)
comment:3 by , 9 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
comment:4 by , 9 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.