milibopp / obsub

Small python module that implements the observer pattern via a decorator.
Other
12 stars 3 forks source link

Diffcult code line #20

Closed DanielSank closed 10 years ago

DanielSank commented 10 years ago

I am posting this issue mostly as a question to the developers because I cannot find another way to contact them.

In obsub.event.__get__ there is the following line

wrapper = functools.wraps(self.__function)(boundevent(instance, self.__function))

If I have understood everything correctly, this is equivalent to

wrapper = functools.update_wrapper(boundevent(instance, self.__function), wrapped=self.__function)

My question is, why use functools.wraps here? Is it doing something important or just used to slightly shorten the code line?

Thanks. I would like to use this module but I want to make sure I understand what it's doing.

coldfix commented 10 years ago

You got it right. Personally, I prefer the notation of the wraps function, but it's the same thing. If you have any trouble or if you got any more questions, please don't hesitate to ask.

Best regards,

Thomas

milibopp commented 10 years ago

Thanks for taking care of this, Thomas. Speaking of signature wrapping, what's going on with that black magic branch of yours?

Another way to contact us would probably be a good idea. I'll look into setting up a mailing list for that.