[MERGE] Use slots consistently in InventoryEntry hierarchy -- regenerated against new head. Seeking another reviewer.

Jan Hudec bulb at ucw.cz
Thu Jun 1 07:28:06 BST 2006


On Thu, Jun 01, 2006 at 13:33:43 +1000, Robert Collins wrote:
> On Tue, 2006-05-30 at 23:18 +0200, Jan Hudec wrote:
> 
> 
> > I have regenerated it against new head now that the PatienceDiff passes
> > tests. The patch did not change except for line numbers and attaching blank
> > lines differently due to difflib/PatienceDiff.
> > 
> > It is still seeking another reviewer. The branch name quoted above is still
> > valid.
> 
> +1 with one further change: the kind = lambda idiom is less clear than a
> regular method based declaration:
> 
> @property
> def kind(self):
>     return 'symlink'
> 
> Etc.
> 
> unless there is a significant performance difference, please use that
> form for properties.
> 
> That said, why is this a property and not an attribute ? If its to avoid
> each type having a kind field, then just have a 'kind' slot in the base
> class, and add a 'kind=None' keyword parameter to the base __init__ :
> that will allow kind to be an attribute, and remove the duplicate effort
> of having a property in each class. It will also allow the base __init__
> to check it is given a kind and assert if it wasn't.

It was an attribute. But there is no point to have it as an instance
attribute when it's only determined by the type. I made property to make
sure it's read-only, but class attribute will probably do better.

I will also add class attributes for the type specific attributes (eg.
text_sha1 or executable) to make the interface less type-dependent and
repost.

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060601/a2e59208/attachment.pgp 


More information about the bazaar mailing list