Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#539 closed defect (fixed)

Support for strides in the slice filter.

Reported by: Esaj Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords: slice strides
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This patch adds support for strides in the slice filter.

For example:

{% my_list|slice:"::2" %}

should include every other element of my_list.

Attachments (2)

defaultfilters.py.diff (1.3 KB) - added by Esaj 11 years ago.
efficient_slice.patch (877 bytes) - added by Esaj 11 years ago.
A more efficient implementation of slice supporting strides.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by Esaj

Attachment: defaultfilters.py.diff added

comment:1 Changed 11 years ago by Adrian Holovaty

Status: newassigned

We might be able to solve this more efficiently using the slice() built-in function.

Changed 11 years ago by Esaj

Attachment: efficient_slice.patch added

A more efficient implementation of slice supporting strides.

comment:2 Changed 11 years ago by Esaj

Practically did it in one line :)

comment:3 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: assignedclosed

Fixed in [666].

Note: See TracTickets for help on using tickets.
Back to Top