Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'assign': 0.04; 'completeness': 0.05; 'subject:Python': 0.05; 'combines': 0.09; 'foo': 0.09; 'giant': 0.09; 'not?': 0.09; 'pointers': 0.09; 'argument': 0.15; 'skip:" 40': 0.15; 'to:name:python- list@python.org': 0.15; '1234': 0.16; '712': 0.16; 'arrays.': 0.16; 'assigns': 0.16; 'blah': 0.16; 'currencies': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'expected,': 0.16; 'feature?': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:155.180.234.122': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:se3.svr.bankone.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'language': 0.16; 'arguments': 0.18; 'perl': 0.18; 'seems': 0.20; 'header:In-Reply-To:1': 0.22; 'assume': 0.22; 'feature.': 0.23; 'pascal': 0.23; 'elements': 0.24; 'explains': 0.24; 'code': 0.26; 'lists': 0.28; 'received:169': 0.28; 'received:169.254': 0.28; "i'm": 0.28; 'pass': 0.29; 'print': 0.29; 'arrays': 0.30; 'received:155': 0.30; 'received:159': 0.30; 'values': 0.32; 'accuracy': 0.32; 'remaining': 0.32; 'does': 0.32; 'list': 0.32; 'there': 0.33; "can't": 0.33; 'it.': 0.33; 'instead': 0.33; 'test': 0.34; 'header:Received:8': 0.34; 'function.': 0.34; 'principle': 0.34; 'to:addr:python-list': 0.35; 'phone:': 0.35; 'list.': 0.35; 'two': 0.36; 'but': 0.37; 'reference': 0.37; 'charset:us-ascii': 0.37; 'skip:" 10': 0.37; 'references': 0.38; 'allows': 0.38; 'some': 0.38; 'should': 0.38; 'missing': 0.40; 'to:addr:python.org': 0.40; 'simple': 0.61; 'subject': 0.61; 'design': 0.61; 'offers': 0.62; 'ever': 0.64; 'imagine': 0.66; 'dealing': 0.69; 'information,': 0.69; 'legal': 0.72; 'url:email': 0.72; 'bank': 0.75; 'sale': 0.75; 'investment': 0.77; 'purchase': 0.78; 'received:169.254.8': 0.84 X-DKIM: OpenDKIM Filter v2.1.3 sf3.jpmchase.com q2GH1gGf000866 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=jpmorgan.com; s=smtpout; t=1331917302; bh=kALYCVxpF+Aadk48aGCC427+ehy9HOzGN/OXC56N/kk=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=nip938Wbr1ja5sfK+0on/j0mM1nh68ZyCvd6G4l55dHXow1hMyVQ2umMad1qeLklC 38yJL/6La2bua/FIPSsQricy53xp1pp2kJoCbFRzcx/KmJQHl8OKYjQfzK9Z1XERxH ZclcbS4HYC0iZs2CLAUscQCuy9jbIbx8KQhB6gck= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: Python is readable Thread-Topic: Python is readable Thread-Index: AQHNA5FoI0igWUD8KUmFecuUiL1EB5ZtHn0Q Date: Fri, 16 Mar 2012 17:01:28 +0000 References: <4f612b19$0$1379$4fafbaef@reader2.news.tin.it> <4f629d27$0$29981$c3e8da3$5496439d@news.astraweb.com> <4f63382b$0$1375$4fafbaef@reader1.news.tin.it> <4f63697c$0$29981$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <4f63697c$0$29981$c3e8da3$5496439d@news.astraweb.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.38] 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.12 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331917304 news.xs4all.nl 6897 [2001:888:2000:d::a6]:33896 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21765 > >> I don't understand the reason for $arg1 and $arg2=2E Is there some rea= son=0D=0A> >> why the code couldn't do this instead?=0D=0A> >>=0D=0A> >> = my(@list1, @list2) =3D @_;=0D=0A> >=0D=0A> > @_ contains references t= o arrays=2E You can't pass two arrays to a=0D=0A> > function=2E=0D=0A> =0D= =0A> =0D=0A> Why ever not? That seems like basic functionality to me=2E I c= an't imagine=0D=0A> any modern language that lacks such a simple feature=2E= Even Pascal allows=0D=0A> you to pass arrays as arguments to functions=2E= =0D=0A> =0D=0A> Is there some design principle that I'm missing that explai= ns why Perl=0D=0A> lacks this feature?=0D=0A=0D=0A=0D=0AMy understanding is= that it assigns each scalar argument until it finds a list=0D=0Ato assign = and then it assigns everything remaining to the list=2E=0D=0A=0D=0Amy @arr = =3D ( 'test', 'blah', '1234', 'boop', 'foo', 'bar' );=0D=0Amy @arr2 =3D ( '= adsf', 'qwerty' );=0D=0Aprint "@arr\n";=0D=0Amy @arr3 =3D (@arr, @arr2);=0D= =0Aprint "arr3:@arr3\n";=0D=0Amy ($arg1, $arg2, @arg3) =3D @arr3;=0D=0Aprin= t "arg3:@arg3\n";=0D=0A=0D=0Abash-3=2E2$ perl temp=2Epl=0D=0Atestblah1234bo= opfoobar=0D=0Aarr3:test blah 1234 boop foo bar adsf qwerty=0D=0Aarg3:1234 b= oop foo bar adsf qwerty=0D=0A=0D=0A=0D=0AI assume this is because it combin= es both elements of the list into one =0D=0Agiant list and then if you try = and assign two lists it does not know=0D=0Awhere to split it=2E Now if you = pass a reference to the two arrays instead =0D=0Aof the values it should wo= rk as expected, but now you are dealing with pointers / =0D=0Areferences=2E= =0D=0A=0D=0A=0D=0Abash-3=2E2$ cat temp=2Epl=0D=0Amy @arr =3D ( 'test', 'bla= h', '1234', 'boop', 'foo', 'bar' );=0D=0Amy @arr2 =3D ( 'adsf', 'qwerty' );= =0D=0Aprint "@arr\n";=0D=0Amy @arr3 =3D (\@arr, \@arr2);=0D=0Aprint "arr3:@= arr3\n";=0D=0Amy ($arg1, $arg2, @arg3) =3D @arr3;=0D=0Aprint "arg1:@$arg1\n= arg2:@$arg2\narg3:@arg3\n";=0D=0A=0D=0Abash-3=2E2$ perl temp=2Epl=0D=0Atest= blah 1234 boop foo bar=0D=0Aarr3:ARRAY(0xb2f0f90) ARRAY(0xb2f1020)=0D=0Aar= g1:test blah 1234 boop foo bar=0D=0Aarg2:adsf qwerty=0D=0Aarg3:=0D=0A=0D=0A= =0D=0A=0D=0A=0D=0A=0D=0ARamit=0D=0A=0D=0A=0D=0ARamit Prasad | JPMorgan Chas= e Investment Bank | Currencies Technology=0D=0A712 Main Street | Houston, T= X 77002=0D=0Awork phone: 713 - 216 - 5423=0D=0A=0D=0A--=0D=0AThis email is = confidential and subject to important disclaimers and=0D=0Aconditions inclu= ding on offers for the purchase or sale of=0D=0Asecurities, accuracy and co= mpleteness of information, viruses,=0D=0Aconfidentiality, legal privilege, = and legal entity disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan=2Ecom= /pages/disclosures/email=2E