[RFC] allow fulltext to be more dynamic

Dmitry Vasiliev lists at hlabs.spb.ru
Wed Nov 29 15:40:46 GMT 2006


Robert Collins wrote:
> On Mon, 2006-11-27 at 16:16 +0300, Dmitry Vasiliev wrote:
>> John Arbash Meinel wrote:
>> 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.

Sometimes you just need to use this idiom and BTW in the Bazaar codebase 
there's more error prone idioms like lazy import for example.

> 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?

I understand your arguments, but we should be careful to not abuse the code 
conventions.

-- 
Dmitry Vasiliev (dima at hlabs.spb.ru)
     http://hlabs.spb.ru




More information about the bazaar mailing list