Confused by Method(function) of a module and method of a class/instance

Sullivan WxPyQtKinter sullivanz.pku at gmail.com
Tue Mar 7 07:22:52 CET 2006


In python, these expression seems yields the same result:

inputstring='ABC'

print inputstring.lower()
print lower(inputstring)
print string.lower(inputstring)

result:
abc
abc
abc

Question:
Is the method lower() just a method for the inputstring instance( an
instrance object of a string class object), or a function in the module
string.py or a build-in function or sth else?

Why do the three expression yield the same result "abc"?




More information about the Python-list mailing list