At Wednesday 27/12/2006 20:37, Pyenos wrote:
class Model:
def fuck(self):print "fuck!"
class View:
Model() #this part is fine
class Controller:
def __init__(self):
self.Model=Model()
Controller().Model.fuck() #actually slight problem in previous solution
Has to call in this way. I have confirmed this works.
The Model() inside View is *not* fine - you construct a Model
instance just to discard it! Besides some side effects that
constructing a Model() might have, this is useless.
If you are trying to implement a real MVC, usually the model exists
by itself even before you need the view, so usually the view
constructor gets the model as an argument.
I prefer to use lowercase attribute names: self.model = Model(), this
way there is no confusion between model (an instance) and Model (a class).
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
--
http://mail.python.org/mailman/listinfo/python-list