Michael, > >>> def say(start, finish, **kwargs): > > ... print kwargs > ...>>> say(finish="world", start="hello") > > {}
Yes, I'm a big fan of named parameters. I've often wished that what you wrote above worked as well. It would often be nice if the required parameters were also included in the kwargs dictionary. But as much as that would simplify some scenarios, I can see how it would certainly complicate others. > and jumping Kamaelia's support to 2.5 onwards by default. (Not suggesting > 2.6 at present since there's a wide variety of libs we use that are still > at 2.5 as well) Compatibility is good. Being up to date is nice too. I've been doing less with Kamaelia lately and a lot with Google App Engine (2.5.2) and I've been really missing the built-in named tuples from 2.6. > > class Port80Client_Declarative(TCPClient): > > port = 80 > > def __init__(self, host, **kwargs): > > kwargs.setdefault("port", self.port) > > kwargs['host'] = host > > # Or if >= py 2.4 > > # kwargs.update(host=host) > > super(Port80Client_Declarative, self).__init__(**kwargs) > > > class KamaeliaWebsiteClient_Declarative(Port80Client): > > # this variation moves the default declaration fully into the init > > def __init__(self, **kwargs): > > kwargs.setdefault("host", "www.kamaelia.org") > > super(KamaeliaWebsiteClient_Declarative, self).__init__ > > (**kwargs) > > ... I'd like to fix up my utilities to use these idioms. Stylistically, do you prefer the first or second version of class provided defaults. To simplify: class A(Parent): default = 'default' def __init__(self, required, **kwargs) kwargs.setdefault('default', self.default) kwargs['required'] = required super(A, self).__init__(*kwargs) #OR class B(Parent): def __init__(self, required, **kwargs) kwargs.setdefault('default', 'default') kwargs['required'] = required super(A, self).__init__(*kwargs) I think B requires less typing and removes a mental indirection, but I think style A might make it easier to spot the defaults. > Kamaelia/Apps/SA/ ... > Incidentally, I view this namespace Kamaelia.Apps.SA - as owned by you - so if > you don't like the names here, please let me know. If you're happy with these > as a starting point though, let me know, and I'll merge those into trunk in > that location. If you're not and want to modify it, please either mirror > locally and send patches or let me know your google code ID, and I'll grant > you access for editting what is essentially your code :-) I think that location is fine. Thank you. I would like to get SVN access to the branch though, if possible. I'm pretty tickled with set up I have for pulling SVN repos into my mercurial tree. I'd like SVN access if for no other reason that to give me an excuse to get the mercurial -> SVN process working. > (This is part of a wider plan intended to make code contribution simpler, > easier, more diverse and less dependent on me - with more than a little > flagrant idea stealing from CPAN/CTAN :-) Sounds good to me. And thank you! --Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "kamaelia" group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~----------~----~----~----~------~----~------~--~---