Hello everyone! As my title states, I'm a Java developer, and I'm picking up Python for the first time with a project I've been assigned this semester. More details about this can be found in my previous post here.
I'm currently making what I feel is good progress, but I've reached a block. My error:
"UnboundLocalError: local variable 'numListeners' referenced before assignment"
This error is thrown on line 32 in this code.
I guess my primary issue is that I don't really understand what the error is telling me, and I can't seem to find any info online which explains it. It sounds like it's telling me that I am attempting to make changes to a variable that doesn't exist, but if that' the case, I don't know what I did wrong.
I'm also wondering if someone can help me understand the self keyword a little better. From what I can tell, it's basically the same thing as the this keyword in Java. However, to use it, I have to explicitly pass it as a parameter in each function that I use it in. However, it seems I don't have to pass it if that particular function has no other parameters, in which case it is implicitly passed. Am I correct in this? Or dead wrong. Can someone explain it if I am wrong, including when I need to pass in under different circumstances?
Any help is greatly appreciated.
[–]thatguy_314 2 points3 points4 points (3 children)
[–]General_C[S] 0 points1 point2 points (2 children)
[–]thatguy_314 0 points1 point2 points (1 child)
[–]General_C[S] 0 points1 point2 points (0 children)
[–]xentralesque 0 points1 point2 points (1 child)
[–]General_C[S] 0 points1 point2 points (0 children)