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

We will use len(object) to get length from a class which will be come from __len__. And will support more methods so on... #120

Closed
Tracked by #49
Almas-Ali opened this issue Apr 29, 2024 · 0 comments · Fixed by #147
Labels
built-in classes built-in classes built-in methods Built-in methods (functions) enhancement New feature or request proposal Radon Enhancement Proposal (REP)

Comments

@Almas-Ali
Copy link
Member

No description provided.

@Almas-Ali Almas-Ali added enhancement New feature or request built-in methods Built-in methods (functions) built-in classes built-in classes proposal Radon Enhancement Proposal (REP) labels Apr 29, 2024
Vardan2009 added a commit to Vardan2009/radon-fork that referenced this issue May 28, 2024
Closes radon-project#120

Now all objects that have __len__() defined can be called with len(), even with classes!
```
class Test
{
    fun __constructor__(){};
    fun __len__()
    {
        return 10
    }
}
len(Test()) # 10
len("test") # 4
len([1,2,3]) # 3
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
built-in classes built-in classes built-in methods Built-in methods (functions) enhancement New feature or request proposal Radon Enhancement Proposal (REP)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant