[PATCH] Factor out duplicate code

John A Meinel john at arbash-meinel.com
Wed Oct 12 04:13:23 BST 2005


Andrew Bennetts wrote:
> On Tue, Oct 11, 2005 at 06:45:06PM -0700, Dan Loda wrote:

...

> A simpler and less fancy approach would be to add the 'create' method as you
> suggest, but just leave the if statement hard-coded in there, rather than
> mucking about with the versionable_kinds dictionary -- or do you have a
> use-case for a plugin or something that needs this sort of extensibility?

I do think that using a dictionary is the preferred method for factory, 
even if at present there aren't any ideas about how it will be extended. 
It is just much easier to add a new entry to dictionary, rather than 
tracking down another if statement.

Plus, I believe in python the dictionary lookup is faster than the if/then.

John
=:->

> 
> -Andrew.
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051011/839fc540/attachment.pgp 


More information about the bazaar mailing list