Beni Cherniavsky | 1 Aug 17:08

Fwd: docutils on Python 3

[Oops, replied privately again.  Resending to list.]

On Tue, Jul 22, 2008 at 8:14 PM, David Goodger <goodger <at> python.org> wrote:
> On Tue, Jul 22, 2008 at 10:01, Alan G Isaac <aisaac <at> american.edu> wrote:
>> - import ``configparser as ConfigParser`` if cannot import ``ConfigParser
>
> Because the module name was changed?
>
This is moot because I assume 2to3 does (or else *should*) handle
renamed std modules.  But I want to comment anyway because  it's a
good example of the pythonic approach to language rot:

Don't add workarounds for new versions -- rewrite for the newest
version (and add workarounds for old versions)!

In this case, it'd be better to ``import ConfigParser as
configparser`` if cannot ``import configparser`` (and change all code
to refer to ``configparser``).

Reasons:

1. Early adoption of language changes gives your code more
  time until language rot breaks it again.  Allowing this is why
  Python PEPs always allow new coding styles (through
  __future__ if needed) before they deprecate old styles!

2. Some day you'll have to rewrite anyway.  If you don't do it
  now, your workarounds will begin to pile one upon the other.
  Like dirty socks.

(Continue reading)


Gmane