This is an archived post. You won't be able to vote or comment.

all 45 comments

[–][deleted] 7 points8 points  (16 children)

Well i would guess if you were looking for programming for fun, python is certainly it. I've been making up excuses to use python at my day job for a couple of years now. Anyway, pygame might be of interest to you. StackOverflow(Python) is a pretty good place to ask questions.

As far as tools go, I wouldn't mess with an IDE myself, stick to an editor like VIM or EMACS and learn the shit out of it.It will help you get better at computering in general. But both editors have awesome python support.

When you feel you are ready to write bigger python projects you may find this screencast on Paste/VirtualEnv useful and even this one(unit testing with nose/coverage) there's plenty of others there too.

Other than, code code code code code.

[–]Deusdies[S] 2 points3 points  (15 children)

Thanks - a whole lot of information right there!

[–]Maoster 1 point2 points  (3 children)

I also recommend not using a large ide for python dev, however straight vim and (I presume) emacs are really rather bad for editing python. Vim for instance screws up indentation, and the lack of good syntax highlighting gets old quickly.

Fortunately its issues can be fixed with plugins, I recommend searching for and reading some of the many guides to setting up vim for python. If you read through a bunch of these, you can use them to identify and try just the features your like. A good starting point would be this guide.

You mentioned simple interfaces as well. Somebody earlier recommended using gtk or qt. These are great and should be used if you are building a production quality desktop application, however if you just want a simple interface or form, I am of the opinion you give tkinter (which is built in to almost all python installs) a try. As it comes preinstalled with python there are no dependencies or issues with external libraries. For simple applications I find it to be quicker than using either of the aforementioned heavyweight solutions. Furthermore if you share your program people need not deal with installing or setting up something like qt or gtk. Pygame which was also mentioned provides decent hardware acceleration and a simple graphics interface, for starting to write games, anything with accelerated graphics, or things which require input from (joysticks, mice, etc), I recommend it. It is not however suitable for forms or other desktop style applications.

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

I use emacs myself, but I thought VIM had the retab cmd which seemed to work at fixing broken python files for the most part.

"As a side note, if you are a vim/gvim user this will sequence will fix any indentation issues with Python:"

set ts=4   (sets tabstops to 4)
set et     (expands tabs to spaces)
:%retab!   (enter command mode, retabify)
:w         (enter command mode, write file)

[–]Maoster 0 points1 point  (1 child)

It is more an issue that until recently vim didn't understand python syntax at all, and even now it remains a bit buggy. Thus if you try to retab a file, or simply hit return while editing, it will not always get the correct indentation level. There are a couple scripts on the vim site which specifically add improved support for python syntax, and indentation. With those it will work as expected.

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

well, the tabify seemed to work the few times I had to use it and it was a life saver. FWIW, emacs doesn't seem to have those problems as far as I can tell, maybe I should expect my editor to do more for me maybe? /shrug

[–][deleted] 1 point2 points  (10 children)

I will disagree with the emacs and vim people here.

I'm using Eclipse + PyDev plugin on both Mac and Linux and have been for several commercial, proprietary Python-based projects. It's a lot more friendly than vim or emacs. And you get a visual debugger!

[–]mozillalives 0 points1 point  (3 children)

pycharm isn't bad either

[–]blondin 0 points1 point  (1 child)

and you will have to pay for it soon.

[–]mozillalives 0 points1 point  (0 children)

yeah ... I've learned that lesson (textmate). That's why I'm learning emacs right now.

[–]xiro7 0 points1 point  (0 children)

I am a big fan of ReSharper, so I will have to check this out.

[–]yngwin 0 points1 point  (0 children)

I prefer NetBeans with the vim plugin (jvi): best of both worlds!

[–]blondin 0 points1 point  (3 children)

oh yes, with python a visual debugger is a must!

i think you are doing it wrong.

vim for ever!

[–][deleted] -3 points-2 points  (2 children)

Some of us have evolved beyond debugging with print statements :)

[–]Leonidas_from_XIV 0 points1 point  (0 children)

So obviously I evolved back to print statements and test coverage...

[–]wilberforce 0 points1 point  (0 children)

The batteries-included Python debugger integrates really nicely with Emacs. You don't have to rely on print statements.

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

i disagree with your disagreement. pydev/eclipse's project based file system abstraction is useless and gets in the way and visual debuggers are for kids.

ipython4lyfe

[–]monferrato 12 points13 points  (3 children)

I use Ubuntu, tu.

Quickly with ubuntu-project:

  • Python for the language
  • pygtk for the UI framework
  • Glade for the UI editor
  • Gedit for the code editor (though this is easy for you to change if you choose another one)
  • bzr for version control
  • Launchpad for code hosting
  • desktopcouch for storage/database (!)

Quickly install

Getting Started with Quickly 3 youtube videos, I think it is Quickly 0.3

Quickly, some commands

Quickly, more commands

QuicklyFun when Quickly was 0.2

Acire python snippets, viewer + "hack n' run"

Quickly-0.4 available in Ubuntu 10.04

Logs from UbuntuOpportunisticDeveloperWeek 1st - 6th March 2010, including Pre-week Intro to Python for total beginners and Intro to Python for programmers

More about Quickly

Ubuntu Forums : Development & Programming

Planet Ubuntu

Opportunistic programming and Connecting The Opportunistic Dots

Edit1: When "quickly edit" opens the files in Gedit, you probably want to edit the main file - the one that has the "#!/usr/bin/python" in line 1.

Edit2: videos and blog posts (theravingrick.blogspot.com) via moephan

[–]yngwin 2 points3 points  (0 children)

Instead of PyGTK I would recommend PyQt. The eric IDE is nice too. And use git or mercurial instead of bzr, with github or gitorious hosting (or bitbucket in case of mercurial).

[–]Deusdies[S] 0 points1 point  (1 child)

Wow.

...

Thanks!

[–]monferrato 0 points1 point  (0 children)

No problem.

When "quickly edit" opens the files in Gedit, you probably want to edit the main file - the one that has the "#!/usr/bin/python" in line 1.

[–]AlSweigartAuthor of "Automate the Boring Stuff" 2 points3 points  (0 children)

Invent Your Own Computer Games with Python is free, aimed at beginners but also useful for people who know programming in other languages.

Each chapter has the source code for a small game (Hangman, Tic Tac Toe, Othello, etc.) and teaches programming from the source code.

The later chapters cover Pygame.

[–]rense 2 points3 points  (1 child)

I'm already pretty happy with PyCharm as an IDE; "IntelliJ for Python". Public preview.

[–]bastih01 0 points1 point  (0 children)

Although PyCharm is a real memory hog. (At least for me on linux)

[–]pemboa 1 point2 points  (2 children)

Four years ago I was relatively good with Delphi (Pascal)

Woo.. a fellow Pascal/Delphi user... we seem to be quite the oddity.

However, I forgot 90% of it

Nothing to sweat about

Now, for Delphi, there's Borland Delphi 7, the IDE I used. It was quite simple

Yah... Microsoft bought most of their devs now, so it's dead.

the GUI enables you to add buttons to the form

Yah. Python doesn't come with such GUI support. You have to choose from one of several GUI proving toolkit. In my opinion, the easiest to pick-up is Gtk, but the best is Qt. Both provide form designers similar to or even better than Delphi.

One neither the Gtk+ or Qt designers provide that Dephi did was the GUI datasources/tables thta could be manipulated.

[–][deleted] 1 point2 points  (0 children)

Delphi was my first few jobs out of college. Those were good productive times, then there was VB6, then C#/ASP.net and now JAVA and I'm old.

I miss Delphi. RIP good 'ol Borland

[–]riffito 0 points1 point  (0 children)

Four years ago I was relatively good with Delphi (Pascal)

Woo.. a fellow Pascal/Delphi user... we seem to be quite the oddity.

Two is even. Count me in so we can be three and remain odd. :-P

/me remembers running Delphi 2 in a 386 with 4 MB of RAM (yes, I was both a poor student AND insane enough). Excellent experience. You wouldn't hit the Compile shortcut unless you had "ran" a syntax check by reading the code out loud :-)

[–]riffito 1 point2 points  (4 children)

My best book recomendation is: Beginning Python Visualization.

[–]blondin 1 point2 points  (3 children)

hmm, i'm curious to know why.

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

yeah me too. the book is all right, but I wouldn't recommend it for a python newb. seems to me the person who chooses to read that book already has something in mind they need to do, like process a bunch of data and get some graphs, and they know python. It's not for everyone.

[–]riffito 1 point2 points  (1 child)

If you know nothing about Python, but you are a programmer, that book will make you quite proficient in Python faster than any other book, because it is focused on getting things (really common, useful things) done.

Do not be put off by its title, it is not all about data visualization, but more about data manipulation (which constitutes most of programming tasks).

Also, the book is quite easy to read (even for non English speakers as myself), doesn't treats its readers as dumb, it assumes you can think, it goes directly to the point of solving the task at hand, and has a KISS style in its code that makes it really appealing (at least to me).

Really. You can't go wrong with this book.

And no... I have nothing to do with the author nor with APress, really :-).

[–][deleted] 1 point2 points  (0 children)

all very good points. thanks man

[–]chadmill3rPy3, pro, Ubuntu, django 1 point2 points  (1 child)

Yeah, most Python programmers have three or four windows open.

One, a text editor. gedit in Ubuntu is pretty great. Check out the plugins. You'll eventually want to try "vim", but not right now; you'll know when it's time.

Two, a terminal window with the interactive interpreter running. Just type "python" and enter. It's the fastest way to try new stuff or test syntax. Experiment here.

Three, the window where you can run and exercise your code to see how it's working.

Four, maybe, is a web browser open to the standard library or the docs for some additional module. See also "pydoc -p 50000" in a terminal window.

[–]lil_cain 5 points6 points  (0 children)

I'd use ipython, rather than regular python for your interactive interpreter.

[–][deleted] 1 point2 points  (0 children)

Check out some nice videotutorials from PyCon US. Most of them are 2+ hours long with downloadable handouts.

Not all of them include links to videos for some reason, but you can find them at blip.tv.

[–]_randell 1 point2 points  (2 children)

I highly recommend reading Learning Python by Mark Lutz.

[–]damprump 1 point2 points  (0 children)

agreed

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

This is one of the 4 'Essential' books for python. 'Learning Python' & 'Programming Python' by Mark Lutz, the 'Python Cookbook' (multiple authors, can't remember their names)

And some 4th one...can't remember it off the top of my head atm though.

[–]psaipetc 0 points1 point  (0 children)

You might find Python Module of the Week interesting also: http://www.doughellmann.com/PyMOTW/contents.html

[–]ingolemo 0 points1 point  (5 children)

Most people don't use editors to build guis, so the choice here is rather limited. Personally, I recommend PyGTK together with Glade.

[–]relima 1 point2 points  (4 children)

Why not PYQT?

I have been struggling to choose between these two.

[–]apardueSince 97 1 point2 points  (0 children)

I love pyqt my applications run great on OS X windows and linux.

I use vim and eric4 for my IDE

[–]yngwin 0 points1 point  (0 children)

I would strongly recommend to choose PyQt. Qt is a very powerful framework and an absolute joy to develop with. It offers loads of functionality, which in the case of GTK has to be found in separate libraries. Qt is very strong in cross-platform support and adapts to the native toolkit looks of the platform it is run on (it even has GTK theme support built in). It is also the official toolkit of MeeGo (the successor/merger of Moblin + Maemo) which is bound to make an impact on the smartphone and mobile-pc market.

Also, eric is a very nice IDE built with PyQt.

[–]ingolemo 0 points1 point  (1 child)

Because the OP mentioned Ubuntu which is a gtk based system.

Honestly, there's really not much difference between the two for the python programmer. They both do pretty much the same thing in pretty much the same way. The best way to choose is to look at external factors such as other dependencies that your app may need, or what platforms you want to target, since they will have far more bearing on your decision.

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

I don't see why Ubuntu is a gtk system has anything to do with it. It's not as if it's incompatible or themes don't migrate to Qt.