How to make for loop faster in python?

How hard is it to port an application from Python 2 to make it work in Python 3? Make it backward compatible. Say the program consists of 50 Python files and everything connected with each.

  • And if there any libraries and any *tricks* to make it much easier,please add them.

  • Answer:

    Depends on what libraries and external interfaces are in use in the Python 2 code.   If the Python 2 program is purely Python, then 2to3 is going to get you much of the way to Python 3, if not all the way.   But if you don't have a decent set of regression tests laying around for your app, you aren't going to sleep soundly until you work out a suite of tests for the Python 3 incarnation of your program. But if your program has lots of embedded C code, and passes to C routines strings that are now going to be in Unicode, and if you have dependencies on library modules that just haven't yet made their way to the Python 3 side of the ledger, then 2to3 is going to be a mere down payment on the conversion of your app from Python 2 to Python 3.

R. Drew Davis at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.