Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I keep reading about a bunch of projects that are made with Python, and...I just keep seeing "Python" turn up in a lot in general in programming forums. Now, I might decided to learn it. I'm assuming it's pretty good since it seems as if a loy of people program in it. I want to know a few things about Python though, and all of your general options of it. Is Python Object-Oriented? How compatible is it between computers? I already know some Visual Basic, C++, C#, and Java; do you recommend Python over these languages? What is your overall opinion of Python? Also, I would appreciate if you told me about any IDEs that you recommend for Python programming.
ok, I can start you out

Python is OOP as far as I know (correct me if I am wrong)
It is cross platform by default as it is interpreted.
I can't help on recomendations except over VB/C#, as they are Windows only (again, correct me if I am wrong)
I am fond of what Python can do, but have no real experiance with it.
For IDEs, any text editor, but in general, I am a Notepadd++ fan.

I hope this helps, and please, correct me if I am at all wrong here.
Rivereye: you got it.
BFR: Welcome. Other than what rivereye said, I'd have to also recommend notepad++ for Python and indeed all text editing and programming:
http://notepad-plus.sourceforge.net
Python is an Object Oriented Scripting Langauge that absolutely destorys VB. It is even faster than Java, and pulls off the code-once-run-anywhere concept MUCH better than Java (You don't even need to compile it). It comes with a bunch of built in modules, from sockets, to a GUI (although not that good of a GUI toolkit, but others are available, such as wxPython (wxWidgets) and pyGTK (GTK+))

Whenever I start a project, I will often prototype it out in Python, even if I plan for the finished program to be C or C++, just because it is much faster to code in.

It is a bit wierd to program in at first, as it is somewhat white-space strict, but once you get used to it, it is oddly comfortable and natural feeling

My personal fav for Python programming is the best Python IDE ever. Its called Wing-IDE, but unfortunately it isn't free (you can apply for a free liscence if you have a decent GNU GPL style project) It is amazingly good IDE though, and you should at least try out the free trial.

KDevelop is also a good one, not just with Python but also C/C++ and others (it even has an automake manager to make those nifty configure scripts for you, will create tarballs, can save sources as HTML w/ syntax highlighting, built in CVS and SVN support, along with a host of other features)
Thanks Smile.

So, I can just make a Python program in Notepad++, save it as a .pthn or whatever, and it becomes an executable Python program? All I need is the latest version of Python (2.4.3 I think?) and an IDE, such as Notepad++ or Wing-IDE, since Python doesn't need to be compiled?
its .py, but otherwise, yes, thats all you need (python can also be run in "interactive mode", where you type the commands directly to the interperater, which is great for experimenting or testing a new class)

Here's a rather complex "Hello, World!" variant in python. Just save the file as something.py and, if all went well with your Python install, double click it, and it should launch


Code:
#!/usr/bin/env python
import sys, os

def echoHello():
   print "Hello, %s!" % str(os.getlogin())

def echoOS():
   print "You are running a %s compatible OS" % str(os.name)

def echoArgs():
   print "Running \'%s\' with args %s" % (str(sys.argv[0]), str(sys.argv[1:]))

if (__name__ == "__main__"):
   echoArgs()
   echoHello()
   echoOS()
   raw_input("Press return to exit")


After reading the python tutorials at python.org (the "official" ones are pretty good), the code should be fairly self-explanitory, but if you still have any questions, I'll be glad to answer them. (Assuming you already made an attempt to figure it out on your own, of course)
OK. Also, I'm downloading wxPython right now. There's an option in the setup to compile .py files to .pyc. What is the difference? Is .pyc just a compiled version of a Python program thus making it faster but uneditable?
bfr wrote:
OK. Also, I'm downloading wxPython right now. There's an option in the setup to compile .py files to .pyc. What is the difference? Is .pyc just a compiled version of a Python program thus making it faster but uneditable?


.pyc files are python byte-compiled files. It isn't any faster, except for the first import. When you import a library, python checks the .py and .pyc files, if they are identical (as in the timestamps match), then it uses the already byte-compiled .pyc file. Otherwise, it byte compiles the .py file, and then imports that byte compiled file.

So always say yes to compiling .py files to .pyc, it will save time later on
OK, thanks.

So, I downloaded Python version 2.4.3 for Windows. The interpreter seems to work fine; I type:

print "Hello"

and it displays "Hello".

But, here, it says that I should check to see if I have already have Python by typing "python" in the command line. I had already uninstalled any old versions of Python I had, and installed the lastest stable release (2.4.3). I figured that if I typed "python", I should still, "see a response from a Python interpreter it will include a version number in its inital display", but I didn't when I typed it. I got an error of some sort.

Should I also make a new thread for this? (The subject would be about what I said previously in this post and vertifying my Python installation)

EDIT: I'm running Windowx XP, and I think typing in "python" and getting the version number only works on Unix systems, but I'm not sure.
if it's so much better than Java, then how come the AP compsci course is still based around Java?
Ignore my previous post. I'm pretty sure that Python works; I tested a couple of Python programs.

I downloaded wxPython, and it seems pretty good, but it seems easier to create a GUI with Java, Visual Basic, and C# (especially Visual Basic and C# because of Visual Studio Wink ). Hopefully I'll end up liking other aspects of Python.

Also, is there any way to prevent the Python command line from popping (I almost spelled that pooping O_o ) up every time I run a Python program?
bfr wrote:
Also, is there any way to prevent the Python command line from popping (I almost spelled that pooping O_o ) up every time I run a Python program?


It won't (or shouldn't) pop up if it is a GUI program.

Typing Python at the command line only works if you have added the folder python is in to the PATH (which I recommend you do).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement