Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60660
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: error |
| Date | 2013-11-27 21:30 -0500 |
| References | <f72cc61d-eb91-459a-8099-3e2b1be743ec@googlegroups.com> <f72cc61d-eb91-459a-8099-3e2b1be743ec@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3335.1385605784.18130.python-list@python.org> (permalink) |
On Wed, 27 Nov 2013 16:37:37 -0800 (PST), speen saba <moonlightmadness86@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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
error speen saba <moonlightmadness86@gmail.com> - 2013-11-27 16:37 -0800 Re: error Cameron Simpson <cs@zip.com.au> - 2013-11-28 11:55 +1100 Re: error Dave Angel <davea@davea.name> - 2013-11-27 21:30 -0500
csiph-web