Skip to content

_NamedIslSetOrMapLike.project_out's types falsely advertises that it handles "str". #26

Closed

Description

@kaushikcfd

Reproducer:

$ python -c "import namedisl as nisl; domain=nisl.make_set('{ [i] : 0 <= i < 1 }'); print(domain.project_out('i'))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import namedisl as nisl; domain=nisl.make_set('{ [i] : 0 <= i < 1 }'); print(domain.project_out('i'))
                                                                                 ~~~~~~~~~~~~~~~~~~^^^^^
  File "/home/kaushikggg/projects/namedisl/namedisl/set_like.py", line 279, in project_out
    for dt, chunks in chunked_dims_by_type(
                      ~~~~~~~~~~~~~~~~~~~~^
            names, self.space.name_to_dim).items():
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kaushikggg/projects/namedisl/namedisl/core.py", line 299, in chunked_dims_by_type
    raise TypeError("expected collection of names, got string")
TypeError: expected collection of names, got string

An easy fix is to just have:

    def project_out(self,
                names: Collection[str],
                *, cache: Cache | None = None,
            ) -> Self:

Activity

  1. inducer commented on Sep 7, 2026

    @inducer
    Owner

    See #27. That said, I don't expect it'll help, since str is a subtype of Collection[str].

  2. added a commit that references this issue on Sep 7, 2026
    1d6be37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions