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

Steven D'Aprano steve at pearwood.info
Fri Dec 11 23:44:36 EST 2015


On Sat, 12 Dec 2015 09:13 am, Rick Johnson wrote:

> Intuitiveness and productivity have a
> synergy like peas and carrots! One cannot be productive if one is fighting
> an unintuitive interface. Could you drive with your toes? How about your
> tongue?

Drive a car with my tongue? Perhaps not, but I could drive a car with my
mouth if it were equipped with a sufficiently powerful interface.

"Driver, please take me to the airport."


> Sure, even the most atrocious interface can be "learned", but what i
> cannot understand, except in the case of you being a contrarian, is why
> you would argue *AGAINST* intuitive interfaces? And believe it or not,
> *SYNTAX* is an interface! As are paradigms!

I do believe that you are arguing against a strawman. I don't think that
anyone here has argued *against* "intuitiveness", all else being equal. But
you are glossing over a whole lot of real complexity:

- what makes you think all else actually is equal?

- who decides what is intuitive and what isn't? why should we take 
  your word over what's intuitive and what isn't?

- intuitive for who? my dad, who has never used a computer? my mum, 
  who has used a computer but only for word processing and web 
  browsing? a ten year old maths prodigy? a thirty year veteran 
  of C programming? a beginner to programming with a month's 
  experience in PHP?

- what level of power are we willing to forgo in order to keep 
  the language "intuitive"?

- what the hell does "intuitive" mean anyway?

I know what the definition of the word is, but it doesn't apply to
programming language interfaces. As has been pointed out many times, the
only truly intuitive interface is the nipple. Everything else has to be
learned.

In practice, "intuitive interface" gets bandied about in two ways:

(1) Some people use it as a thought-terminating cliché. What they really
mean is that they want this interface feature, for reasons of their own,
and by calling it 'intuitive', they hope to bamboozle or intimidate others
into backing down and accepting the feature. Who could possibly be
against "intuitive" interfaces? That's like being against "usefulness",
or "flexibility".

When people start protesting about others being "against intuitive
interfaces" (especially if they SHOUT the word "against", that's an good
sign that they're using it as a thought-terminating cliché. To these
people, "intuitive" is like "New And Improved!!!" to advertisers.

(2) Others use it to mean an interface which is:

* predictable;
* consistent;
* easy to explore and learn;
* and "easy to use" in some vague sense.


They recognise that what seems unpredictable to one person may be perfectly
predictable to a more experienced user.

They recognise that consistency is partly a function of the user's own
understanding, not just they language alone. Even if the language is
designed with a single, consistent model (e.g. "everything is an object"),
if the user's mental model is wrong, they will fail to recognise the
consistency, or look for it in the wrong places.

And most importantly, they recognise that programmers are beginners for
perhaps 1% of their programming life: you might be completely new to
programming for three months out of a 30 year span of programming. Why
optimize the language for something that you will use for less than 1% of
your productive lifespan? Apart from intentional beginner's languages like
Scratch, for most languages it makes sense to add power even if it
increases the learning curve.

https://scratch.mit.edu/about/


[...]
> THE PRINT FUNCTION HAS TWO MAJOR ISSUES IN THE CONTEXT OF INTUITIVENESS:
> 
> (1) When laymen consider the word "print" (in the context of computing),
> they first think of "sending a document to a printing device". 

No they don't. They think of printing to the screen, not printing to paper.

Even if they think of printing to paper, it takes them less than a second to
learn otherwise. That's a fantastic user interface: you can learn and
explore the functionality of the language very easily.

(One of the weaknesses of Python, and nearly all mainstream programming
languages, is that there is nothing even remotely like an easy-to-explore
UI for programming GUI applications.)


> (2) The path to the underlying process is not even remotely clear. LIKE IT
> NOT, PRINT IS "MAGIC SYNTAX".

print does what it says of the tin: it prints (to the screen). You don't
have to understand how it manages that to use it effectively, just as you
don't have to understand calculus in order to use math.sqrt().



-- 
Steven




More information about the Python-list mailing list