On Fri, 16 Feb 2007 06:07:42 -0600, Edward K Ream wrote: >> I'm pretty sure you're mistaken. Python 3 will be the release that breaks >> code. Hopefully very little, but there almost certainly will be some. > > Pep 3105 breaks a *lot* of code, despite the bland assertion that most > production programs don't use print. > > Presumably, Guido wanted to improve print in such a way that *more* people > would use it.
I don't think Guido cares about _how many_ people use print. I think he cares about making print better. If that leads to more people using it, that's a bonus. But your and my guesses about what Guido cares about aren't terribly important. > But the effect of the pep is that *less* people will be able > to use print, *regardless* of how backward compatible Python 3.x is > 'allowed' to be. I don't think that follows at all. print is only a problem if you expect your code to work under both Python 2.x and 3.x. I wouldn't imagine that many people are going to expect that: I know I don't. There are likely to be a whole lot of things which change, sometimes radically, from one to the other. They'll support one or the other, or fork the code, or in extreme cases take over maintenance of Python 2.x (it is open source, you can do that). If you want to "future-proof" your Python code, well, you can't fully because nobody yet knows all the things which will change. But you can start by not calling print directly. There are a number of alternatives, depending on what you're doing. Here's a simple function that does very close to what print currently does: def print_(*args, where=None, newline=True): if where is None: where = sys.stdout args = [str(arg) for arg in args] where.write(' '.join(args)) if newline: where.write('\n') -- Steven. -- http://mail.python.org/mailman/listinfo/python-list