Calling functions before that are def'ed

Batista, Facundo FBatista at uniFON.com.ar
Mon Sep 22 17:28:48 EDT 2003


#- Is there a way to define functions after the main part of a Python
#- script?

You don't need this.

I wanted the same thing when started with Python (came from C), but this
implies a poorly modular design.

Better:


#!/usr/bin/env python


def mymain(...):
	...

def func1(...):
	...

def func2(...):
	...

def func3(...):
	...

def func4(...):
	...



# This is the main part
#Very few basic controls about argv, etc...
...
...
mymain(...)


And consider that you're not programming OO.

.	Facundo





More information about the Python-list mailing list