apparently +1 for this, leaves it open to the developer..rurwin wrote:It is possible to use 2.x with 3.x syntax. Put this as the first line of your program, write the rest as if you were using 3.x, and you can run it under either 2.x or 3.xfrom __future__ import absolute_import, division, generators, unicode_literals, print_function, nested_scopes, with_statement
I don"t know how perfect it is, but I haven"t found a problem yet.
It has been said before, by me and others, that for teaching purposes you should use Python 3. That will be the standard within one or two years. Right now you can't use Python 3 for everything since several major libraries have not been ported. However if in your personal projects you need to use a library that is only available in Python 2, then you can include that line and continue writing as if you were using Python 3. So you don't have to remember two different syntaxes and behaviours.Clifford wrote:Just the sort of arcane "magic incantation" one would want to avoid when teaching kids. Which was kind of my point - stability and consistency are key.rurwin wrote:Put this as the first line of your program,
Yes, I agree. This is a good book.Stateside wrote:Python Programming for the Absolute Beginner, 3rd Edition
Python 3 x
If you are new to programming with Python and are looking for a solid introduction, this is the book for you. Developed by computer science instructors, books in the "for the absolute beginner" series teach the principles of programming through simple game creation.