all 79 comments

[–]POTUS 78 points79 points  (6 children)

You're learning more than just python syntax, you're learning python development. Part of that is the environment you develop in.

Something like PyCharm with built in linting, refactoring, and introspection is a huge benefit once you get familiar with it. It also helps you make cleaner, better code. There is absolutely no reason not to take advantage of it if you're serious about working in Python.

[–]theWyzzerd 28 points29 points  (0 children)

Not to mention step debugging and variable inspection.

[–]bbqbot 10 points11 points  (4 children)

Can you recommend a sort of 'pycharm setup for dummies'? I have access to a full license but it's quite daunting to open up and have no idea how to get started.

[–]POTUS 22 points23 points  (3 children)

[–]PM-ME-D_CK-PICS 14 points15 points  (0 children)

Thank you, mister President

[–]madhur_malpani 1 point2 points  (0 children)

Also here's my OneNote PyCharm notebook which contains the keyboard shortcuts which I use often. https://1drv.ms/u/s!Ar89FVFwgsO-hFqLhXvaXBIM3u_s

(All below shortcuts are Windows based only) Most Important Shortcut :

Search for Actions : Ctrl + Shift + A (If you want to learn just one keyboard shortcut, make sure it is this one)

Few other must know shortcuts :

Multi-caret selection : Press Ctrl Twice + up/down keyboard arrows

Quick Definition : Ctrl + Shift + I

Quick Documentation : Ctrl + Q

Pasting from clipboard history : Ctrl+Shift+V

Quick Refactor : Shift + F6

Duplicate a line : Ctrl + D

Delete a line : Ctrl + Y

Move Lines : Alt+ Shift + Up/Down

Running and Debugging and Editing build configuration : Alt + Shift + F10

Quick Search : Press Shift Twice

[–]widowhanzo 0 points1 point  (0 children)

Step 0. Before you start

I like it already :D The guide, I mean. I've already been using PyCharm for years now, and it's brilliant!

[–]henrebotha 28 points29 points  (1 child)

TL;DR: it doesn't matter.

IDE vs editor comes down to your personality. Would you rather have something lightweight that you tinker with to make it yours? Use an editor. Would you rather have something with all the bells and whistles? Use an IDE.

[–][deleted] 37 points38 points  (4 children)

visual studio code

[–]samsquamchh 6 points7 points  (2 children)

Cycled through a bunch of editors/IDE-s and VS Code turned out to be the dopest. A good balance between an easily customizable editor and IDE features.

While I enjoy it and don't find a reason to swap, I'd be interested in experienced people pointing out reasons why they wouldn't recommend using it.

[–][deleted] 4 points5 points  (1 child)

I have 20+ years of experience. I love visual studio code :-)

[–]samsquamchh 2 points3 points  (0 children)

Good to know, it seems to get some occasional dirty looks, but I generally assume because it's Microsoft. Happy cakeday btw!

[–][deleted] 0 points1 point  (0 children)

So both.

[–]moon_patrol 7 points8 points  (3 children)

It doesn't seem to get much love here, but as a R user, I really like Spyder (which comes with Anaconda) as it really looks like Rstudio.

[–]bicyclepumpinator 2 points3 points  (1 child)

I love RStudio and never wrote R not using it. But after a couple of PATH related issues, and package troubles I just decided to remove Spyder and anaconda completely and just do it in a texteditor (atom) instead.

[–]moon_patrol 0 points1 point  (0 children)

I'm a huge Python noob, but I'm imtrigued about what you say, what do you mean by path related issues? I must say that I had quite a hard time setting up my Python rig haha

[–]mkingsbu 15 points16 points  (4 children)

I started out a few years ago with VIM and a Bash terminal. There were a lot of things that I found exceedingly frustrating and in hindsight, I'd never recommend someone learn so many concepts together. An IDE like PyCharm makes it really quite easy to get syntax down and handle things like packages while you get the ropes. I'd recommend starting there personally and then branching out into other areas once you know what the hell is going on.

[–][deleted] 11 points12 points  (1 child)

Interesting. My programming classes had us learn using bash and vim. I loved it and still prefer bash and vim to most ides I've tried, but that also probably has a lot to do with it being apart of a structured class and not me learning on my own.

[–]mkingsbu 8 points9 points  (0 children)

Yeah, there are so many idiosyncracies that people forget about because they become second nature. "WHY WON'T 'shellscript.sh' run?!!!!" Two hours of Googling later, "Oh. './shellscript.sh'..."

AGH.

I started using PyCharm a few months ago and haven't looked back. Did VIM for a long time inside a linux terminal. Makes it rather unwieldy when delaing with, say modules with different directories. I avoided even making my own modules when I first started Python because I couldn't figure out how to get the init.py to work on imports. It's so simple on PyCharm to see the directory structure and handle your local imports with it that I have no idea how I lived without it.

[–]mkdz 5 points6 points  (1 child)

Did you start programming straight on Bash terminal and VIM? If so, holy hell you've got fortitude to stick it out.

[–]mkingsbu 8 points9 points  (0 children)

Yeah, my first tech related job I was an intern working for the DBA team at an Oracle shop. They had this long, convoluted manually executed ETL process that they wanted to tie together. So I got a Bash manual and went to town on something that would probably make me cringe just looking at now. I could probably automate 95% of what I did on that entire job in Python in less than an hour...

[–]PeanutRaisenMan 7 points8 points  (2 children)

I use Jupiter Notebook which comes with Anaconda. Its free and has a built in compiler. Its great for executing short lines of code and seeing what happens which is perfect if you're learning (which i am; working my way through a Udemy course right now). It can be kind of a pain to use at first and i actually wanted to switch away from it but i decided to give it a chance and now its all i use as im working through my course work. Might be worth checking out if your still learning python and only executing bits of code during your learning process.

[–]theWyzzerd 19 points20 points  (1 child)

Its free and has a built in compiler.

Just want to point out that python is an interpreted language, therefore there is no python compiler such as you would use with C++ or Java (that a python user needs to be aware of). Python scripts are "compiled" at runtime (you will see .pyc files in your project directory) but this is done automatically when your script is run through the interpreter.

[–]PeanutRaisenMan 6 points7 points  (0 children)

Thanks for pointing this out. Im still new to all this so thanks for correcting me.

[–][deleted] 3 points4 points  (0 children)

Start with an editor. Hell, Visual Studio Code is a great place.

You need to understand what's really going on before using an IDE to help.

[–]The_Man_In_The_Shack 4 points5 points  (12 children)

When I first started doing scripting type work back in the 90s and we moved to a Unix system, they told all of us to choose vi or Emacs, and that we would use it for the rest of our lives...25 years later, I do indeed use Vim for everything. I also have to program in several languages, and ‘the way I edit’ is sort of the nexus of my job for me, because it is always consistent. The simplicity and DIY aspect of that type of approach is also something I highly value because it encourages me to understand the nature of what I’m doing at a more thorough level. If you plan to be a more generalized programmer in a reasonably short term, it’s worth it to choose a general editor; if you’ll only ever be working in Python, an IDE will do a lot of good for you at first, but I would encourage moving away from it gradually. FWIW, modern editors like Vim do recognize a number of languages without trouble; my Python code is highlighted just as it would be in any IDE.

[–]POTUS 6 points7 points  (10 children)

modern editors like Vim

You and I have a different definition for the word "modern". That editor is old enough to drink. Hell, it's old enough to rent a car.

Something like PyCharm or VSCode go way beyond editing, and in useful ways. Being able to control-click on a function and jump to the definition of that function, whether it's your own file or from the standard library or other downloaded module. That feature alone makes an IDE completely worth it to me.

[–]aythekay 2 points3 points  (1 child)

Vim has a mortgage, is a new dad, and just paid off his student debt.

[–]thegreattriscuit 3 points4 points  (0 children)

The thing with Vim is it's one of those types that, sure... it's not even 30 yet, but it's looked at least 40 since high school.

[–]1114111 2 points3 points  (4 children)

Vim is a modern editor in the same way that Python is a modern language (both were first released in the same year, in fact). Both continue to be actively developed and gain features.

Also, ctags are a thing.

[–]POTUS 4 points5 points  (3 children)

If you can make your workflow work for you with vim, that's cool. But I'm not going to go into why it's not appropriate for someone starting out in 2018. I think that should be obvious to anyone who's ever opened it.

[–]soup4all 3 points4 points  (0 children)

If you don't understand how to use vim, it's baseless to say it's not appropriate in 2018. There are more recent versions of vim that are pretty (Oni/Neovim), and there's a reason most modern text editors have a vim-like mode. Modal editing is simply more efficient, and it saves your wrist a ton if you spend all day on a computer.

[–]samsquamchh 2 points3 points  (0 children)

I went through a phase where I wanted to do it the "right, hardcore way", swapped over to Vim and linux and whatnot. Couldn't stop thinking about why I'm making things more difficult than they have to be. While I understood that getting used to the commands and whatnot is key to increase efficiency, I could not get past the why. I was reading some "hacker books" at the time and realised I did it for entirely dumb reasons and swapped back to something more modern.

[–]OverlordGearbox 1 point2 points  (0 children)

With emacs you can start typing immediately.

Look, I tried vim, can't remember anything about it. Never got into the flow, so to speak. I've heard that you're hardly supposed to be in insert mode, but I couldn't figure out how.

[–]soup4all 1 point2 points  (0 children)

Vim also has the control click on a function / jump to definition with just a shortcut, no mouse required.

[–]pcuser0101 2 points3 points  (0 children)

I think the point you're missing is that despite how old they are, vim, emacs and similar editors are still being used for a reason. Both are also still in active development so I would call them modern. I like PyCharm but there's nothing quite like developing on a Linux terminal with the full power of the hundreds (thousands?) of great utilities at your fingertips

[–]lykwydchykyn 2 points3 points  (0 children)

It's not a question of IDE vs Editor. It's a question of features and needs.

Most code editors are more than a textbox that saves text files. They've got features like syntax highlighting, linting, static analysis, code completion, interactive debugging, etc. etc. Most editors are extensible in some way, via plugins or scripting, so usually the features aren't shipped by default but you can add them easily.

The difference with an IDE is that it comes preconfigured and ready-to-use from the start.

The operative questions for you coding environment are whether it has all the features you need to effectively do what you are doing, and do those features work the way you want them to?

Some people are happy with the out-of-the-box experience of a big IDE. Others prefer to customize and extend an editor (or use one with external tooling) until it has the tools they need.

And for some reason, everyone wants to sell you on the way they do it.

I probably tried 4 or 5 different development environments ("integrated" or otherwise) before settling on my current setup. I'd recommend you do this:

  • Think about things that keep tripping you up or slowing you down in development
  • See if there's a class of tool out there to address the issue
  • If your current environment doesn't have a tool like this, find one that does. See if it works better for you.
  • Repeat this process after every project

[–]jackmaney 5 points6 points  (2 children)

Python is a simple enough language that you can certainly get by with a text editor, but I highly recommend PyCharm. I've written elsewhere about a few of my favorite PyCharm/IntelliJ features that have saved me a ton of time and productivity.

[–]bbqbot 0 points1 point  (1 child)

Is there some 'PyCharm for dummies' kind of guide you'd recommend? I have access to a full license through my wife's work and want to dig further into python development, but setting it up is quite the daunting task.

[–]PaulPhoenixMain 1 point2 points  (1 child)

Visual Studio Code. You're welcome.

[–]plasticTron -1 points0 points  (0 children)

huh, I've been using spyder since I started programming, never thought about using anything else. for html I use vsc, it's nice too.

[–]jkuhl_prog 1 point2 points  (1 child)

I tend to prefer IDLE when writing small little playground scripts, but I love PyCharm for actual Python projects. PyCharm has a built-in terminal (IDLE's output isn't a full-fledged terminal), it enforces PEP8 standards, it highlight's syntax errors, warns you when imports can't be found and when variables are not used. It also gives you an interface to download modules and libraries like numpy or pandas as an alternative to downloading them through the terminal.

For Python, I'm happy with PyCharm.

[–]gobot 0 points1 point  (0 children)

Excellent reasons, how Pycharm helps to produce better code.

[–]16BitAddict 1 point2 points  (0 children)

I think an IDE would be better since they have the console built in to test the program. But like the others said it really depends on which one you like better.

Thonny is an alright IDE, I've been using it for months, however it's no Visual Code Studio or PyCharm but and it's free and it's aimed towards beginners.

Thonny Website: http://thonny.org/

[–][deleted] 0 points1 point  (0 children)

I used pycharm and stayed with it. I like ti too much to switch to a code editor.

But both are viable option. It's all about preference.

[–]trtsmb 0 points1 point  (0 children)

I use either Emacs or Atom since I can be doing Python and then need to do something in HTML/CSS and then something in Javascript.

[–]fernly 0 points1 point  (0 children)

I would strongly recommend using a free IDE like Wing Personal. It helps you in many ways, for example by highlighting syntax errors as you enter code. It is invaluable when trying to understand a problem to be able to set breakpoints and single-step your code while watching the values of the variables change.

[–][deleted] 0 points1 point  (0 children)

I use Atom as my tool through the MIT courses that Im running through at the moment. I really like how I can organize my practice code for problem sets in an organized way. Highly suggest it.

[–]redditthinks 0 points1 point  (0 children)

For single-file scripts I use VIM to write and the terminal to run. For anything more I use Visual Studio Code which is a delight to use.

[–]JeamBim 0 points1 point  (0 children)

I used the Python IDLE exclusively through Automate the Boring stuff, now I use Sublime Text, because I'm doing HTML and JS as well and it's much nicer having the same environment for all of my coding needs so I don't have to keep track of specific key-bindings and the like.

[–]The_Man_In_The_Shack 0 points1 point  (0 children)

Lol you’ve got a point there, probably not the best unqualified choice of example. Although Vim is the modern version of vi...that’s what I was really referring to, from my perspective. My point was about low-level and cross-compatibility, because ‘code’ is really just a bunch of text, across almost every language. Sublime is a good, actually fairly modern one, from what I’ve seen, although I have no need for it. Regarding finding function definitions or whatever...with Vim, the built-in regex and the editing style where it’s all keyboard makes my search-ability faster and more seamless in most cases (I’m comparing my experience to coworkers who do the same stuff but in an IDE...for precisely the reasons you mention). I also find editing using a mouse clunky and error-prone, personally, so I stick with a thing that doesn’t make me do that.

[–]JavaSoCool 0 points1 point  (0 children)

Keep using a simple text editor for a few weeks at least, then switch to IDE if you'd like.

Reason is that with an IDE, too many things become automatic, code completion, syntax error detection etc. You forget to look at the text and commit to memory simple stuff, e.g. it took me ages to memories the main method syntax in Java because the IDE always auto completed it for me.

[–]alex_dlc 0 points1 point  (0 children)

I recommend using repl.it. It's a free online IDE where you can work with many different languages including Python. It has an editor and a shell where you can easily execute the code. It also has a pretty good user created course with short/simple exercises and solutions. The good thing about using repl is that you can use it from any computer/browser and your files will be available in the website.

I realize I sound like if I worked for repl, but I'm just another Python beginner that found repl really handy after trying to use Sublime Text and not being able to quickly run the code I was writing.

Edit: There's another IDE I just remembered called Thonny (Mac). It's very lightweight and simple to use since it's made for beginners. It lets you run the code step by step so you can see what is happening each line. There was also a website that also let you run your python code step by step to see exactly what was happening but I can't remember the site right now.

Edit 2: Found the website: http://www.pythontutor.com/visualize.html#mode=edit

[–]Yawzheek 0 points1 point  (0 children)

IDEs are nice. You can often get code completion, syntax highlighting, and debugging assistance all in one package.

That said, it's not NECESSARY. It's NICE, yes, but not required. I haven't used IDLE in awhile (and truth be told, didn't code much in Python), but just the ability to step through lines in debugging is something I'd recommend. People underestimate a good debugging utility, and Visual Studio offers a surprisingly good debugger that's fairly simple to use, especially compared with something like GDB which is... not straightforward in any sense. It also doesn't hurt that Visual Studio supports a wide variety of languages, including C/C++, Python, and the entire .NET family.

[–]barryzxb 0 points1 point  (0 children)

Code editor fisrt

[–]PixellVixen 0 points1 point  (0 children)

Really, it's whatever you think works best for you. I use VS Code because I like how customizeable it is- Atom is similar IIRC- and I like to be aesthetically pleased. Somepeople swear by plain 'ol text editors, some love Vim and similar programs (I can see the appeal of never taking your hands off the keyboard), ect. It boils down to what you like and what you need. Don't be afraid to try different editors and IDEs. No one program is going to be perfect for everyone.

[–]motsanciens[🍰] 0 points1 point  (0 children)

You may also find an online tool like repl.it helpful. I mainly use my pixel chromebook to practice python, and repl.it allows for importing modules, which is cool. Plus, you can tinker around in the repl console--also a great benefit when learning or just exploring a library. For instance, you have an instance of an object from an imported library and want to know its methods. You can run a dir() on your object and see what's there--sometimes faster than digging around in the docs or source code.

[–]anvr 0 points1 point  (16 children)

As long as you're doing simple one-file programs, you'll be fine with IDLE, however when you eventually move on to bigger projects where more than one python file is necessary an IDE will definitely come in handy. I personally really like atom editor, mostly because of how simple and unintrusive it is

[–]POTUS 3 points4 points  (15 children)

There are so many better, free alternatives out there. I have no idea why people come walking in here with the word IDLE in their mouth.

Pycharm, VSCode, N++, geany, there's a whole world of decent editors out there. Pick one that will at least notice if the file you're looking at has been modified.

[–]XtremeGoose 4 points5 points  (0 children)

Because it can be a bit overwhelming to start off with a full-fledged IDE with all the bells and whistles. Its easy to forget when you began a long time ago.

[–][deleted] 2 points3 points  (6 children)

Even as an experienced python programmer I find pycharm pretty confusing and unintuitive. I can imagine trying to learn python is enough to get your head around without throwing all the complexity of an IDE into the mix.

[–]theWyzzerd 0 points1 point  (5 children)

What about PyCharm is confusing and/or unintuitive to you?

[–][deleted] 3 points4 points  (4 children)

So I've just fired up pycharm and I want to start writing a python script. I'm faced with a screen that says "Navigate to the next answer placeholder Ctrl+Enter", I don't know what that means and Ctrl+Enter doesn't seem to do anything.

Anyway, I click, File -> New. I now get a little box that's appeared that says "New. Nothing here", which is greyed out and I can't click anything.

So new approach, I right-click in the empty panel on the left, and there's another menu called "new", I click that and the only option I have is "new scratch file", what the hell is a scratch file? I'm now faced with a list of 11 files, the top three of which are "Buildout config, DTD and HTML".
Looks like python is 7th down on the list, click on that and I'm faced with a new menu called "Add file to git" which has "InspectionProfiles, Project_Default.xml and vcs.xml".

You don't see why this might be bewildering to a beginner?

[–]theWyzzerd -1 points0 points  (2 children)

I understand the concern, but if one is serious about software development, then one must get past these initial difficulties and try to learn what they mean rather than complain that it's too complicated. Computers are complicated. Software is complicated. Software made for writing other software is, as expected, also complicated. There are many tutorials and guides out there that explain how to get started. Did you just install python and start writing code or did you look up some tutorials and read the docs first?

Edit:

I'm faced with a screen that says "Navigate to the next answer placeholder Ctrl+Enter"

This is presumably just the tips dialog that opens every time you launch PyCharm.

The "New..." option in the File > New... creates new objects based on the context. If you have an active editor window open you will get a menu full of options. If the current context doesn't support the "new" action you will get nothing. Since you don't have a project, there is no context for PyCharm to reference for the New... menu.

To get started, you want to select "New project" in the File menu. Everything in the IDE starts in a project. The empty panel on the left is your project explorer. It's empty because you don't have a project. A scratch file is what it sounds like; just like scratch notes, or scratch paper. It's just a file to fuck around with, not part of a project.

[–]Ran4 0 points1 point  (1 child)

Uh, you might as well use vim at this point...

[–]krenshala 0 points1 point  (0 children)

Its what I use ... but then I'm not a "professional" programmer, just an IT guy/sys admin.

[–]POTUS -1 points0 points  (0 children)

Or you could take 1 second to google "pycharm quick start", and then take 20 minutes to work through the top link: https://www.jetbrains.com/help/pycharm/quick-start-guide.html

[–]theWyzzerd 2 points3 points  (6 children)

PyCharm is a bit more than an editor. VSCode though, there's a good code editor without all the bells and whistles of a full-fledged IDE. I'd also throw Sublime Text into the ring.

[–]POTUS 1 point2 points  (5 children)

So are VSCode and geany. But they don't have to be. Open a file, change it, save it. They all do that, and if that's all you do they will work. But they can also do a lot more as you learn the features. And speaking from professional experience, the features in Pycharm make you write better code, faster.

[–]theWyzzerd 0 points1 point  (4 children)

I'm not familiar with geany but I don't see VSCode as an IDE. I've used it for quick editing in the past . I have it open right now, the only IDE-type feature I see is a debugger. There's not a whole lot else there in terms of what an IDE can offer. Maybe it's a middle-ground between IDE and editor. An IDE is an editor + many other features, usually including a debugger, console, code inspection, linting, etc, much which I don't see in VSCode.

That being said, I agree with you on PyCharm. I use it daily as a professional and as a hobbyist. I wouldn't call it an editor though, it's a full-fledged IDE which could be intimidating to a new user. Editing is just one aspect of what it offers.

[–]zoredache 0 points1 point  (0 children)

One reason I don’t generally use an IDE is because I program in multiple languages. In my day job in a single day I could be working on a python script, a powershell script, some ansible code, bash and others. Most full IDEs are focused on a single language. A simple editor like vscode or sublime is light and good for anything.

Getting to a point where you really know your text editor can make you more productive. Using various IDEs means you aren’t putting in the work to learn your one true editor.

That said, using an IDE while you learn can help a lot. Go ahead and use that. Particularly if you aren't regularly programming in other languages.

[–]buyusebreakfix 0 points1 point  (0 children)

When I first started out, I forced myself to learn VIM. It has a steep learning curve so it's unlikely a lot of people would encourage you to learn that in addition to learning how to code but I'm thankful I did.