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!

296 Upvotes

165 comments sorted by

View all comments

Show parent comment

27

u/gjsmo Mar 16 '19
  • No namespaces.
  • No indexing inside return values.
  • No pass by reference
  • Expensive, $3000 for a single seat or $12000/yr for a network license.
  • Each toolbox (basically a library) is often an additional $800 or so.
  • Parallel processing is a separate toolbox.
  • Performance on non-numerical code is abysmal
  • Syntax is frequently inconsistent, if it makes sense at all
  • (minor) GUIs are awful. Can't make a spinner box, can't set limits on text boxes, can't (easily) format text apart from font/size. AND it's just worse Java, or a web app if you use the newer App Designer instead of GUIDE.

30

u/rlbond86 Electrical - Signal Processing Mar 16 '19 edited Mar 16 '19

Let's not forget: every function has to go in its own file, and that file has to be in your path.

Edit: what's with the downvotes? It's true.

3

u/MalakElohim Mar 16 '19

Wait until you see overloaded functions in MATLAB. In different file paths.

2

u/DrBubbles Mechanical / Manufacturing Mar 16 '19

This was always my biggest gripe, honestly.

1

u/boredcentsless Mar 18 '19

Yup, 3 simple functions need 3 separate files

2

u/pm_me_passion Mar 16 '19

You can get around that by making your functions methods in a class, in its own file.

4

u/rlbond86 Electrical - Signal Processing Mar 16 '19

But that's stupid

2

u/[deleted] Mar 17 '19

Eh, it's pretty Java-esque

3

u/pm_me_passion Mar 16 '19

Ok, then don’t. Have 30 files just sitting there, whatever.

0

u/[deleted] Mar 16 '19

[deleted] — view deleted comment

4

u/gjsmo Mar 16 '19

Fun fact: Anaconda will install to your profile directory and doesn't require admin privileges. I have it at work, on computers that are very locked down.

3

u/boredcentsless Mar 18 '19

Yea, Im at a defense contractor and lots of people downloaded anaconda on the DL

1

u/KrypXern Mechanical Engineer Mar 18 '19

Unless it’s a lambda function, but yeah.

1

u/extravisual Mar 16 '19

I thought all passing of arguments was done with some sort of reference in the background, which is also how Python does it. I don't know the details though. I don't know if you can treat them like C++ references and directly modify the data though.

1

u/gjsmo Mar 16 '19

It's copy-on-write technically, but there's no way to explicitly pass by reference as far as I can tell. There are "handles" but you have to define certain types to use it. Very annoying when you, I dunno, have to work with large dataset like Matlab is supposedly intended for?

1

u/extravisual Mar 17 '19

I've definitely found Python to be a more effective and convenient tool when doing data stuff. I use Matlab for my FEM course, and while it's crazy convenient for doing matrix math, writing versatile concise code with it is just awful.