[merge] Registry
John Arbash Meinel
john at arbash-meinel.com
Thu Oct 12 09:38:12 BST 2006
Martin Pool wrote:
> On 11 Oct 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
>> It seems like it would be very, very common to do
>>
>> obj = registry.get(key)(arg1, arg2, ...)
>>
>> Is it worth supporting this explicitly?
>
> Maybe, but yagni for now I think.
>
>> I'm a little uncomfortable with the 'info' idea. It seems like, for a
>> given registry, you'd want to have the same 'info' about all registered
>> objects. If you were registering Commands, you might want to register
>> aliases, parameters, options, and help. Whatever you registered, you'd
>> want it to be consistent. Wouldn't it be better for a each registry to
>> have its own Info type?
>
> or, alternatively, have a subclass
>
> class CommandRegistry(Registry):
> def get_command_parameters(self, command_name):
> return self.get_info(command_name)['parameters']
> # or
> return self.get_info(command_name).parameters
>
I was thinking to do something along the lines of a subclass. Since it
helps ensure that the parameters are correctly supplied.
John
=:->
More information about the bazaar
mailing list