python 3.3 repr

Serhiy Storchaka storchaka at gmail.com
Fri Nov 15 09:40:36 EST 2013


15.11.13 15:54, Ned Batchelder написав(ла):
> No, but I've found that significant programs that run on both 2 and 3 need to have some shims to make the code work anyway.  You could do this:
>
>      try:
>          repr = ascii
>      except NameError:
>          pass
>
> and then use repr throughout.

Or rather

     try:
         ascii
     except NameError:
         ascii = repr

and then use ascii throughout.





More information about the Python-list mailing list