Open exander77 opened 3 years ago
I should add that for class methods, standard practice is for the first parameter to be named "cls", so this also fails for common class methods.
@lucianolev thanks, that's a more useful reason to fix this up, as soon as I have some time to spare on this even if at the moment I'm not using it.
@azazel75 Thanks! If you guide me, maybe I can try to fix it. Do you think it's a deep change or something relatively easy to change?
No, it's not deep: the check is here https://github.com/metapensiero/metapensiero.pj/blob/6c6cd34a38989bbd10050c33e401111fdc4d8d18/src/metapensiero/pj/transformations/classes.py#L162 which is where classess gets translated and then it's used into the function translator here https://github.com/metapensiero/metapensiero.pj/blob/6c6cd34a38989bbd10050c33e401111fdc4d8d18/src/metapensiero/pj/transformations/functions.py#L81 . The function translator is the same as the method translator and differentiates the two using two methods:
class
ast node;self
.now, the latter may seem silly, but it may be a simple way to "do the right thing" in some corner cases. Unfortunately I don't remember what those are and if the testing checks them. But really may be sufficient just to "relax" the check to not raise the error :stuck_out_tongue_winking_eye:
Its been a few years sense an update to the repo so I'm no sure if this is still active or not. But I am still seeing this issue when I try to convert a python script.
Self-reference does not need to be named self but can have any name, that's why We write it there. If it was always self there would be no point to write it there.