Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; "'',": 0.07; 'append': 0.07; 'completeness': 0.07; 'main()': 0.07; 'python': 0.09; 'lst': 0.09; 'objects.': 0.09; 'received:155': 0.09; 'repr': 0.09; 'subject:using': 0.09; 'def': 0.10; 'blocks': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'subject:class': 0.16; 'type:': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'version.': 0.17; '>>>': 0.18; 'code.': 0.20; 'to:name:python- list@python.org': 0.20; 'trying': 0.21; 'smallest': 0.22; 'this:': 0.23; 'seems': 0.23; 'received:169.254': 0.24; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'guess': 0.27; 'accuracy': 0.27; 'subject:list': 0.28; 'post': 0.28; 'appending': 0.29; 'prints': 0.29; 'str': 0.29; 'received:169': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'usually': 0.30; 'returned': 0.30; 'version,': 0.30; 'helpful': 0.30; 'code': 0.31; 'point': 0.31; 'problem.': 0.32; 'addresses': 0.32; 'print': 0.32; 'getting': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'themselves': 0.33; 'another': 0.33; 'text': 0.34; 'list': 0.35; 'whatever': 0.35; 'expected': 0.35; 'posting': 0.35; 'something': 0.35; 'list.': 0.35; 'but': 0.36; 'method': 0.36; 'charset:us- ascii': 0.36; 'being': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'shows': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'help': 0.40; 'your': 0.60; 'skip:a 30': 0.60; 'most': 0.61; 'you.': 0.61; 'containing': 0.61; '(that': 0.62; 'provide': 0.62; 'helps': 0.63; 'p.s.': 0.63; 'information': 0.63; 'information,': 0.63; 'url:email': 0.63; 'dont': 0.64; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'received:169.254.8': 0.84; 'subject:Appending': 0.84; 'suspicion': 0.84 X-DKIM: OpenDKIM Filter v2.1.3 sj3.jpmchase.com q9PJ75HS024058 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1351192025; bh=xtUfVva2WIDsjK05BrFw0lkIwId0Z0jLI41bCn9pdAI=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=rVf26rWrjGrVWUtcoCnUaCzCS4rRTfEsS+wq+1xTsvsppkKGHnyw3YSNhSLJS8QnN 2GhPMZjKiK6EOK5FMUs+38ddFrIbPTmVzK93FFKF8yYJTxwHh/MtllZq221oAvz0M6 L0nSqktwaddhoMquQZ3mXzDGwYfpt8Kq2s6jfMDY= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: Appending a list using list obtained from a class Thread-Topic: Appending a list using list obtained from a class Thread-Index: AQHNsfUTgRThgLzQNECBK6tDGWLKppfIyoyAgAAA5gCAAAGJAIAAAs2AgAABKACAAY5tAA== Date: Thu, 25 Oct 2012 19:06:54 +0000 References: <1BA49B0B-47E0-4683-9A49-FC2DFCC5C7C2@gmail.com> <65ED09AC-A4A5-4502-BF39-F665F25F96A8@gmail.com> In-Reply-To: <65ED09AC-A4A5-4502-BF39-F665F25F96A8@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351192034 news.xs4all.nl 6890 [2001:888:2000:d::a6]:53938 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32154 Demian Brecht wrote:=0D=0A> On 2012-10-24, at 8:00 AM, inshu chauhan wrote:=0D=0A> =0D=0A> > Yes, a Class method returns a l= ist=2E I am trying to append this in main() to make another list=2E=0D=0A> = > But the list i am getting after appending i showing addresses like this '= <__main__=2EPoint object at=0D=0A> 0x0254FAB0>' but if i print the same in = the same loop its showing me numbers which i want=2E Why I dont know ??=0D= =0A> =0D=0A> If you can, please post the relevant blocks of code=2E That'll= be a tremendous help in figuring out your problem=2E=0D=0A> =0D=0A=0D=0AI = would like to re-iterate that posting the relevant code is very=0D=0Ahelpfu= l and the best way for us to help you=2E Everything below is an=0D=0Aeducat= ed guess based on the information you provided=2E=0D=0A=0D=0A=0D=0ABased on= the text '<__main__=2EPoint object at 0x0254FAB0>', it seems=0D=0Alike the= object being returned is most likely NOT a list but instead a =0D=0APoint = class that is iterable=2E Either that or it is a list of Point =0D=0Aobject= s=2E To find out exactly, try something like this:=0D=0A=0D=0Alst =3D # wha= tever your class is returning=2E=0D=0Aprint 'LIST - type : ', type(lst) '\t= repr: ', repr(lst), '\tstr :', str(lst)=0D=0Afor p in lst[-1:]:=0D=0A pr= int 'POINT - type: ', type(p) '\trepr: ', repr(p), '\tstr :', str(p)=0D=0A= =0D=0AMy suspicion is that when you print the list containing=0D=0Apoints/a= ddresses it prints the repr version=2E When you print the =0D=0Apoints/addr= esses themselves it prints the str version=2E=0D=0A=0D=0A>>> class t(object= ):=0D=0A=2E=2E=2E def __str__(self):=0D=0A=2E=2E=2E return 'str= '=0D=0A=2E=2E=2E def __repr__(self):=0D=0A=2E=2E=2E return 'rep= r'=0D=0A=2E=2E=2E =0D=0A>>> a =3D t()=0D=0A>>> print [a] =0D=0A[repr]= =0D=0A>>> print a=0D=0Astr=0D=0A>>> print a=2E__class__=2E__base__=2E__repr= __(a)=0D=0A<__pieshell__=2Et object at 0x11B28F10>=0D=0A=0D=0AHope that hel= ps you to understand what is going on=2E=0D=0A=0D=0ARamit Prasad=0D=0A=0D= =0AP=2ES=2E Usually it is best to specify, Python version, OS version,=0D= =0Aexpected input/output, and the smallest code sample you can provide=0D= =0Athat shows the problem (that any reader of your message can run)=2E=0D= =0AThis email is confidential and subject to important disclaimers and=0D= =0Aconditions including on offers for the purchase or sale of=0D=0Asecuriti= es, accuracy and completeness of information, viruses,=0D=0Aconfidentiality= , legal privilege, and legal entity disclaimers,=0D=0Aavailable at http://w= ww=2Ejpmorgan=2Ecom/pages/disclosures/email=2E