
Ask HN: Getting back into Python - codr
About to start a job doing python; it&#x27;s been over 10 years since I&#x27;ve written any. All I remember is lots of indentation.<p>I&#x27;ve been doing C# for the last 10 years, so I&#x27;m quite out of touch with the latest in python development.<p>What&#x27;s the best IDE for writing python? (on Mac OS X)<p>I see a lot of options out there, but would like to hear what people are actually using. Mostly I want an IDE that supports debugging.<p>I see that Xcode supports python, does anyone use that?<p>Thanks!
======
deft
I've never used an IDE for Python development, I find a text editor is good
enough. As Jugurtha said, Sublime Text on Linux is great, I use it daily. Good
luck with the new job!

------
mrfusion
IDE's aren't as big of a deal in Python as they would be in C#.

A lot of people just pick a nice text editor to do their work in. I like to
use xcode on the mac, but I use Python's built in debugger from the command
line for debugging. I find it easier than fooling with an IDE.

[1] [http://stackoverflow.com/questions/4228637/getting-
started-w...](http://stackoverflow.com/questions/4228637/getting-started-with-
the-python-debugger-pdb)

~~~
codr
Thanks - yeah I will certainly need to shift my thinking away from c#-style
(read: Visual Studio) development.

As for pdb, I guess I've been spoiled by Visual Studio's debugging - hover to
see values, step through source code, etc.

Is there no Python debugging/IDE equivalent to Visual Studio's hover/etc?

~~~
r4vik
there is, use Pycharm/IntelliJ

------
colinwd
If you don't want to stray too far from your comfort zone, Visual Studio has a
pretty good Python Tools extension. I'm also a C# dev and I find it really
nice to be able to play around with Python in the environment I'm most
comfortable in.

[https://pytools.codeplex.com/](https://pytools.codeplex.com/)

Edit: Ah, just saw you mentioned OS X. I like Sublime Text on that end.

------
Jugurtha
Not any more indentation than code in any other language (you indent anyway,
whether that's enforced or not).

Python has IDLE (which is cross-platform), but I prefer writing with Sublime
Text(on Ubuntu).

Here's a list for you:

[http://en.wikipedia.org/wiki/List_of_integrated_development_...](http://en.wikipedia.org/wiki/List_of_integrated_development_environments_for_Python#Python)

Good luck, codr.

~~~
codr
Thanks!

By "indentation" I meant using that for conditional blocks, instead of the
C-style bracketing that I'm used to.

I found that list of IDEs, but basically what I'm asking is what are people's
favorites from that list?

~~~
Jugurtha
I understand, codr.. But even in C, conditional blocks have an opening brace
next to the statement (like if, while, switch, etc), then new line, then
indented code, then new line for the closing brace.

For your choice of IDEs, I think looking for it in SO or Reddit would yield
good results, since it's probably a question asked often, so I guess you'll
find nice fat threads with pros and cons to help you make up your mind..

------
workhere-io
I'm pretty happy with Komodo Edit ([http://komodoide.com/komodo-
edit/](http://komodoide.com/komodo-edit/)), and it's free.

------
wilsonfiifi
First choice would be Komodo Edit hands down! If you're willing to spend a bit
more then you can go for Komodo IDE.

If you want a lighter weight editor then Sublime Text is a decent option.

------
yen223
Most powerful part of Python is its repl, no IDE required.

I do Django development, and my workflow consists of Sublime Text + IPython.

------
bdevine
PyCharm has a free edition that is quite nice, IMO. It even plays nicely with
Vagrant and IPython, if that matters.

------
taternuts
If you're looking for a full-featured IDE in the vein of VS, PyCharm is pretty
good

------
bliti
What type of Python work will you be doing? Web, ML, desktop, etc?

~~~
codr
Ah good question - desktop, basically.

edit: To be somewhat more specific I will be automating/testing a client
application that uses a server backend.

~~~
bliti
In that case, I often use Textmate or gedit. Scripting doesn't really create a
need for an IDE (IMO).

------
imwhimsical
Sublime Text (or Githubs Atom) works for me.

------
abimaelmartell
VIM is a great editor for Python

------
amirouche
GNU/Linux emacs user for Python dev.

The ability to browser a code easily, when you don't actually know the code,
is a lot of time that will be saved.

Pycharm is the best tool I know that does it out of the box.

I don't know about its debugging facility (I think you mean setting break
points), probably
[https://github.com/narfdotpl/debug](https://github.com/narfdotpl/debug) will
work just fine. I've been doing 1 year and a half of debugging Python code and
used it three times. Most of the time the workflow is this:

0) add logs?

1) reproduce the bug

2) read the logs?

3) read the code?

4) if the best fix is found fix it else restart at 0)

Other useful tools for debugging:

\- [http://dpaste.com/hold/1751069/](http://dpaste.com/hold/1751069/) this is
the basic version of what I use at work. It's a data descriptor [1]

\-
[http://faulthandler.readthedocs.org/](http://faulthandler.readthedocs.org/)
"for when there is no traceback"

\- Since you do UI, most likely you'll deal with asynchronous callback style
code (non-yield based), the traceback of a callback is not always useful ie.
you want to know to which code it is answering to. For that matter you need
tweak the event-loop code... having this patch at hand is helpful. e.g. say
you do a asynchronous call to retrieve something in the database, the call
probably looks like "query(callback=query_callback)", when the
"query_callback" will be called by the event loop with the result of the query
as arguments, most likely the immediate top frame is the event-loop (if it's
not the previous frame, it's the one before...) and "query" function will not
be in the callstack of course... If "query_callback" is used as a callback of
several asynchronous calls, you can not find the "calling code" with "find
usage" of your IDE... I think asyncio fix this

Profiling:

\-
[http://www.vrplumber.com/programming/runsnakerun/](http://www.vrplumber.com/programming/runsnakerun/)

\- [https://github.com/bdarnell/plop](https://github.com/bdarnell/plop)

\-
[https://github.com/wyplay/pytracemalloc](https://github.com/wyplay/pytracemalloc)
it is integrated in Python 3.4

I also use gdb on python coredumps.

[1]
[http://www.cafepy.com/article/python_attributes_and_methods/...](http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html#creating-
descritors)

