for / while else doesn't make sense

Ben Finney ben+python at benfinney.id.au
Fri May 20 20:21:34 EDT 2016


Steven D'Aprano <steve at pearwood.info> writes:

> Just about the only things in Python which are intuitive and not
> confusing to somebody are None and ints.

I'll go even further:

* The behaviour of ‘int’ is confusing to some. For example, to those who
  expect integers to produce fractions when divided.

* The behaviour of ‘None’ is confusing to some. For example, to those
  who expect it to be a non-value, with no type.

Examples of both those have appeared in this very forum in recent years.

So, I think we can assert with confidence: if “avoid bevause it is
unintuitive and confusing to some newcomers” were a good reason to avoid
a Python feature, *all* Python features would be subject to oblivion.

> Or, we can *learn how to use the features* and stop thinking that
> programming is a matter of intuition. And most importantly, stop
> thinking that features need to be judged entirely by the least
> knowledgeable programmers.

Yes. Appeals to intuition are irrelevant in talking about language
features, IMO.

The intuitions of newcomers should weigh heavily in language design.
That is *not* the same as appealing to intuition: intuition gives you
none of the essential and difficult concepts necessary to programming.

> But the idea that you should avoid a Python feature while programming
> in Python because Javascript doesn't have it, or Ruby, or C, is surely
> the height of muddleheaded thinking. You're not programming
> Javascript, Ruby or C, you're programming in Python.

This is not to say that every Python feature can be used without
concern. Steven is not arguing that avoidance of a feature is never
justified.

Rather, he's demonstrating that *that particular justification* is void.

There may be a good reason to avoid Python behaviour Foo, but “because
JavaScript/Ruby/Lisp/BASIC/INTERCAL doesn't have behaviour Foo” is not a
valid justification. The case must be argued on other merits, if any.

-- 
 \           “Special today: no ice cream.” —mountain inn, Switzerland |
  `\                                                                   |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list