Language design

Ben Finney ben+python at benfinney.id.au
Tue Sep 10 03:07:09 EDT 2013


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

> What design mistakes, traps or gotchas do you think Python has?

* Imports are fiendishly complex, hidden below deceptively simple
  syntax.

  It's a reasonable expectation that one can import a module from a
  source code file given its path on the filesystem, but this turns out
  to be much more complicated than in many other languages.

  There are reasons for this, some good, some merely historical baggage,
  some workarounds for OS misdesign, and some that may be Python's own
  mistakes. Those reasons are difficult to appreciate when first
  encountering the problem.

* Somewhat related, and not really part of language design: The import
  mechanism and the packaging tools are woefully behind the state of the
  art in getting applications and their libraries to cooperate with
  operating system package management.

  This has the terrible effect that developers choose to insulate Python
  from the operating system, essentially losing all the benefits of the
  operating system package manager for their dependencies and needing to
  re-implement package management all over again, badly.

  This is largely the fault of operating systems with package dependency
  managers that are poor (Apple's) to nonexistent (Microsoft's). But the
  result is that Python's tools have been particularly woeful in this
  area compared to some other languages, and the Python community now
  has learned to subvert all OS package managers, even the good ones.

> Gotchas are not necessarily a bad thing, there may be good reasons for
> it, but they're surprising.

* Python requires every programmer to know, or quickly learn, the basics
  of Unicode: to know that text is not, and never will be again,
  synonymous with a sequence of bytes.

  This is, in the long run, a good thing for all programmers and those
  who will use their programs. Programmers should expect to deal with
  non-ASCII text earlier than the innocent might suppose, and the
  likelihood goes up all the time. The sooner we replace the erroneous
  “text is ASCII” in the common wisdom with “text is Unicode”, the
  better.

  Nevertheless, the outstanding robustness of Python's Unicode support
  is different from most languages, and so is a gotcha.

-- 
 \      “Life does not cease to be funny when people die any more than |
  `\  it ceases to be serious when people laugh.” —George Bernard Shaw |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list