overriding of methods and variables in a class.

rdesetty at yahoo.com rdesetty at yahoo.com
Mon Jul 9 09:45:08 EDT 2001


I dont seem to understand why a method name and a variable name is 
allowed to be same in a class. what is the use. Most importantly, 
Assuming that we have a class as follows:

class abc
# I am going to define a variable here.
var_x = 1
# now the function with the same name as the variable with say some 
#parameter
def var_x(abc)
    return abc+1

Now the question is how do i access the variable as well as the 
function (with the same name as the variable) say from another 
function. thanx in advance.






More information about the Python-list mailing list