I'm new to python and having some troubles comming off java's very strict and formal OO approach. why does the following code snippet below throw this error, when I'm trying to call GenerateMoves() on an object?
NameError: global name 'CheckIfRegularMove' is not defined

i am trying to call the function CheckIfRegularMove inside of GenerateMoves
how do i call functions inside of a class in python? and a little of background if possible.
thank you in advance

class Position:
    def __init__(self):

    def GenerateMoves(self):
        moves = []
        #upper L moves:
        if CheckIfRegularMove((2,-1)):
            print "Yeyeyeah"
    def CheckIfRegularMove(self,move):
        tmp = (self.Loaction[0] + move[0], self.Loaction[1] + move[1])
        tuple = (0,1,2,3)
        if tmp[0] in tuple and tmp[1] in tuple:
            return True
        return False

i wish i could delete this post :( i was missing a self refernce at CheckIfRegularMove() call.
Thanks anyone considering my problem.

commented: Don't worry about it. +3

Your exploration could aid other folks. Just remember that Python style recommends to have class names begin with upper case and function/method names to begin with a lower case letter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.