Steven D'Aprano wrote:
> Why do you want something that isn't a mapping to be usable with mapping
> unpacking?
I think mapping is not `abc.Mapping` class only.
What about:
`Iterator[Tuple[str, int]]`
```
@dataclass
class MyMap:
x: int
y: int
```
Is this "mapping"?
In Python I can use `/` as path separator: `pathlib.Path.cwd() / 'my_dir'`. I
can control the behavior of my class.
But I only have one way to unpack the object. Not a perfect way. `dict.update
()` gives more freedom.
Steven D'Aprano wrote:
> Does it really hurt you to provide mapping methods when you get them
> for free? Just inherit from Mapping.
```
# first.py:
@dataclass
class Point2D(Mapping):
# second.py
@dataclass
class Point3D(Point2D):
```
Now I have to think about unnecessary public methods.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/NWWJI4UO44A3AJXDGWRKMUQJVLQRGIXU/
Code of Conduct: http://python.org/psf/codeofconduct/