Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does python list does not have len() method [duplicate]

Tags:

python

list

Python's length of list can be calculated by len(a_list). My question is, why was a_list.len() not implemented? Is there a reason behind it?

like image 701
NullException Avatar asked Jan 22 '26 14:01

NullException


1 Answers

likely just because its redundant when we already have and are use to len() maybe you could add a .len() method :)

there is a a_list.__len__()

like image 108
d4nk1337sauce Avatar answered Jan 25 '26 02:01

d4nk1337sauce



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!