Function attributes

Stephen Hansen apt.shansen at gmail.com
Wed Feb 10 10:56:37 EST 2010


On Wed, Feb 10, 2010 at 6:36 AM, Steven D'Aprano <
steve at remove-this-cybersource.com.au> wrote:

> On Wed, 10 Feb 2010 05:59:41 -0800, Muhammad Alkarouri wrote:
> > 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
>
> Not built-in.
>
> > 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.
>
> I completely agree with you. It is a wart that functions are only able to
> refer to themselves by name, because if the name changes, things break.
>

I agree its slightly... in-elegant, or sub-optimal, but I'm not sure I want
to call it a *wart*. If one calls it a wart, there might be inspiration to
fix it.

And this sounds like a precursor to making "self" non-explicit, and I
*really* like my explicit self. :)

Then again, I have been slightly bruised by this sub-optimal situation
before.

I tried to do a function using a frame hack to get the information easily,
but failed. My long years of avoiding frame hacks like the plague have left
me deficient. :(

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100210/4a46c9c6/attachment-0001.html>


More information about the Python-list mailing list