views:

21

answers:

1

When defining a Signal in Django, should you specify qualitative temporal information such as pre and post in the name of the Signal, or as an argument? If as an argument, what range of values should you use?

For instance, say I want to define Signals before and after an operation X, one way is:

pre_x_signal = Signal(providing_args = ['foo', ])

post_x_signal = Signal(providing_args = ['foo', ])

and the alternative is:

x_signal = Signal(providing_args = ['foo', 'stage', ])

where stage takes values in some range, e.g. ['pre', 'post', ]

Depending on the choice, different lookup logic will be followed both by Django and by your code, so how will this impact performance?

A: 

Given that you haven't had an answer to this for a full week, I'd suggest you're probably not going to get a definitive one any time soon.

So, like all performance issues, I'd recommend contriving a test and doing an experiment! The theoretical performance of any system is always going to differ from the observable fact. Write a test comparing the two approaches you're interested in and try it! Even better, post the results here (or to some Django-users list?) so that you can forever provide a reasonable answer to this question.

Gian