Hi all,
At the risk of introducing a tangent ... while using the popular
flavour of Python is important, surely the choice of Python version is
less important than why Python is being used? That is, as a vehicle to
introduce principles of good programming practice. I get concerned
when attendees refer to SWC as "Python training courses" and tell them
that is not what SWC courses are (not least, because one can't teach
any programming language in half a day)
Attendees who write in C, C++, FORTRAN or Java all day won't benefit
from (and won't care) about the differences between Python 2 and 3,
but will benefit from knowing how to write better code in their own
languages.
cheers,
mike
Quoting James Hiebert <[email protected]> on Tue, 16 Jun 2015 12:34:22 -0700:
Hi All,
Thanks for sending along this post, and please allow me the
opportunity to weigh in on teaching 3 vs. 2.
I've read a lot of responses to this have essentially said "Python 3
doesn't have any killer features that you can't get in Python 2".
One of the biggest things that my team gets out of Python 3 is that
iteration and generator functions are much, much better. In Python
3, Most container data types use iteration natively rather than
instantiating and returning lists. For example dict.keys(),
dict.values(), and dict.items() all return *iterators* and
memoryviews rather than lists or tuples.
https://www.python.org/dev/peps/pep-3106/
Same with the range() builtin and a lot of others. This doesn't
fundamentally change the way that the code reads (so may be a bit
opaque to the user), but can have a large impact on how the code
executes for large sets of input. In the earth sciences (I work in
climate science) this is a big deal, because your input size can be
huge. Most of the time, our computations are limited by the RAM on
the system, so not having make copies of your data on the stack (R
is notorious for this) can potentially give you a multiplicative
increase in throughput.
Generators are substantiall easier to use with the addition of the
"yield from [some iterator]" statement. It basically allows you to
build up sets of generators and then mix and match them.
https://docs.python.org/3.3/whatsnew/3.3.html#pep-380-syntax-for-delegating-to-a-subgenerator
Python iterators and generators can be more advanced topics that we
won't necessarily be teaching beginners. However, they are
definitely something that allows you to scale up your code to larger
input data sets, so they're something that scientists will want when
they work up to using them. And the support in Python 3 is much
better and more consistent.
Glad to hear that the workshops that have used Python 3 have been smooth.
~James
On Mon, Jun 15, 2015 at 04:37:11PM -0700, Steven Haddock wrote:
This was a timely post by Maxime, because I was just thinking of
surveying instructors about what they use for their own work and
what were the thoughts about porting SWC lessons to Python 3. I
can?t remember if there was a recent thread on this?
Worth creating an issue (or something even more formal) and having
people state their cases?
We are using Python 3 for the next edition of our book, but I feel
a bit like the first guy over the wall at the Battle of Hastings,
looking over my shoulder at the other 85% huddled in relative safety
.
-Steve
> On Jun 15, 2015, at 12:17 , Maxime Boissonneault
<[email protected]> wrote:
>
> Some interresting reading :
>
> http://astrofrog.github.io/blog/2015/05/09/2015-survey-results/
>
> Maxime
--
James Hiebert
Lead, Computational Support
Pacific Climate Impacts Consortium
http://www.pacificclimate.org
E-mail: [email protected]
_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org
------------------------------------------------------------
Dr. Michael (Mike) Jackson [email protected]
Software Architect Tel: +44 (0)131 650 5141
EPCC, The University of Edinburgh http://www.epcc.ed.ac.uk
Software Sustainability Institute http://www.software.ac.uk
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
_______________________________________________
Discuss mailing list
[email protected]
http://lists.software-carpentry.org/mailman/listinfo/discuss_lists.software-carpentry.org