Aaron Brady <[EMAIL PROTECTED]> writes:

>  Furthermore, some class models variables like this:
>
> a.b= 'abc'
> a.c= 'def'
> a.d= 'ghi'
>
> It also allows index access: a[0], a[1], a[2], respectively.  'abc'
> has two names: 'a.b', and 'a[0]'.  Correct?

You know very well that a.b and a[0] aren't names, they are function
calls written in short hand ;)

a.b   is   getattr(a, 'b')
a[0]  is   getattr(a, '__getitem__')(0)

So they just return an object, which happens to be the same :)

-- 
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to