r/AskEngineers • • Mar 16 '19

Mechanical Is it worth learning Python as a Mechanical Engineer?

Greetings, I am a freshman in Mechanical engineering and I've already finished my MATLAB course, and I find coding fun, so I was wondering if I should learn python? But of course I won't waste my time learning it if it isn't beneficial to me. So my fellow MEs, how useful would it be learning python? And what are these benefits. Thank you!

299 Upvotes

165 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 16 '19

[deleted] — view deleted comment

30

u/[deleted] Mar 16 '19

We were actually taught to write reusable code in Matlab... Or at least our professor told us to, i never really got it to work...

8

u/Awsome306 Mar 16 '19

Does Python have an equivalent of the "help" or "doc" command in MATLAB? I'm currently trying to learn Python, but learning the syntax has been way slower than it was for MATLAB.

20

u/Gh0stw0lf Mar 16 '19

No, and no real programming language will ever have that.

You can’t rely on all your help to be neatly in one screen. Python has arguably more robust tutorial system but they exist in internet searches.

Strange that you’re having issues with syntax, it’s one of the most simplified languages

9

u/What_Is_X Mar 16 '19

Documentation should be close to code. R does this well.

2

u/Awsome306 Mar 16 '19

It seems like there's a lot of English words for things, rather than mathematical symbols. I think that's the root of my problem.

5

u/Erictsas Mar 16 '19

Why should no programming language ever have that? I don't see how it would be a bad thing? Because of bulkiness? Sure it's a good attitude to not have to rely on such things, but having the documentation available immediately is just simply good for production efficiency since I don't have to go online to look it up.

I'm also trying to learn Python right now and it's not that the syntax is difficult, but it's very easy to mix it up with other languages. Matlab even has a kind of "autocomplete" feature that also helps making coding faster

I feel like being opposed to easily available documentation is akin to the old days of "oh but you have to learn to calculate by hand since you won't always have a calculator at hand". Yes it's important to learn it, but afterwards those kinds of features can be good for you

→ More replies (6)

3

u/syaelcam Mar 16 '19

There isn't an inbuilt docs, but the online python documentation is very comprehensive but readable.

→ More replies (4)

9

u/F5x9 Mar 16 '19

Just write functions for generalized inputs.

4

u/[deleted] Mar 16 '19

Of course. It's just that i never actually used anything i wrote more than once, so why bother?

24

u/old_sellsword Mar 16 '19

Also 1-indexing????

It’s called Matrix Laboratory. When’s the last time you saw a matrix with a 0th index?

22

u/PM_ME_UR_SWEATERPUPS Mar 16 '19

Say hello to my old friends C and C++...

19

u/old_sellsword Mar 16 '19

Those are arrays. A matrix in those languages is just an array of arrays.

MATLAB is essentially a big calculator, it makes total sense for it to have 1-indexing. I’ll never argue that MATLAB is a good language for actual programming, but it’s great for quick and dirty data analysis and modeling.

9

u/PM_ME_UR_SWEATERPUPS Mar 16 '19

A matrix really is an array, with a new set of operations to manage it.

Matlab is a very high level language and that is one of the reasons the OP suggested it teaches bad habits. Engineers, of the non-software variety, are terrible programmers. Because if it works, it is good enough.

14

u/SoraDevin Mar 16 '19

As an electrical engineer I feel personally attacked

→ More replies (1)

2

u/MalakElohim Mar 16 '19

Not always true. Mechatronics engineers should be good programmers, depending on the quality of the school. But they should be coding a lot for automation and ML purposes.

→ More replies (1)

4

u/ArrivesLate Mar 16 '19

For real. Also I seem to remember my machine code classes start at 0.

14

u/gurenkagurenda Mar 16 '19

Nothing really wrong with 1-indexing. Both conventions have pros and cons. The rest of that sounds just awful though.

9

u/rlbond86 Electrical - Signal Processing Mar 16 '19

Dijkstra argued for 0-based indexing half a century ago and he wasn't wrong

13

u/gurenkagurenda Mar 16 '19

Dijkstra was a pioneer in academic shitposting. His arguments of this sort are worth reading, but it's important to keep in mind what they are, and not to base your entire position about the topic on them.

→ More replies (1)

3

u/[deleted] Mar 17 '19

I have worked with Matlab quite a bit and currently working with Java.

I think most people won't understand what you really mean since I don't think you took the proper time to explain.

I'll add my thoughts:

Matlab users will try to use functions and whatnot but you are correct - even the best Matlab users don't have the same habits as a real 'programmer' when it comes to not 'copy-paste'

That being said, if you're using MatLab, you're quite literally scripting rather than building 'software' so yes, I agree with you but most MatLab users won't understand unless they come across a real 'programmer' that refuses to copy-paste a single line of code.

→ More replies (2)