Multi-dimensional list initialization

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri Nov 9 15:31:47 EST 2012


Dennis Lee Bieber wrote:
> 
> On Fri, 9 Nov 2012 17:07:09 +1100, Chris Angelico <rosuav at gmail.com>
> declaimed the following in gmane.comp.python.general:
> 
> > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> > > On 07/11/2012 01:55, Steven D'Aprano wrote:
> > >>
> > >>
> > >> Who knows? Who cares? Nobody does:
> > >>
> > >> n -= n
> > >>
> > >
> > > But I've seen this scattered through code:
> > >
> > > x := x - x - x
> >
> > Can you enlighten us as to how this is better than either:
> >  x := -x
> > or
> >  x := 0 - x
> 
> 	Of course, if one has a language that, for some reason, evaluates
> right-to-left (APL, anyone), then
> 
> 	x := x - x - x
> 
> becomes
> 
> 	x := x - 0
> 

Is that not the same as x:=-x?


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  



More information about the Python-list mailing list