10000 [Feature Request] implement `__getitem__` for ListLiteral · Issue #2141 · modular/modular · GitHub
[go: up one dir, main page]

Skip to content
[Feature Request] implement __getitem__ for ListLiteral #2141
@kiran-4444

Description

@kiran-4444

Review Mojo's priorities

What is your request?

I see this issue being referred in #100 and few other places, but __getitem__ isn't still implemented (or at least I wasn't able to access an item using it's index in a ListLiteral).

What is your motivation for this change?

I'm trying to work on #2018 and found that I need to iterate through a list of possible env variables that define the temp dirs names. But I'm surprised that I can't access the list items using their indices:

fn _candidate_tempdir_list() raises:
    var dirlist = []

    var env_vars = ["TMPDIR", "TEMP", "TMP"]
    for i in range(len(env_vars)):
        var env_var = env_vars.get(i)

Any other details?

I'd like to implement this if someone else isn't already working on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmojoIssues that are related to mojomojo-repoTag all issues with this label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0