ForumsProgramming ForumEverything Python

14 2971
thepunisher93
offline
thepunisher93
1,830 posts
Peasant

So, I sometimes like to make itty bitty stuff in python.
I am not a master of it but know its syntax and stuff.
I made this so we can talk about python.

  • 14 Replies
Salvidian
offline
Salvidian
4,229 posts
Blacksmith

I've played around with it here and there but I don't know much about it. It isn't really a necessary language, is it? I mean, it's probably going to be outdated sometime in the near future. Hell, HTML5 was released a few months ago and it's already been upgraded so much its nowhere near what it was when it came out.

What's it even used for? We used it in class for some weird program to make servers run faster, although I doubt it's used for server maintenance.

BRAAINZz
offline
BRAAINZz
789 posts
Peasant

I've seen it while looting my school's programs once or twice but never had the motive for it. I'm sure I could get into it, but I need to know two things.

On a scale of 1 to 10, how hard is it to learn?

And Also on a Scale of 1 to 10, how powerful is it?

SwordmasterQ
offline
SwordmasterQ
29 posts
Peasant

Python? Are you talking about Monty Python?

Salvidian
offline
Salvidian
4,229 posts
Blacksmith

On a scale of 1 to 10, how hard is it to learn?


I'd give it a rating of 3 in difficulty. I remember it was pretty easy, but there were a few things that could trip you up. I remember writing a page or two of code and have it completely fail because I forgot a character here and there. If I remember correctly, it was as easy to memorize as HTML5.

And Also on a Scale of 1 to 10, how powerful is it?


Python works just like any other server side language. It runs as a CGI process on the server and can access database and output results just like CF, PHP, JSP, and ASP. I would suggest you go to http://python.org and read up on some of its capabilities.
From devshed.com

Looks pretty powerful to me. PHP and ASP aren't too bad, so I'd give it a 7 rating or so.

Python? Are you talking about Monty Python?


No, the server language.
thepunisher93
offline
thepunisher93
1,830 posts
Peasant

Google uses it in its pages.
its very easy to learn, its not like other weird languages, its syntax is very simple.

KingLemon
offline
KingLemon
600 posts
Shepherd

Learning python right now actually! We learn C next semester, hopefully by spring if anyone needs help with Python I'll be a natural ;D
For those of you who are used to other languages and are too lazy to look up Python here's an example for you for a scrolling starfield with random color variables!

# Starfield
import pygame
import random
import time

win_width = 800
win_height = 600

# Pygame initialization
pygame.display.init()
screen = pygame.display.set_mode((win_width,win_height))
starfieldSurf = pygame.Surface((win_width * 4, win_height))

# Create the starfield
numStars = 1000
starCount = 0
while starCount < numStars:

x = random.randint(0, win_width*4)
y = random.randint(0, win_height)
size = random.randint(2, 7)
color = (random.randint(50,255), random.randint(50,255), random.randint(50,255))
pygame.draw.circle(starfieldSurf, (color), (x,y), size, 0)
starCount += 2

# Scroll the starfield
x = 0
while x > -2400:

screen.blit(starfieldSurf, (x,0))
x -= 8 #Speed (higher=faster)


pygame.display.flip()
time.sleep(.02)

# Shutdown pygame
pygame.display.quit()
Kilop1992
offline
Kilop1992
2 posts
Peasant

I've been using Python for multiple years now, I love the language, but it does have some issues. Like that it is about 100-times-slower than C in lower-level benchmarks. Python also has no way of commenting out multiple lines of code, other than by using the hack of designating such code an extended string with the triple single quote operator, of course. "self" (the Python equivalent of C++ and Java's "this&quot is never implicit in Python: You always have to name it. There's more issues with Python, though I'm not going to have you read through all of it's little issues. Python has those issues in it, but weighing out the disadvantages with its advantages, Python is a great language to use and is very recommended.

Darkroot
offline
Darkroot
2,775 posts
Shepherd

On a scale of 1 to 10, how hard is it to learn?


Like 2 to 2.5 in languages. There are easier ones but they aren't as flexible as python. 10 is like Haskell which is for seasoned programmers.

And Also on a Scale of 1 to 10, how powerful is it?


Not as many libraries some things are not as fast as C++ so maybe like 6.5 to 7

No, the server language.


No the programming language. There is no server language, I guess you mean database language like PHP.
PhsycoDragon
offline
PhsycoDragon
41 posts
Peasant

Google AppEngine uses it, so it must be good for something. But how would it compare to Java?

KingLemon
offline
KingLemon
600 posts
Shepherd

Just finished my first python game
It's super simple (it was just a project for my class)
created a ship with a shield and asteroids coming at it that you must destroy. It was actually really fun to code!! on top of that I made my own images and sounds so it was that much better from my own personal point of view!

PhsycoDragon
offline
PhsycoDragon
41 posts
Peasant

Cool!

Darkroot
offline
Darkroot
2,775 posts
Shepherd

Yeah I started using python again to make a bot to play a flash game named Jacksmith. It is pretty good with the libraries to control the mouse/keyboard and is fairly easy to set up but when you start taking pictures and comparing it to the screen is slows down drastically. I might have to optimize my code but I think c++ would be faster albeit much more of a pain to work with.

WhiskeyedJack
offline
WhiskeyedJack
81 posts
Farmer

The other thing to remember is that python is in an interpreted language. On the upside this means that there are no compiling times (yay!) and your program is cross-platform (as long as they have the interpreter on their system, which you can bundle with the install if need be). The downside is that it tends to be slightly less efficient, so in memory intensive scenarios like raytracing, you may be better off with something in the C family.

gabrielzanchete
offline
gabrielzanchete
5 posts
Shepherd

cool!!

Showing 1-14 of 14