r/Python • • Aug 05 '19

Python's response to MATLAB

Post image
4.3k Upvotes

372 comments sorted by

View all comments

125

u/[deleted] Aug 05 '19

Why would matlab feel bad for python?

405

u/Alexanderdaawesome Aug 05 '19

Because Python needs to type

import numpy as np

Before doing anything MATLAB can do.

17

u/stoirtap Aug 05 '19

Hi, Engineering newb here.

I've got some experience with Python and MATLAB (through my school). Being the newb that I am, my favorite part of MATLAB is that it shows me all the variables and what's in them on the side, so if the wrong thing is going to the wrong place, I'll know at once.

Does Python have something like that?

77

u/djingrain Aug 05 '19

That's more of an IDE feature than a language feature, if I'm understanding correctly, so if you use the right IDE, sure, the thing I understand about Matlab is that it locks you into their IDE

8

u/GuybrushThreepwo0d Aug 05 '19

You are not locked into an IDE with matlab. I use vim as my editor and run scripts from the command line.

9

u/ThwompThwomp Aug 05 '19

emacs Matlab'er reporting in as well. It's a much better experience from emacs than mathworks' bloated java gui, but sometimes their line-by-line debugging tools are pretty nice.

→ More replies (2)

48

u/tikael Aug 05 '19

Check out Spyder, it has a built in console and does what you want out of the box. You can get it and a full Python install ready for most scientific and engineering uses by installing Anaconda.

It's not my favorite editor, that'd be sublime text but it requires a bit more know-how and set up than Spyder.

3

u/SerHiroProtaganist Aug 05 '19

Can sublime show pandas dataframes in a nice visual format like spyder does? I'm a beginner and from watching YouTube videos it feels like spyder isn't as good at the intellisense type stuff but I really like the visualisation of dataframes that it does

7

u/Zizizizz Aug 05 '19

Open up a Jupyter notebook

2

u/[deleted] Aug 05 '19

Jupyter!

4

u/FewerPunishment Aug 05 '19

Check out pycharm

→ More replies (2)

30

u/sssmmt Aug 05 '19

Install Pycharm (pro version is free if you're a student) and activate Scientific Mode.

https://www.jetbrains.com/help/pycharm/matplotlib-tutorial.html

16

u/Alexanderdaawesome Aug 05 '19

Can verify, I do ALL of my function prototyping in Pycharm for its (and jetbrains in gerneral) debugging features.

11

u/Linkguy137 Aug 05 '19

I mean I use Spyder and it is in there

7

u/Blazerboy65 Aug 05 '19

In Python you'll usually get that kind of functionality using a debugger or a client like Spyder.

6

u/gmclapp Aug 05 '19

Basically any IDE besides IDLE

3

u/[deleted] Aug 05 '19

Hm, pretty sure the python IDE spyder has this function. If I recall correctly, pycharm does too.

3

u/Salyangoz Aug 06 '19

you technically dont even need an IDE to do what youre describing.

In your script place import pdb; pdb.set_trace() at any point to pause execution and drop you down into a python shell. Then use break /foo/bar.py:55 to place an additional breakpoint at line 55 in the file /foo/bar.py if need be, then do print(locals())or better yet pp locals() (pretty print) to look at all your variables.

2

u/Meorge Aug 05 '19

There's not a GUI interface for it available out-of-the-box that I can think of, but you can access that information via code - and there are Python IDEs that will display it MATLAB-style.

2

u/lillystoolooo Aug 05 '19

Spyder and pycharm have that ability. I remember wanting this as well when I moved from matlab to python. But i rarely find myself looking at variables in the viewer anymore (except for structs, that is useful when autocompete is not working for some reason). I find that showing data as plots or images is more useful on both matlab and python.

→ More replies (4)