Training, Open Source Programming Languages

This is page http://www.wellho.net/mouth/2871_Mov ... hon-3.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Moving from Python 2.6 to Python 3

When should you move your development to Python 3? When you're good and ready and you're certain that you'll not need to run your code on Python 2 again. Up to that point, the 2to3 utility will convert code for you.

Here's an example where I converted a short example script called "london" - using the -w option to write the file back, moving the old file to a .bak file. You can see in the reports the changes that have been made.

wizard:python graham$ 2to3 -w london
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
--- london (original)
+++ london (refactored)
@@ -2,7 +2,7 @@
 
 vatrates = (15,17.5,20) ;
 
-paid = float(raw_input("Whatdya pay furit? "))
+paid = float(input("Whatdya pay furit? "))
 
 for vatrate in vatrates:
  factor = 100.0 / (100.0 + vatrate)
@@ -10,6 +10,6 @@
  shopkeeper = paid * factor
  osborne = paid - shopkeeper
 
- print "Vat rate",vatrate,", Storeman ",shopkeeper,", Chancellor ",osborne
+ print("Vat rate",vatrate,", Storeman ",shopkeeper,", Chancellor ",osborne)
 
- print "izedone"
+ print("izedone")
RefactoringTool: Files that were modified:
RefactoringTool: london
wizard:python graham$


See [unconverted] and [converted] code.


Picture - delegate on a Python Course earlier this week. (You learn a lot on our courses - and we make them fun! as well.
(written 2010-07-14)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y300 - Python 3 - What is new, what's changed and why
  [753] Python 3000 - the next generation - (2006-06-09)
  [1788] Python 2 to Python 3 / Python 3000 / Py3k - (2008-09-07)
  [1791] The road ahead - Python 3 - (2008-09-10)
  [2277] Python classes / courses - what version do we train on? - (2009-07-10)
  [2285] Great new diagrams for our notes ... Python releases - (2009-07-13)
  [2559] Moving the product forward - ours, and MySQL, Perl, PHP and Python too - (2010-01-01)
  [2778] Learning to program in Python 2 ... and / or in Python 3 - (2010-05-24)
  [4469] Sorting in Python 3 - and how it differs from Python 2 sorting - (2015-04-20)
  [4470] Testing in Python 3 - unittest, doctest and __name__ == __main__ too. - (2015-04-21)
  [4590] Progress on moving from Python 2 to Python 3 - training for both versions - (2015-12-01)
  [4649] Object and Static methods - what is the difference; example in Python 3 - (2016-02-17)
  [4650] Why populate object with values as you construct them? - (2016-02-18)
  [4711] Convering from Python 2 to Python 3 - an update, and the 2to3 utility - (2016-10-30)
  [4712] A reminder of the key issues to consider in moving from Python 2 to Python 3 - (2016-10-30)


Back to
Old prices - what would the equivalent price have been in 1966?
Previous and next
or
Horse's mouth home
Forward to
Moved - Melksham Lorry Park
Some other Articles
A long day in Melksham ...
Unpacking a Perl string into a list
Another toot of the trumpet
Moved - Melksham Lorry Park
Moving from Python 2.6 to Python 3
Old prices - what would the equivalent price have been in 1966?
Contact Information for Melksham Oak Community School
A move towards the family
Cycling in Melksham, and looking forward
Ruby - how does it compare and where is it the right language?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2871_Mov ... hon-3.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb