Tim Chase <[EMAIL PROTECTED]> wrote:
> The parser also has to accomodate "raw" and "unicode" string
> prefixes, as they're valid too:
>
>def f(x):
> r"raw!"
> pass
>
>def f(x):
> u"Unicode"
> pass
>
>
> in addition. Okay...in most of these cases, the pathological
> The original request was to do it without using the function's
> name, but you are depending on that name so your code is easy
> enough to break. e.g. change the definition of f1 to:
>
>def f2(func):
> "this is f1"
> s = func()
> print s
> return s
>f1 = f2
>del f
Tim Chase <[EMAIL PROTECTED]> wrote:
>> So basically, my question is: is there a way to access a function from
>> within itself without using its name?
>
>
> Well, I don't know if it's the best way to do it, but the
> following code I just threw together does the trick for me:
The original req
> The subject of this message might be a little cryptic, so here's an
> example of what I mean:
>
> def foo():
> """doc string of foo"""
> print foo.__doc__
>
foo()
> doc string of foo
>
> What I want to know is whether it is possible to call __doc__ against
> some builtin method, l
SanPy <[EMAIL PROTECTED]> wrote:
> So basically, my question is: is there a way to access a function from
> within itself without using its name?
>
Not really, no. Python is executing a code block, it has no idea which
function referenced that code block.
You can get the current code object qui