Fall of Roman Empire

Georg Brandl g.brandl-nospam at gmx.net
Wed Dec 20 12:15:27 EST 2006


Felix Benner schrieb:

>> Sorry, somehow had to do this. Please slap me (i like it, don't worry)
>> if it's totally stupid
>> 
>> 
> 
> soooo totally stupid! You forgot the main function! (not to mention you
> returned universe instead of everything)
> 
> static int main(int argc, char **argv) {
> 	char *god_name;
> 	if (argc)
> 		god_name = argv[1];
> 	else
> 		god_name = "YHWH";
> 	metaPower God = getGodByName(god_name);
> 	universe *everything = makeUniverse(God);
> 	while (simulatePhysics(everything));
> 	return 0;
> }

Well, I'd expect God to be more clever as to do it that way.
Could you imagine toying around with your universe in C?

No, it must have been

static PyObject *
create_universe(char *god_name) {
	PyObject *universe;
	universe = PyObject_New(universetype, PyUniverse_Type);
	if (!universe) {
		PyErr_SetString(PyExc_CreationError,
			"Out of spacetime, or BDFL is too busy hacking "
			"on web-based collaboration tools");
		return NULL;
	}
	universe->un_god = PyGod_FromName(god_name);
	universe->un_size = 0;
	universe->un_expand_rate = COSMOLOGICAL_CONSTANT;
	return universe;
}

Georg



More information about the Python-list mailing list