It's just a small issue...
The section "Initializing the objects" of the documentation mentions
that, in order to customize the initialization code, one should
override the _init method:
"In general, you should not touch __init__. Instead use the _init
method, which is called after an object is fetched or inserted. This
method has the signature _init(self, id, connection=None,
selectResults=None), though you may just want to use _init(self,
*args, **kw)."
What the doc doesn't tell is that, if you write a new _init method,
you have to call the old one. Of course, one may say that this is
obvious, but I found it strange for two reasons:
-- I wrongly assumed that it was a hook for user customization, partly
due to the way the documentation is written. It mentions "override",
not "inherit". (we can debate for ages the meaning of "override" in
that context, but that was my interpretation).
-- I also interpreted the use of a generic signature as a sign that
the method really didn't care about what gets passed to it, and that I
could just use that information for my own business.
I suggest one simple ammendment to the documentation, just to make
clear that the standard _init has to be called, preferably _before_
one does anything else.
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: car...@gm...
mail: car...@ya...
|