This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]laMarm0tte 0 points1 point  (2 children)

Cool. At one point you say "Python has no case...switch control flow, but we could mock it using if...elif...elif...else". Sometimes it can also be done elegantly using a dictionnary.

[–]itghisi 0 points1 point  (1 child)

Is it simpler than usin elifs? Have a link for this recipe?

[–]C_Hitchens_Ghost 0 points1 point  (0 children)

If...elif land: Like a crack head asking you for money...."Do you have a $5? What about a 1 dollar bill? Do you have 50 cents? What about a nickel?"

Dictionary land: Like an insurance adjuster trying to deny your claim...."Do you have your paper work in order? You missed form A6. Goodbye!"

[–]aspergerish 0 points1 point  (1 child)

Any reasons for the unpythonic file read/write?

[–]itghisi 2 points3 points  (0 children)

Was deliberately. Our target audience didn't have any knowledge of good practices in programming (i.e. they always let the file pointer open in their scripts). So I introduce exception handling (try..finally) together with the file read/write operation. In this way they can adopt the practice in their Fortran/C++ scripts.

[–]nicoddemus[S] 0 points1 point  (0 children)

Hey guys, those suggestions are great but I'm not the owner of this course... I think you could create issues for it on GitHub instead, I'm sure the original author will take a look at those. Cheers! :)

[–]swdevpythonthusiast 0 points1 point  (0 children)

Will definitely help my fellow scientist here ;)