error

Dave Angel davea at davea.name
Wed Nov 27 21:30:20 EST 2013


On Wed, 27 Nov 2013 16:37:37 -0800 (PST), speen saba 
<moonlightmadness86 at gmail.com> wrote:
> p = [1,2]

> And below is the error. Evrything works fine untill class polar 
point, but when I try to pick point (instance) p in the list i.e x,y 
(1,2,3,1). It does not work. I mean p.x gets the error where it 
should give me the value of x. And i know this error will go all the 
way down to def__cmp if i dont fic it from top.

>    >>> p.x

> Traceback (most recent call last):
>   File "<pyshell#46>", line 1, in <module>
>     p.x
> AttributeError: 'list' object has no attribute 'x'

You have 4 different implementations, but you're mixing the first 
with the others.  Since p is a list, you need to use list semantics,  
p [0] and p [1]. The .x attribute is not defined on a list.

-- 
DaveA




More information about the Python-list mailing list