Always Five Trick → Class always returns 5 no matter what when you use len().

Always Five Trick → Class always returns 5 no matter what when you use len().

posted 1 min read
class AlwaysFive:
    def __len__(self):
        return 5

a = AlwaysFive()
print(len(a))  # Always prints 5
0 votes

More Posts

Dashboard Operasional Armada Rental Mobil dengan Python + FastAPI

Masbadar - Mar 12

I Wrote a Script to Fix Audible's Unreadable PDF Filenames

snapsynapseverified - Apr 20

What Is an Availability Zone Explained Simply

Ijay - Feb 12

5 Things This Playwright SQL Fixture Does So You Don't Have To

vitalicset - Apr 13

Python: An Expert-Level Deep Dive into Design, Internals, and Ecosystem

LegendsDaD - Feb 11
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

3 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!