From: dagbrown (Dave Brown) Date: 22:21 on 16 Sep 2003 Subject: Scripting languages again Class, can I have your attention? Hands up, everyone who knows how to find the length of a string in Perl. Yes, Jimmy? You're right, the answer is "length()". How about C++'s string class? You're right, Elizabeth, it is "length()"! Anyone want to venture how you get the length of a string in Ruby? Oh, hello, Simon! Yes, the answer is "the length() method!". Very good! Yes, thank you, Simon, I know that you can also use "size()". That's enough. THANK YOU. Alright. Can anyone in the class explain why Python chose to have "return the length of a string" be a standalone function called "len()" forcing the would-be Python programmer to reach for the manual? Nobody? Ah, young Guido, yes. "Because that would be too much like Perl, which is unreadable by definition." That's certainly an interesting theory you have there. I'll be sure to share it with the rest of the teachers after class. Feh. --Dave
From: David Cantrell Date: 22:34 on 16 Sep 2003 Subject: Re: Scripting languages again Dave Brown wrote: > [everyone uses length()] > > Can anyone in the class explain why Python chose to have "return > the length of a string" be a standalone function called "len()"? Because that's how BASIC does it. Copying BASIC is truly hateful.
From: Yoz Grahame Date: 22:34 on 16 Sep 2003 Subject: Re: Scripting languages again On Tue, Sep 16, 2003 at 10:21:29PM +0100, Dave Brown wrote: > Can anyone in the class explain why Python chose to have "return > the length of a string" be a standalone function called "len()" > forcing the would-be Python programmer to reach for the manual? Ah, but doesn't BASIC have LEN() as well? Not that "because BASIC does it that way" is a statement that can be used for anything other than language-design comedy, but still... -- Yoz
Generated at 10:28 on 16 Apr 2008 by mariachi