Python 2.7.3 Discussion

Previous topic - Next topic

8bitBoss

Quote from: Hemlos on 2012-Nov-10
Yes, the biggest flaw python has, it is not backward compatible.  :x

Im not sure, yet, why it is not cross platform compatible.
I have ripped stuff made for linux fedora, and it worked fine on windows xp.
Im going to make a guess here, some builtin commands are not useable by different platforms.
I think every built in command is supported on every platform with a standard Python implementation, including Windows, Linux and OSX.
i7 2700k
16GB DDR3 RAM
GeForce GTX 560 Ti
Windows 7 Ultimate 64Bit

okee

The authors of legend of Grimrock had an interesting post about using LUA for their game
http://www.grimrock.net/2012/07/25/making-of-grimrock-rapid-programming/

Can Python be used in the same way ?
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)

Hemlos

Any language can im sure, its a scripted game if theyre using lua.
Bing ChatGpt is pretty smart :O

jestermon

The Grimrock post was interesting, but it brings up the age-old argument of compiled versus interpreted.
I agree that interpreters are real RAD, and it has many advantages. For example a Python program takes about 1/20th of the time to write than a c++ program of the same complexity. A Java program takes almost three times as long. I'm talking about a real program - Something with the complexity of a small text editor.
It's really a trade off runtime speed versus runtime flexibility. The interpreted byte code gives the flexibility, the pure binary gives the speed.
Writing and changing programs at runtime is an old thing. It's been done in Disney's Panda3D (Python) for years. No mess, no fuss - Just change the code at runtime, and tweak while you are developing. I guess because the newer WYSISYG game editors like Unity are very popular, because of the quick iteration of interpreted code in the development cycle. (obviously the world builder adds to the gimmick)
Whether it's Lua, Python or Ruby - they are much the same. So there's nothing new here. Just redeployment of old ideas in a newer interpreter.

Hemlos

Easy as  123, h tee tee pee....7 lines, permanent http server.
I just tried this on the local network...awesome.
Also i punched my firewall, and voila, website on my desktop.
http is one of many supported protocols, it even handles mail i think...theres so much to read.
Heres the libraries listed for the help file:
http://docs.python.org/2/library/index.html

Code (glbasic) Select
#The SimpleHTTPServer module can be used in the following manner in order
#to set up a very basic web server serving files relative to the current directory.

import SimpleHTTPServer
import SocketServer

PORT = 80

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()
Bing ChatGpt is pretty smart :O

Hemlos

i was playing with sounds.
this function controls the computer beep speaker and fluxuates very high pitch sounds, my dog hates it.

Code (glbasic) Select

import winsound
#computer beep
# val1 is freq 37-32767, val2 is time in milliseconds
while True:
    for eachsound in range(12000,14000,100):
        winsound.Beep(eachsound, 100)
    for eachsound in range(14000,12000,100):
        winsound.Beep(eachsound, 100)
Bing ChatGpt is pretty smart :O