[python-advocacy] How programming language webpages should be designed
David Beazley
d-beazley at sbcglobal.net
Mon Nov 9 19:25:38 CET 2009
Actually, I would slightly disagree. In the "Essential Reference", I
do have some examples that use print() in a way that will work for
both Python 2 and 3. However, I also explicitly state that the only
reason I do that is so that examples meant to illustrate some feature
of Python not related to printing work with both versions. There is
no section on explicitly writing code that works with both versions.
If you ask me, it's probably better to pick a reasonable example that
is not so focused on printing. I don't know, do something like an
example that posts something on Twitter, or some other example that
does something interesting, but which is not totally fixated on
printing.
Cheers,
Dave
On Nov 9, 2009, at 10:28 AM, Michael Tobis wrote:
> On Mon, Nov 9, 2009 at 7:32 AM, Jason Baker <amnorvend at gmail.com>
> wrote:
>
>> 1. We have an example on the front page that works in both Python 2
>> and Python 3. This is a tall order, but we are talking about the
>> front page of python.org here.
>
> It's not THAT tall of an order. As I understand it Beazley's new
> edition of Essential Python (don't have my copy yet) has a section on
> how to write such ambidextrous code. Other than only passing one
> string to "print" at a time (not that big a constraint in practice;
> you simply concatenate strings with "+" rather than "," and wrap
> non-stings in str()) that doesn't touch elementary aspects of the
> language much.
>
> mt
> _______________________________________________
> Advocacy mailing list
> Advocacy at python.org
> http://mail.python.org/mailman/listinfo/advocacy
More information about the Advocacy
mailing list