
python __main__ is similar to java main()
Well I've read the docs and searched in the newsgroup archives but
I'm still confused about __main__
I expected it to startup the program, like main in java but
when I feed it to the interpreter he just "eats" the file loads wathever
is in the file but doesn't run main.
So am I suposed to explicitly call it like in the file below or is
there a better (pythonic) way to do it??
TIA
David Nunes
import string
import PedLan
import GLOBAL
class Lancamento:
ReqID = 0
#PDNConsulta
def ___init__(self):
#inicializacao do PDNConsulta
pass
def trataPedido(self):#nao faz verificacao de input
linha = raw_input('>')
parse = string.splitfields(linha, GLOBAL.INPUTSEP)
disc = parse[0]
nomes = []
notas = []
for indice in range(1,len(parse), 2):
nomes.append(parse[indice])
for indice in range(2,len(parse), 2):
notas.append(parse[indice])
pedido = PedLan.PedLan(ReqID, nomes, notas)
#<PDNConsulta.Lancamento(pedido)
def __main__(self):
print('running')
interface = Lancamento()
while(1):
interface.trataPedido()
Lancamento().__main__() #to run main ????