[Python-Dev] Other library code transformations

Patrick K. O'Brien pobrien@orbtech.com
Mon, 3 Jun 2002 10:58:41 -0500


[Guido van Rossum]
>
> > Certainly distinguishing between Required changes and Recommended
> > changes would be a good thing. Required changes are what needs to be
> > done to keep old code working. Recommended changes could include
> > stylistic changes, new features, new idioms, etc. I think it would
> > even make sense to talk about changes that should be made in
> > anticipation of future feature deprecation.
>
> I'm not sure that using x+=1 instead of x=x+1 should be even a
> recommended change.  This is a personal choice, just like using
> True/False to indicate truth values.

But the choice only becomes available with a certain version of Python.

> The "is None" vs. "== None" issue is a general style recommendation,
> not a migration tip.  This is a "should do" issue.

Right. But it wouldn't hurt to remind people in a migration guide, would it?

> The "if not x" vs. "if x is None" issue is also a general style
> recommendation.  This is a "could do" issue, because the semantics are
> different.

Perhaps three sections then: Required, Recommended and Optional (TMTOWTDI)?
I just think it would be good to know what coding changes one could/should
start making when a new version is released. And which practices one should
stop. And if there are lots of examples in real code of certain poor
practices, it wouldn't hurt to point them out as well, even if they aren't
necessarily tied to a particular release of Python. (But I'm willing to
concede that I might be stretching the scope of this migration guide beyond
its limits with that last item.)

---
Patrick K. O'Brien
Orbtech