[RFC] allow fulltext to be more dynamic
Robert Collins
robertc at robertcollins.net
Mon Nov 27 20:18:10 GMT 2006
On Mon, 2006-11-27 at 16:16 +0300, Dmitry Vasiliev wrote:
> John Arbash Meinel wrote:
> > Dmitry Vasiliev wrote:
> >> John Arbash Meinel wrote:
> >>> + self._max_delta_chain = 200
> >>> +
> >> Isn't it better to always define such a constants at the class
> level?
> [skip]
> > At least that is what I've understood from Martin and Robert. They
> don't
> > really like having class level definitions which can be overridden
> per
> > object and accessed as 'self._max_delta_chain'.
>
> Hmm, have a default value at class level (which shared by all the
> objects) and
> override it per objects is a known pattern in Python world.
It is, but its also a feature which requires relatively deep knowledge
of how classes and objects are implemented in python, which reduces the
clarity of the code (its harder to predict), and introduces the
opportunity for bugs which simply cannot exist if you dont use that
idiom.
I find its much easier to explain to folk that are not conversant in the
intricacies of pythons name resolution, and also in what the ' = '
operator actually does what code is doing if a variable 'self.X' always
refers to either a bound method, or something set during __init__, and
'Class.X' always refers to either a method, or a class wide variable
which non of the members have per-instance values for.
I'd actually like to make sure we have something on this in HACKING.
Martin, what do you say?
-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061128/b9f0cd2a/attachment.pgp
More information about the bazaar
mailing list