[Tutor] help on newbie program
Magnus Lyckå
magnus@thinkware.se
Thu May 29 14:08:19 2003
At 10:21 2003-05-29 +0200, guillaume wrote:
>I'm a newbie and to learn the basis of python
>I'm reading the Introduction to Python written by
>Mark Lutz and David Asher.
>It's a clear book well written
You mean "Learning Python" I guess. That is a bit old, covering
Python 1.5, and for instance it tells you to write stuff like:
import string
s = "Hello"
print string.upper(s)
For years now, you have been able to write...
s = "Hello"
s.upper()
...and the string module might disappear soon.
There is a lot that has changed with python since November 1998,
when the book was finished. Things like distutils, unicode support,
new style classes, generators, the new division scheme, __future__,
list comprehension, iterators, nested scopes, augmented assingment,
integer and long unification etc etc. See
http://www.python.org/doc/2.3b1/whatsnew/
http://www.python.org/doc/2.2.2/whatsnew/
http://www.amk.ca/python/2.1/
http://www.amk.ca/python/2.0/ and
http://www.python.org/peps/ "Finished PEPs (done, implemented in CVS)"
It might also be useful to look at:
http://www.python.org/doc/essays/ppt/regrets/PythonRegrets.pdf
Of course, almost everything in Learning Python is still good and true,
but some things are deprecated, and a lot of good new stuff is missing.
A paper book can never keep up to date with something like Python, but
Learning Python needs a 2nd edition that covers 2.3 to stay useful. It's
a bit sad to learn stuff, just to unlearn them as we turn to the next book.
I think a good newbie book today should ...
* Mainly use new style classes, and encourage their use. Old classes
should be described since you are likely to run into them, but they
should be treated a bit like the old regex module... As legacy code...
* Suggest using list comprehension rather than map, filter and lambda.
* Encourage use of new features such as nested scopes, new division,
etc, even if it means using "from __future__ import".
* Forget about the string module and only use string methods.
* Explain how to use distutils to install 3rd party modules.
* Encourage use of unicode and locale etc.
* Skip apply and explain *args and **kwargs instead.
--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program