A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-August/017320.html below:

[Python-Dev] copy, len and the like as 'object' methods?

[Python-Dev] copy, len and the like as 'object' methods?James_Althoff@i2.com James_Althoff@i2.com
Mon, 27 Aug 2001 11:17:25 -0700
Tim Peters wrote:
>Say what?!  What kind of stupid-ass language spells the len() function as
if
>it were a method?  That's carrying consistency to an irrational extreme --

Well, only those stupid-ass, irrational, and extremist languages that
include classes and methods as an integral and uniform part of the language
from the very beginning, I guess.

The "stupid-ass, irrational, extremist" side is merely saying that

mylist.append(x)
mylist.length()
mylist.extend(y)
mylist.length()

is more sensible (easier for new-to-python programmers to discover, more
consistent, more mainstream)

than

mylist.append(x)
len(mylist)
mylist.extend(y)
len(mylist)

and that len(mylist) as syntactic sugar for mylist.__len__() is sugar that
adds no value compared to just doing the straightforward thing of writing
mylist.length() or mylist.len().

But you all clearly like spelling it len(mylist) and it's already there, so
... whatever.

Jim




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4