Skip to content

Add int.__length__ method #113855

Closed as not planned
Closed as not planned
@AaronShenny

Description

@AaronShenny

Feature or enhancement

Proposal:

# Add a code block here, if required
num = 0
def len(int):
    while int> 0:
	int =  int//10
	num =  num+1
    return num

if we enter a len(num) it gives :

Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    len(555)
TypeError: object of type 'int' has no len()

It will be every helpful if we add this

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions