Re: [myhdl-list] MEP-108 Bundle
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-06-24 16:46:45
|
On 6/15/12 4:07 AM, Jan Decaluwe wrote: > On 06/01/2012 03:35 AM, Christopher Felton wrote: > >>> I think we should have a go at MEP 108 to remove the >>> confusing "class attribute" terminology. Perhaps the >>> explanations make it less clear than just stating what >>> this MEP is about. Perhaps we should just >>> talk about a method at the top level - I understand >>> methods at lower levels already worked without this MEP. >>> >> >> Sounds good, I should have some time tomorrow to work >> through the modifications you suggested. > > About the "self" argument: the MEP says that the > implementation looks for this argument and assumes it > has the usual meaning. This is just fine with me, > provided it is the *first* argument as per convention. > Probably this is what the implemenation does? If not, > it should, and the documentation should be adapated > also. > > There are two locations in the code that were modified. First, the top-level visitor. These modifications didn't require the use of the "self". The second in the extract hierarchy , the original code uses a different mechanism (not ast) to determine if user defined code is present. The modifications here do not enforce the "self" as the first argument. The code where the changes were added uses the python profile extraction to identify a function on a return event. For a method, the "func" from the global space would be None, if that was the case then self was retrieved from the local space and funcname was checked as an attribute. What does this all mean, it means it doesn't enforce "self" to be the first position but it will only use self if it has the /function/ that it is looking for (funcname). If the code fails to find the funcname in the global space or as an attribute (method) of "self" in the localspace. I will investigate if there is a mechanism to also verify "self" is the first argument. I tried to find a means to not use "self" but with the profile extraction I was not successful. Regards, Chris |