Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mojo does not support Python's collections.Counter #2908

Closed
msaelices opened this issue May 31, 2024 · 0 comments
Closed

Mojo does not support Python's collections.Counter #2908

msaelices opened this issue May 31, 2024 · 0 comments

Comments

@msaelices
Copy link
Contributor

In mojo, there is no implementation of Python's collections.Counter

I will work on this

modularbot pushed a commit that referenced this issue Jul 4, 2024
[External] [stdlib] Implement `collections.Counter`

Support for Python's
[collections.Counter](https://docs.python.org/3/library/collections.html#collections.Counter)

Done:
- [X] Implement some of the `Dict` methods: `keys()`, `values()`,
`get()`, `pop()`, `clear()`, `update()`
- [X] Implement some specific `Counter` methods: `total()`,
`most_common()`, `elements()`, `substract()`
- [X] Implement `__add__`, `__iadd__`, `__sub__` and `__isub__`
- [x] Implement `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`.

Pending to match Python signature:
- [ ] Ideally, it should accept all the iterable types, but for now, it
will only work with `List`. I think we need to wait for proper support
from Mojo
- [ ] More `Dict` methods, like `popitem()`, `fromkeys()`,
`__contains__()`, etc.
- [ ] Implement `__sub__` and `__isub__`
- [ ] Implement `__and__`, `__iand__`, `__or__`, `__ior__` and `__neg__`

Ticket: #2908
Closes #2910
MODULAR_ORIG_COMMIT_REV_ID: 0de65221b774d1c358dcb8a3cad1cbaf30fb89f0
martinvuyk pushed a commit to martinvuyk/mojo that referenced this issue Jul 10, 2024
[External] [stdlib] Implement `collections.Counter`

Support for Python's
[collections.Counter](https://docs.python.org/3/library/collections.html#collections.Counter)

Done:
- [X] Implement some of the `Dict` methods: `keys()`, `values()`,
`get()`, `pop()`, `clear()`, `update()`
- [X] Implement some specific `Counter` methods: `total()`,
`most_common()`, `elements()`, `substract()`
- [X] Implement `__add__`, `__iadd__`, `__sub__` and `__isub__`
- [x] Implement `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`.

Pending to match Python signature:
- [ ] Ideally, it should accept all the iterable types, but for now, it
will only work with `List`. I think we need to wait for proper support
from Mojo
- [ ] More `Dict` methods, like `popitem()`, `fromkeys()`,
`__contains__()`, etc.
- [ ] Implement `__sub__` and `__isub__`
- [ ] Implement `__and__`, `__iand__`, `__or__`, `__ior__` and `__neg__`

Ticket: modularml#2908
Closes modularml#2910
MODULAR_ORIG_COMMIT_REV_ID: 0de65221b774d1c358dcb8a3cad1cbaf30fb89f0

Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
modularbot pushed a commit that referenced this issue Sep 13, 2024
[External] [stdlib] Implement `collections.Counter`

Support for Python's
[collections.Counter](https://docs.python.org/3/library/collections.html#collections.Counter)

Done:
- [X] Implement some of the `Dict` methods: `keys()`, `values()`,
`get()`, `pop()`, `clear()`, `update()`
- [X] Implement some specific `Counter` methods: `total()`,
`most_common()`, `elements()`, `substract()`
- [X] Implement `__add__`, `__iadd__`, `__sub__` and `__isub__`
- [x] Implement `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`.

Pending to match Python signature:
- [ ] Ideally, it should accept all the iterable types, but for now, it
will only work with `List`. I think we need to wait for proper support
from Mojo
- [ ] More `Dict` methods, like `popitem()`, `fromkeys()`,
`__contains__()`, etc.
- [ ] Implement `__sub__` and `__isub__`
- [ ] Implement `__and__`, `__iand__`, `__or__`, `__ior__` and `__neg__`

Ticket: #2908
Closes #2910
MODULAR_ORIG_COMMIT_REV_ID: 0de65221b774d1c358dcb8a3cad1cbaf30fb89f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant