I think the "signal.decorate" form is nicer, but the name has to show
that there is some sort of connection going on; if you want to know
why I think this is, take a look at "The Zen of Python". Basically,
it's explicit (you know it refers to *that* signal), it's the obvious
way to do it (seeing as we can actually edit the "Signal" class's
source code, adding this as a method), and it's substantially more
beautiful and explicit. That's what I think, anyway.

Plus, we don't write it as signal_connect(signal, receiver). We write
it as signal.connect(receiver). It's more compact, explicit, beautiful
and obvious.

The thing is, can we actually change the 'connect' method, or are we
going to give this a new name?

Regards,
Zack


On Sep 14, 12:19 am, Ludvig Ericson <[EMAIL PROTECTED]> wrote:
> On Sep 12, 2008, at 13:01, zvoase wrote:
>
> > I think the principle of least surprise applies here. It would be very
> > easy just to implement __call__ as a decorator, but by the same token,
> > the signal needs to be used from both ends, and the addition of a
> > __call__ method may confuse some people. As with most problems in
> > programming, we just end up discussing the name :)
> > IMHO, I think the removal of ambiguity is worth the extra 8
> > characters. If we make a decision (by informal vote), then I'll just
> > go ahead and implement it, and then we just need someone to commit to
> > SVN.
>
> Yes, so if we decide to go ahead and include decorator functionality, we
> have two ways to go:
>
>   [EMAIL PROTECTED]
>    def f(...): ...
>
> - or -
>
>   [EMAIL PROTECTED](signal)
>    def f(...): ...
>
> I'm not sure which is more Pythonic or which I prefer, considering  
> Python
>   mixes and matches these two styles. (math.sqrt, str.encode, etc.)
>
> Ludvig Ericson
> [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to