Confused with methods

Fredrik Lundh fredrik at pythonware.com
Mon Feb 7 13:47:17 EST 2005


"jfj" <jfj at freemail.gr> wrote:

>> u = DoSomethingWithCallback(A().callback)
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Oops!!!
> I think it would be more obvious to somebody who doesn't know
> the python internals, to say:
>  # take the callback from A and install it to DSWC
>  u=DoSomethingWithCallback( A.callback)

that's not the same thing.

>  u=DoSomethingWithCallback (A().callback.im_func)

that's not the same thing.

>  u=DoSomethingWithCallback (A().im_class.callback)

that's not the same thing.

if you cannot tell the difference between a class and an instance, you should
spend more time learning how Python works, and less time telling everyone
how things can be made more "obvious".

</F> 






More information about the Python-list mailing list