A design problem I met again and again.

andrew cooke andrew at acooke.org
Sat Apr 4 14:32:00 CEST 2009


andrew cooke wrote:
[...]
>>> > #=========================
>>> > def start(type, id):
>>> >     if(type == "XXX"):
>>> >         pass
>>> >     else if(type == "YYY"):
>>> >         pass
>>> > #=========================

i just realised i am assuming type is a type of an object, but you might
be using it to mean something else here, in which case case my advice
might be irrelevant (but not necessarily - the value of type might still
depend on an object type in some way, and often does in oo programming).

andrew




More information about the Python-list mailing list