Skip to content

Suggestion: Create mode of conversion back #9

Description

@carlos-adir

A set with one value like {0.25} is transformed into a SingleValue instance.

The suggestion is be able to transform the SingleValue back into a set with one element:

>>> from rbool import *
>>> myset = {0.25}
>>> single = from_any(myset)
>>> single
SingleValue(0.25)
>>> otherset = set(single)
TypeError: 'SingleValue' object is not iterable

The solution is to make SingleValue iterable with only one value:

class SingleValue:
    ...

    def __iter__(self) -> Real:
        yield self.internal

Activity

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions