So finally I started with migration to Python 3. Find the download link:
http://pythonpowerelectronics.com/contents/softwaredownloads.html
It wasn't too tough a migration. Mainly the print statement have become functions. So a lot of editing of these statements. Another change which I can't quite understand the necessity of was that raw_input function to get inputs from the user has been removed and an input function is available instead. A more subtle change and this is something which can cause errors to crop up much later is the nature of division.
In Python 2, dividing an integer by an integer yields an integer. So 5/2 will produce 2. In most languages it is the same. To produce exact division, you would have to write 5/2.0 or 5/(2*1.0) etc. Basically one of the operands must be a float. But in Python 3, 5/2 will produce 2.5. To produce an integer result, this would have to be an integer division 5//2.
I many of my loops I use integer division to iterate up to the mid-point of an array. I changed in a couple of places the regular division to integer division or else the for-loop throws an error because the index cannot be a float. But errors are expected later as there a number of such for loops which act on special conditions and it would take a vast number of different circuits before all these loops are discovered and changed.
The next step is to migrate the Django based web app to Python 3. Until then feel free to download and check out the CLI above with Python 3 with your circuits. And please do report errors so that I can fix bugs.
http://pythonpowerelectronics.com/contents/softwaredownloads.html
It wasn't too tough a migration. Mainly the print statement have become functions. So a lot of editing of these statements. Another change which I can't quite understand the necessity of was that raw_input function to get inputs from the user has been removed and an input function is available instead. A more subtle change and this is something which can cause errors to crop up much later is the nature of division.
In Python 2, dividing an integer by an integer yields an integer. So 5/2 will produce 2. In most languages it is the same. To produce exact division, you would have to write 5/2.0 or 5/(2*1.0) etc. Basically one of the operands must be a float. But in Python 3, 5/2 will produce 2.5. To produce an integer result, this would have to be an integer division 5//2.
I many of my loops I use integer division to iterate up to the mid-point of an array. I changed in a couple of places the regular division to integer division or else the for-loop throws an error because the index cannot be a float. But errors are expected later as there a number of such for loops which act on special conditions and it would take a vast number of different circuits before all these loops are discovered and changed.
The next step is to migrate the Django based web app to Python 3. Until then feel free to download and check out the CLI above with Python 3 with your circuits. And please do report errors so that I can fix bugs.
No comments:
Post a Comment