data attributes override method attributes?

Jayden jayden.shui at gmail.com
Tue Sep 25 09:41:43 EDT 2012


Dear All,

In the Python Tutorial, Section 9.4, it is said that

"Data attributes override method attributes with the same name."

But in my testing as follows:

#Begin
class A:
	i = 10
	def i():
		print 'i'

A.i
   <unbound method A.i>
#End

I think A.i should be the number 10 but it is the method. There must be something I misunderstand. Would you please tell me why?

Thanks,

Jayden





More information about the Python-list mailing list