[Tutor] Descriptors api doubt

Karthik Gurumurthy karthikg@aztec.soft.net
Tue, 15 Jan 2002 09:41:45 +0530


quoting from ,
http://www.amk.ca/python/2.2/index.html#SECTION000320000000000000000

>>
For example, when you write obj.x, the steps that Python actually performs
are:

descriptor = obj.__class__.x
descriptor.__get__(obj)
>>


This is what i did:

class test(object):
	def __init__(self):
		self.name = "python"

>>> t = test()
>>> desc = t.__class__.name
Traceback (most recent call last):
  File "<pyshell#15>", line 1, in ?
    ob = t.__class__.name
AttributeError: type object 'test' has no attribute 'name'
>>>

if python does that internally, then why am in not able to access the
descriptor
corresponding to "name". is it named something different?

The article says the descriptors live inside clas objects.
Does that mean they are static members ? or is something totally different?

thanks,
karthik.