Thanks to Dani for adding Python to the scripting languages category!

...I haven't heard many people mention Python around here... Am I the only Python fan here? I know its usage isn't as widespread as Perl, but it is, IMHO, as powerful and useful as Perl, for general scripting, web scripting, and for administration.

I'm not up on the intracacies (sp?) of Python, but I'd like to hear some opinions from those of you who have used it, work with it, or heard some guy talking about it once. So far, I've found it to be a really fun, flexible scripting language, and I've been able to do some pretty nifty little tasks with Python that would have taken a little more time to do in say, a shell script.

Opinions, anyone?

Recommended Answers

All 15 Replies

hmm i dont really know much about phython care to educate me?

www.python.org

...That's all you need to know. It's object-oriented, it's extensible, it has a really clean syntax, and it's a really fun language to program in. It can pretty much do everything Perl does, and it has some neat features. It's interpreted/compiled like Java (ala bytecode), and it has C integration. Because of the way it's compiled at runtime, you can make binary executables and distribute them, so people who don't have a Python installation to run a program written in it.

If you check out the website, you'll see even more. It's a great language for prototyping small programs, or just quickly developing a program.

alc6379, I was starting to learn python. I am working my way towards LPI 1, and was looking through 1 & 2. I found in topic 213, you have to be able to write simple perl scripts and install Perl modules from CPAN. So now I will have to start learning perl and come back later to python.

Python is my absolute favorite language - the holy grail language I've been looking for all these years.

I'm a 'language collector' who's tried dozens of languages from Basic to assembly to C to C++ to Perl to PHP to Java to Scheme, and whenever I need to get something done, I end up doing it in Python because it's just so damn easy and fast to do it there.

It particularly excels at the tasks where you would use Perl for - not as succint but far far more readable and maintainable as well as offering at least as much power as Perl if not moreso.

Vis-a-vis PHP, there are Python HTML-embedded solutions (I found Spyce - http://spyce.sf.net the best and most PHP-like) which by dint of the languages's superior syntax would be much preferable over PHP except for the fact that few third-party hosting solutions offer it.

Python's DB-API has excellent support for RDBMS backends and definitely on par with PHP and Perl in this aspect.

One Python weakness is that it's not that good yet for doing GUI and graphics apps. I'm still not satisfied with the wxPython, PyGtk, Tkinter GUI frameworks. Pygame (www.pygame.org) absolutely rocks for 2d game development but OpenGL support is still at 1.2 - perfect for learning OpenGL but not for taking advantage of the latest features.

Python just makes everything so easy that once you try out a very high level language like it, you will just find it ridiculous to go back to C or C++.

The following page talks about what Python has to offer:

http://www.netasia.net/users/troll/Scripting1.htm

Great links, thanks, Jon!

Because of the way it's compiled at runtime, you can make binary executables and distribute them, so people who don't have a Python installation to run a program written in it.

i didn't know that. are you sure??

i didn't know that. are you sure??

I'm pretty sure. I've done it before in fact. I can't remember the exact steps off-hand, but you have a few stages that you can work with Python scripts. Once of those ways involved making an executable that contained all the code from the Python interpreter that the bytecode needed to run. If I remember to, I'll pull out one of my Python books and figure out again how it was done.

i didn't know that. are you sure??

It's called Py2Exe and it is a free download like most of the Python goodies.

I've looked at it and liked what I saw. But as I'm working fulltime in Java and that's a large enough field to keep me busy I've little time to do much more.

I am also a python newbie. but as im learing more about the language it is becomming more and more interesting for me. :cheesy:

I looked into Ruby, Lua and Python. They are all very similar, but I like Python the best! There is a lot of Python code out there to learn from!

I just started to learn the python language and it is fun relatively easy to grasp
and seems to beable to do everything that perl can do.I also want to thank you dani for including it in the language form,I know it will be a big help for me in the future.

you can make binary [Python] executables and distribute them, so people who don't have a Python installation to run a program written in it.

i didn't know that. are you sure??

Yes this is absolutely true.

I know of at leaset 2 tools which can accomplish this:

1. http://www.py2exe.org/
2. http://pyinstaller.python-hosting.com/

There should be a couple more.

I'M CURRENTLY LEARNING PYTHON AND I THINK THAT IT IS COOL,I HAVE BEEN ATTEMPTING TO WRITE A PROGRAM FOR A GAME CALLED "NINE MEN'S MORRIS" BUT I RAN OUT OF CREATIVE JUICE AND I AM STRUGGLING TO GO ON, SO FAR I HAVE ONLY BEEN ABLE TO DESIGN THE BOARD AND THE MEN ALSO TEXT THAT HELP WITH STARTING THE GAME,I HAVE THE CODE BELLOW AND IF YOU CAN,PLEASE HELP TO COMPLETE THE PROGRAM.

THIS IS THE PROGRAM SO FAR:

from graphics import *

win =GraphWin("Nine Men's Morris" , 1100,1000)


b1 = Circle(Point(900,100), 15)
b1.setFill("blue")
b1.draw(win)
b2 = Circle(Point(900,200), 15)
b2.setFill("blue")
b2.draw(win)
b3 = Circle(Point(900,300), 15)
b3.setFill("blue")
b3.draw(win)
w1 = Circle(Point(50,100), 15)
w1.setFill("black")
w1.draw(win)
w2 = Circle(Point(50,200), 15)
w2.setFill("black")
w2.draw(win)
b4 = Circle(Point(900,400), 15)
b4.setFill("blue")
b4.draw(win)
b5 = Circle(Point(900,500), 15)
b5.setFill("blue")
b5.draw(win)
b6 = Circle(Point(900,600), 15)
b6.setFill("blue")
b6.draw(win)
b7 = Circle(Point(900,700), 15)
b7.setFill("blue")
b7.draw(win)
b8 = Circle(Point(900,800), 15)
b8.setFill("blue")
b8.draw(win)
w3 = Circle(Point(50,300), 15)
w3.setFill("black")
w3.draw(win)
b9 = Circle(Point(900,900), 15)
b9.setFill("blue")
b9.draw(win)
w4 = Circle(Point(50,400), 15)
w4.setFill("black")
w4.draw(win)
w5 = Circle(Point(50,500), 15)
w5.setFill("black")
w5.draw(win)
w6 = Circle(Point(50,600), 15)
w6.setFill("black")
w6.draw(win)
w7 = Circle(Point(50,700), 15)
w7.setFill("black")
w7.draw(win)
w8 = Circle(Point(50,800), 15)
w8.setFill("black")
w8.draw(win)
w9 = Circle(Point(50,900), 15)
w9.setFill("black")
w9.draw(win)

a_rectange= Rectangle(Point(100,100), Point(800,800))
a_rectange.draw(win)
a_rectange.setOutline("cyan")

w1 = Circle(Point(50,100), 15)
w1.move(100,15)
w1.draw(win)


a_rectange= Rectangle(Point(380,380), Point(520,520))
a_rectange.draw(win)
a_rectange.setFill("black")
a_rectange= Rectangle(Point(100,100), Point(800,800))
a_rectange.draw(win)
a_rectange.setFill("white")

a_rectange= Rectangle(Point(380,380), Point(520,520))
a_rectange.draw(win)
a_rectange= Rectangle(Point(100,100), Point(800,800))
a_rectange.draw(win)
a_rectange= Rectangle(Point(250,250), Point(650,650))
a_rectange.draw(win)

Line(Point(100,450),Point(380,450)).draw(win)
Line(Point(520,450),Point(800,450)).draw(win)
Line(Point(450,100),Point(450,380)).draw(win)
Line(Point(450,520),Point(450,800)).draw(win)

Text(Point(900,100), "b1").draw(win)
Text(Point(550,50), " click a MAN you wana move").draw(win)

shape_pos =win.getMouse()
if   shape_pos.getY() <100:
     Text(Point(550,75),"you selected b1").draw(win)
elif shape_pos.getY() <200 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b2").draw(win)
elif shape_pos.getY() <300 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b3").draw(win)
elif shape_pos.getY() <400 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b4").draw(win)
elif shape_pos.getY() <500 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b5").draw(win)
elif shape_pos.getY() <600 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b6").draw(win)
elif shape_pos.getY() <700 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b7").draw(win)
elif shape_pos.getY() <800 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b8").draw(win)
elif shape_pos.getY() <900 and shape_pos.getX() <900:
     Text(Point(550,75),"you selected b9").draw(win)


win.getMouse()
win.close()
win.setBackground("green")

AND I THINK THE PROGRAM FOR MOVING SHOULD BE SOMETHING LIKE THIS:
curcow=getmouse(win)
next pos=getmouse(win)
i=0
while player1[i]!=curcow:
     i+=1
nx=nextpos.getx()
ny=nextpos.gety()

cp=player1[i].counter()
cx=cp.getx()
cy=cp.gety()

dx=cx-nx
dy=cy-ny

What a poor example of Python, violates all the Zen! There is an outcry for loops and functions.

import this
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.