Function attributes

Krister Svanlund krister.svanlund at gmail.com
Wed Feb 10 15:46:00 CET 2010


On Wed, Feb 10, 2010 at 2:59 PM, Muhammad Alkarouri
<malkarouri at gmail.com> wrote:
> Hi everyone,
>
> What is the simplest way to access the attributes of a function from
> inside it, other than using its explicit name?
> In a function like f below:
>
> def f(*args):
>    f.args = args
>    print args
>
> is there any other way?
> I am guessing the next question will be: should I really care? It just
> feels like there should be a way, but I am not able to verbalise a
> valid one at the moment, sorry.
>
> Regards,
>
> Muhammad Alkarouri
> --
> http://mail.python.org/mailman/listinfo/python-list
>

This sounds like something you shouldn't be doing. You should probably
use a class instead.

(Sending again to get it on the list >_<)



More information about the Python-list mailing list