Is vars() the most useless Python built-in ever?

Steven D'Aprano steve at pearwood.info
Tue Dec 1 19:57:58 EST 2015


On Wed, 2 Dec 2015 07:33 am, Rick Johnson wrote:

> On Tuesday, December 1, 2015 at 1:55:59 AM UTC-6, Steven D'Aprano wrote:
>> Python was never intended to be "merely" a teaching language. I think
>> Guido's original vision was for it to be a glue language between C
>> libraries, and a scripting language.
> 
> It's a well know fact that GvR was inspired to create Python from his
> experiences working with a language called ABC -- and ABC was designed
> *EXCLUSIVELY* to be a beginners language. 

Certainly. But do you have any evidence that *Python* was designed to be
exclusively a beginner's language?

It is possible to be inspired by a teaching language without aiming to be
limited to the functionality of a teaching language.


>> > Rick said:
>> > (1) How do you output a message without the print function?
>> 
> Steven said:
>> *scratches head*
>> 
>> Why would you want to do that? print is clearly the "one obvious way" to
>> output a message.
> 
> Well of course the answers are *OBVIOUS* when you already *KNOW* them
> Steven! Climb down off your high horse for a moment, and take yourself
> back to a time *BEFORE* you had any knowledge of output streams.

What's an output stream?

All I know is that if you want to print a message, calling "print" is the
obvious way to do it. Using the word "print" for writing text on the screen
is very common, although not ubiquitous. Rosetta Code includes over 300
examples of the "Hello World" program, and a quick glance at the page shows
that (apart from deliberately obfuscatory languages and assembly
languages), print is one of the more common functions used:

http://rosettacode.org/wiki/Hello_world/Text

Others include:

echo
puts
write
writeln
printf
println
display
console.log
cout
say
System.Console.WriteLine

which vary in their obviousness.



[...]
> Ponder the following example code (as a noob!):
> 
>  stdout.write("Dude, i found my car, the hood, and the effing engine!!!")
> 
> Even a noob can intuit what is going on here. First we have an *OBJECT*
> named "stdout, and we can extrapolate that stdout is an abbreviation for
> StandardOutput. Next, we see a method called "write", and, if our IQ is
> above room temperature, then we can extrapolate what that method will do.

Are you serious? You think that a complete beginner to programming is going
to have an intuitive grasp of stdout? What did you say earlier about
putting aside my knowledge of output streams?


> Now ponder this code (as a noob!):
> 
>  print("Dude, where's the intuitiveness?")
> 
> What the heck does print do? 

It's a standard English word, and has been since at least 1469, and possibly
as long ago as 1150. As a native English speaker, I'm surprised that your
vocabulary is so lacking that you need help with that, especially as an
American. Didn't they teach you "printing" (block letters) and "cursive"
(joined up letters) handwriting when you were at school?



> Where will the string go after i execute this 
> line of code? Should i turn my printer on? Should i check my ink levels?
> And what OEM drivers are required?

That's an interesting point. In, oh, a dozen or more years of dealing with
Python beginners, I have come across *exactly one* beginner who assumed
that print would send output to the printer. 

Where there's one, there are probably more, but I think it is fair to say
that the idea of *printing to the screen* is commonplace, and these days
probably even more common than the idea of printing to paper. I expect that
kids learning BASIC in the 1970s probably had more difficulty with the
concept, but even then, that difficulty would extend to as long as it takes
somebody to say "it prints the message to the screen".


> Not only is "print" un-intuitive (by nature of it's naming), it is
> obfuscating the path to the underlying process of "sending data to an
> output stream".

A wise man once said to me, "take yourself back to a time *BEFORE* you had
any knowledge of output streams". Although I suspect perhaps he was more of
a wise guy than a wise man.



-- 
Steven




More information about the Python-list mailing list