On Mar 21, 8:47 pm, "gtb" <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> Don't know the daily limit for dumb questions so I will ask one or
> more.
>
> In a function I can use the statement n =
> sys._getframe().f_code.co_name to get the name of the current
> function. Given that I can get the name ho
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|| Peter is trying to communicate that some aspects of Python are
| quite conservative, well-documented, and unlikely to change
| across versions or implementations. The syntax of, let's say,
| "def", is an example of su
In article <[EMAIL PROTECTED]>,
gtb <[EMAIL PROTECTED]> wrote:
>On Mar 21, 3:35 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
.
.
.
>> >>> import sys
>> >>> def docstring():
>>
>> ... return sys._getframe(1).f_code.co_consts[0
On Mar 21, 3:35 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> gtb wrote:
> > In a function I can use the statement n =
> > sys._getframe().f_code.co_name to get the name of the current
> > function. Given that I can get the name how can I print the __doc__
> > string? I cant use the following, it wi
On Mar 21, 3:11 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "gtb" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | Greetings,
> |
> | Don't know the daily limit for dumb questions so I will ask one or
> | more.
> |
> | In a function I can use the statement n =
> | sys._getfram
gtb wrote:
> In a function I can use the statement n =
> sys._getframe().f_code.co_name to get the name of the current
> function. Given that I can get the name how can I print the __doc__
> string? I cant use the following, it will tell me to bugger off as the
> string has no such attribute.
>
>
"gtb" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Greetings,
|
| Don't know the daily limit for dumb questions so I will ask one or
| more.
|
| In a function I can use the statement n =
| sys._getframe().f_code.co_name to get the name of the current
| function. Given that I can
This will work, but I'm getting out of my depth as to whether its a good
idea to do or not.
import sys
def testFunc():
''' Here is my doc string'''
n = sys._getframe().f_code.co_name
print eval(n).__doc__
testFunc()
The issue being that n is a simply a string containing the name of th
Greetings,
Don't know the daily limit for dumb questions so I will ask one or
more.
In a function I can use the statement n =
sys._getframe().f_code.co_name to get the name of the current
function. Given that I can get the name how can I print the __doc__
string? I cant use the following, it will