Skip to content

Suggestion: Create mode of conversion back #9

@carlos-adir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions