Live data from Hacker News

Introduction to Python for Computational Science and Engineering [pdf]

southampton.ac.uk

41–50 of 55 posts

Re: Introduction to Python for Computational Science and Engineering [pdf]

#41
Hi all, I am the author of the book.

There is a Python 3 version of the book available at http://www.southampton.ac.uk/~fangohr/teaching/python/book.h...

This also includes Jupyter Notebook files for those who want to execute (and play around with) the chapter content interactively.

Thank you for all the comments and discussion.

Hans (fangohr@soton.ac.uk)

Re: Introduction to Python for Computational Science and Engineering [pdf]

#42

Earlier quoted context omitted.

> The clean break of 3 and the sanity it brings to the language is undeniable. Well, I can't deny they broke it, but sanity is pretty deniable. Python has always been a dynamic language, and one of the core mantras was "there should be one obvious way to do it" (in contrast to Perl). All the new type annotation stuff and the multiple ways to handle string formatting are steps in very weird directions. Maybe they shou…

>new type annotation stuff xrange is now range? >multiple ways to handle string formatting This is a problem? As for sanity: bytes/unicode integer division chained exceptions os.scandir performance I'm keen for 4 when it comes. Clinging to the past is only going to make things harder.

>> multiple ways to handle string formatting > This is a problem?

Yes, if you think, "There should be one-- and preferably only one --obvious way to do it."

Re: Introduction to Python for Computational Science and Engineering [pdf]

#43

This is a very good guide. I thought I knew python ecosystem well and I found something new for myself ('visual' package for 3D illustrations). I am wondering if there are guides for the "reverse direction": I already know how to program, but I want to learn new scientific domain that is interesting to me: e.g. material science, climate modeling, etc. Something like Rosalind[1] does for bioinformatics. [1] http://ros…

Thanks for sharing Rosalind! If you (or anyone else) knows similar projects in bioinformatics or any other fields, do let me know!

Re: Introduction to Python for Computational Science and Engineering [pdf]

#44
post #6

Earlier quoted context omitted.

I'd be happy to hear examples how Python 3 helps us in computational sciences. I've barely even tried it before and have used Python 2 a lot.

> I'd be happy to hear examples how Python 3 helps us in computational sciences Sir/Madam, I am here to make you happy then. Python 3's multiprocessing library is leaps and bounds "better" than python 2's. By "better", I mean faster(in my workloads) by 30-40%. If time is money, then that feature alone saves you both.

For scientific computing I can't see many people making use of python's multiprocessing library. A lot of the time you're writing scripts that you might run a handful of times at most, or if speed is an issue you write it in c++.

Re: Introduction to Python for Computational Science and Engineering [pdf]

#45

Earlier quoted context omitted.

Reduce is easy to fix also, but that ignores the entire reasoning for it being removed and only serves to highlight the massive chasm between 2 and 3. The clean break of 3 and the sanity it brings to the language is undeniable.

> The clean break of 3 and the sanity it brings to the language is undeniable. Well, I can't deny they broke it, but sanity is pretty deniable. Python has always been a dynamic language, and one of the core mantras was "there should be one obvious way to do it" (in contrast to Perl). All the new type annotation stuff and the multiple ways to handle string formatting are steps in very weird directions. Maybe they shou…

That would put us in the league of JS folks. New JS every year (month?)

Re: Introduction to Python for Computational Science and Engineering [pdf]

#46
post #4

> As Python 2.x is still the default Python on many system and there are a fair number of research codes out there based on Python 2, we will use Python 2.x in this book. This is so unfortunate. Scientific computing is riddled with technical debt and starting with Python 2 today is fairly irresponsible. If you're already invested in Python 2 and have code/training written up, fine. But if you're learning it just now,…

For me it is one of the signs why the Python 2/3 division was a failure. In data science, everything is Python 2 first, then (usually, but almost always with some delay) ported to Python 3 (think: Spark, TensorFlow, etc).

If there is a new package (say, on HN), very often it does not work (well) on Python 3.

I use Python 3 (usually), but it makes it harder to do with data science, as often I need to overcome some small (but nasty) issues.

I teach Python 3. But not, it is not a no-brainer.

Re: Introduction to Python for Computational Science and Engineering [pdf]

#47
post #4

> As Python 2.x is still the default Python on many system and there are a fair number of research codes out there based on Python 2, we will use Python 2.x in this book. This is so unfortunate. Scientific computing is riddled with technical debt and starting with Python 2 today is fairly irresponsible. If you're already invested in Python 2 and have code/training written up, fine. But if you're learning it just now,…

IMO, Python 3's support for matrix multiplication using the @ operator is itself worth the cost of admission. Much of technical computing is just implementing algorithms that use linear algebra extensively, and if you're coming from matlab littering your code with dot(dot(X,Y),Z) is a real pain

I find @ nice. But still, even in Python 3 if you use np.matrix (instead of np.array), multiplication works. And if not, then dot-method is way clearer than dot-function.

Re: Introduction to Python for Computational Science and Engineering [pdf]

#50
post #46
post #4

> As Python 2.x is still the default Python on many system and there are a fair number of research codes out there based on Python 2, we will use Python 2.x in this book. This is so unfortunate. Scientific computing is riddled with technical debt and starting with Python 2 today is fairly irresponsible. If you're already invested in Python 2 and have code/training written up, fine. But if you're learning it just now,…

For me it is one of the signs why the Python 2/3 division was a failure. In data science, everything is Python 2 first, then (usually, but almost always with some delay) ported to Python 3 (think: Spark, TensorFlow, etc). If there is a new package (say, on HN), very often it does not work (well) on Python 3. I use Python 3 (usually), but it makes it harder to do with data science, as often I need to overcome some sma…

What kind of issues have you run into with Python 3 that make data science more difficult? I use Python 3 as well, and I don't think I've run into anything that fits your description...
Post reply on HN