On 25-03-14 13:45, Chris Angelico wrote: > It makes the same notation mean different things, in ways that are > hard to render clearly. You can write a Py3 program and put this at > the top for Py2: > > try: > input = raw_input > range = xrange > except NameError: > # We're running on Python 3 > pass > > But you can't do the same for braces. You'd have to eschew *both* > literal-ish notations and use explicit constructors everywhere. Not > clean.
What about it, is not clean? I understand that you prefer it how it worked out. That is fine by me. But that doesn't make the alternative unclean. Is having to write "set()" unclean somehow when you need an empty set? I wouldn't think so. So I see no reason why having to write "dict()" when you need an empty dictionary wouldn't be clean. Nor would it be unclean, when you have to write somethings a bit differently when you want your program to be compatible both with python2 and python3. You will also need to prefix all your (unicode) strings with u and all your byte strings with b. And probably some more stuff if you want to avoid some pitfalls. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list