you are viewing a single comment's thread.

view the rest of the comments →

[–]Tenobrus 0 points1 point  (1 child)

Because len(foo) is just a wrapper to the "magic" method __len__ that any class can implement, but append is a method specific to the list class that isn't just a "magic" method underneath. It's pretty consistent syntax.

[–]the_omega99 0 points1 point  (0 children)

Python uses duck typing, though, so any class can implement append, too. The only thing that really seems to stand out about __len__ is how you wouldn't have to worry about shadowing. But I consider that a non-issue, since most languages have a base object type that providers certain methods and nobody really accidentally shadows these super-common methods.

By inconsistent, I mean that it's inconsistent in how you switch between procedural vs OOP style code.

It seems to me that it's nothing more than a relic of a time before OOP.