Adam you should probably wait for DontCare4Free to get here, these jokers clearly don't know anything about Python.
Hi.
Why the hell are you creating functions which have natural language constructs already anyway?
Probably as a quick dictionary ("this" is how you do "that" the Python way).
Django obviously because everyone who writes Python uses it basically - it's just how it's done these days. I'm sure if you learned a bit more about python you'd probably realise this.
Django is a fairly popular web development framework for Python. Python isn't a single-framework language like Ruby (while Ruby can be used on it's own or with another framework, let's be honest here, when was the last time you saw anyone do it?). Django in itself contributes nothing to general-purpose development and only helps with website-specific tasks.
BitBucket to keep the code in because lets face it, where else do you keep python code? Also open source is the future!
Bitbucket is not bound to OSS/"publicness" and is also fully optional. There are several alternatives to choose from, including self-hosting and nothing such at all.
Python as far as I know doesn't have functions such as GetWord() or GetSubStr(), so I was wondering if I could call torque functions in IDLE,
It's a bad idea. Instead, while learning, you might want to look it up in Brian's answer (although I've changed a few things to fix syntax errors, etc).
########################
#Sticks and Stones Lang
#By Brian Smith
#Version 1 Build 1
########################
########################
#SubStr
########################
def getSubStr(string,start,end):
return string[start:end]
def strLen(string):
return len(string)
########################
#Basic Word Functions
########################
def firstWord(string):
return string.split(" ")[0]
def restWords(string):
return string.split(" ")[1:]
def lastWord(string):
return string.split(" ")[-1]
def getWordCount(string):
return len(string.split(" "))
def getWord(string, num):
words = string.split(" ")
if num > len(words):
return None
else:
return words[num]
########################
#Basic Field Functions
########################
def getFieldCount(string):
fields = string.split('\t')
return fields.len()
def getField(string,num):
fields = string.split('\t')
if num > fields.len():
return None
else:
return fields[num]
########################
#Basic Line Functions
########################
def getLineCount(string):
lines = string.split('\n')
return lines.len()
def getLine(string,num):
lines = string.split('\n')
if num > lines.len():
return None
else:
return lines[num]
[/tt]
:)
and Python functions in Blockland somehow.
The simplest way to do with would probably be with the (bundled)
SocketServer microframework (more specifically, look into TCPServer and StreamRequestHandler) on the Python side while using regular TCPObjects on the Torque side. One issue, however, is that network IO is asynchroneous/non-blocking in Torque (meaning that the function returns before you have a response) which you'll have to adapt your code for.
Anything else?