Skip to content

Add typing to RangeSet to avoid typing errors when iterating #2078

Open
@carl-aa

Description

@carl-aa

Summary

Currently you are able to iterate over RangeSet instances in a ConcreteModel (e.g. for x in y where y is a RangeSet instance), but I get typing warnings saying Expected type `collections.iterable`, got `RangeSet` instead. It would be helpful to expose type hints for RangeSet so that these type warnings could be avoided.

Rationale

It would make development in type aware environments like PyCharm more ergonomic.

Description

I'm not exactly sure what's missing to make the iteration error go away. I would need to research typing issues more.

Additional information

The Set instances work just fine, so it may be easy to compare the two classes to see what change is needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions