jf...@ms4.hinet.net wrote:
> I study some codes of a tutorial about tkinter
>
> [snip code]
>
> My question is that the object which was left by
> callit(self.demoenter_callback, tag) is a callit instance,
> and the method it calls is a DemoMainWindow's method. How
> it is possible?

Why would it _not_ be possible? Functions are first class
objects, after all. Google it.

All the code is doing here is passing around a function
reference and argument list like a baton in a foot race. No
real magic here, just a lot of academic smoke and mirrors
really. Or maybe this is more like a rat maze? Or a hot
potato? Opinions may vary...

But short of obfuscation for the _sake_ of obfuscation, i
don't understand what the tutorial author is intending to
teach you here. Sheesh, the same goal could be achieved much
more clearly by wrapping the argument-laden callback in an
anonymous function or using a functools.partial, as the
_true_goal_ here is to avoid premature execution of the
argument-laden callback.

I absolutely detest superfluity!

--
>>> import this
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to