Skip to content

Support slice operator for array types #475

Open
@septatrix

Description

@septatrix

As the title already says, it would be useful to allow code like for element in ringbuffer[head:tail]: do_stuff(element). Currently one has to wrap the object with list(foobar)[start:end] but I see no reason why this shouldn't be natively supported.

If you think this is a great idea and could point me to where this would need to be implemented I would be happy to do so. My initial idea how this could should work was the following

foobar # is Object(prog, 'struct foobar [128]', address=0x100)
foobar[4:8] # is Object(prog, 'struct foobar [4]', address=0x100 + 4*sizeof(foobar))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions