Teach that Python emphasizes readability. Perhaps talk about bugs / lines_of_code being roughly a constant. Then talk about the fact that Python generally takes fewer lines of code to express the same thing. This implies fewer bugs for many projects.
Teach the fundamental types, with differences from other languages: int, float (C double), decimal, maybe fractions. Booleans. lists, arrays, dictionaries, sets, tuples, frozensets. Teach that variables don't have a type, but values do. Teach a = b. Teach a, b = b, a. Teach that python is duck typed (dynamically typed), and isn't manifestly or statically typed. Provide definitions. Discuss what it means to be "strongly typed", which doesn't mean what a lot of people think it does: Python is strongly typed, the main exception being that you can use almost anything in a boolean context. Teach the control flow, with differences from other languages: while, for/else, if/elif/else. break/continue, list comprehensions, and maybe generator expressions. Include things like enumerate() and iterators and with statements. Probably do yield too - it's not crucial to being productive in python, but it's plenty useful; probably show how it can generate powers of 2 forever or something. Teach that python has builtins, not keywords - IOW, you can redefine list or int, but you probably shouldn't. pylint helps with this. Teach classes with __init__. Teach __str__, __repr__, and teach __cmp__ or __lt__ (depending on your python version), and perhaps some other magic methods like (a subset of) emulating a container, or emulating a number. Maybe talk about Python's stellar built in Timsort that was later adopted by Java. Teach pylint, including how to turn off unimportant warnings; I usually do this in my code, but you can also use a pylintrc. A short time talking about pylint (or pychecker or pyflakes, and perhaps pep8 too) should help them teach themselves quite a bit - think of these as expert systems about how to write better python. Personally, I use a pyflakes plugin in vim, but my default "make" rule invokes pylint for "the" entire project, as well as my automated tests one at a time. Sometimes my default "make" rule does pep8 too, but not always; pylint covers a lot of what pep8 does anyway. Touch briefly on a cross-platform debugger like winpdb (it's cross-platform despite the name) or pudb. Some people will prefer to just do print functions/statements (again depending on python version), but others will really value the debugger, and some people will use some of both. Stress the importance of automated tests relative to other languages. IMO, even with pylint, having plenty of good automated tests is crucial in a large python project, especially if it's multi-programmer. If you have time, provide some guidance about whether to use Python 2.x or 3.x. IMO, projects that have their dependencies satisfied in 3.x (or have no dependencies!), should use 3.x today. Otherwise, use 2.x with "from __future__" imports where practical. Talk about decorators. If you have time, maybe talk about available interpreters: CPython 2.x, CPython 3.x, Jython (python in java that can call java classes), Pypy (python in python with a JIT), IronPython (IronPython lacks a standard library for the most part, but lets you talk to .net classes). Maybe also talk about Python in the browser: http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html . There was a time when Jython could be used for in-browser-python by generating .class files, but I don't think it can anymore, and java browser plugins seem to be disappearing anyway; the world seems to be heading toward javascript for in-browser, RIA. Feel free to raid http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/for slides. HTH On Fri, Nov 22, 2013 at 3:59 PM, <koch.m...@gmail.com> wrote: > Hello, > > I'm about held a short course with the title indicated in the subjects. > The students are very experienced programmers of our company, with deep > knoledge on C, C++, C#, Perl and similar languages, but very limited, or > absolutely no knowledge on python. > > what would you teach to such a group in 5x1.5 hours? I'm looking for the > most interesting, unique topics, emphesizing python's strong points. > > I have already a couple ideas: > - a general intro about tuples, lists, dicts, sets, and working with these > - functional programming tools, functools, itertools, lambda, map, filter > - wsgi, pickle > > I'd appreciate a lot if you could add some ideas > > thanks, > Mate > -- > https://mail.python.org/mailman/listinfo/python-list >
-- https://mail.python.org/mailman/listinfo/python-list