Re: How Python works: What do you know about support for negative indices?

2010-09-13 Thread Raymond Hettinger
[Ben Finney] I encourage anyone whose messages are munged like that to seek correction from their mail service provider, and switch to a different one until it's fixed. The post was typed on a mobile device into the text window on Google Groups. It's too bad that inane concerns with newline

Re: How Python works: What do you know about support for negative indices?

2010-09-13 Thread Raymond Hettinger
On Sep 10, 2:13 pm, Terry Reedy tjre...@udel.edu wrote: Reading the third paragraph out of context, one can miss the restriction to built-in objects. I had assumed that the conversion using len(), when available, happened prior to the __getitem__ call. Yes, that's a common misconception. It

Re: How Python works: What do you know about support for negative indices?

2010-09-12 Thread Aahz
In article 87r5gz93sv@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Neil Hodgson nhodg...@bigpond.net.au writes: There appear to be deliberate wraps at sentence end or automatic wraps to fit 80 columns. The automatic wraps in the code presented in the message are wrong.

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Aahz
In article 87vd6d84f7@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: Ben Finney ben+pyt...@benfinney.id.au writes: Raymond Hettinger pyt...@rcn.com writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Neil Hodgson
Ben Finney: For those who think the problem may be with the recipient's software, I see the same annoying line-wrapping problems in the archived message URL:http://mail.python.org/pipermail/python-list/2010-September/1255167.html. That looks well-formatted to me and just the same as I see

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Cameron Simpson
On 10Sep2010 12:46, Daniel Fetchinson fetchin...@googlemail.com wrote: | Raymond Hettinger pyt...@rcn.com writes: | It doesn't seem to be common knowledge when and how a[x] gets | translated to a[x+len(x)]. So, here's a short info post on how Python | supports negative indices for sequences.

Re: How Python works: What do you know about support for negative indices?

2010-09-11 Thread Ben Finney
Neil Hodgson nhodg...@bigpond.net.au writes: There appear to be deliberate wraps at sentence end or automatic wraps to fit 80 columns. The automatic wraps in the code presented in the message are wrong. The automatic wraps in the bullet point list are, if not wrong, at least presumably

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Ulrich Eckhardt
Raymond Hettinger wrote: collections.deque('abcde').__getitem__[-2] # extension class, magic method Small nit: You don't mean [square] brackets here, right? Otherwise, good posting, thank you! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 --

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Giacomo Boffi
Ben Finney ben+pyt...@benfinney.id.au writes: Raymond Hettinger pyt...@rcn.com writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. Thanks for this. Could you

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Steven D'Aprano
On Thu, 09 Sep 2010 18:37:49 -0700, Raymond Hettinger wrote: Hello Folks. It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. [...] Hope you all found this to be

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Daniel Fetchinson
Raymond Hettinger pyt...@rcn.com writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. Thanks for this. Could you post your messages using a channel that doesn't

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Terry Reedy
On 9/9/2010 9:37 PM, Raymond Hettinger wrote: The docs guarantee that Python's builtin sequences implement support for negative indices ( http://docs.python.org/dev/reference/expressions.html#subscriptions The relevant paragraphs are For built-in objects, there are two types of objects that

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Aahz
In article mailman.634.1284115580.29448.python-l...@python.org, Daniel Fetchinson fetchin...@googlemail.com wrote: Attribution missing: I encourage anyone whose messages are munged like that to seek correction from their mail service provider, and switch to a different one until it's fixed.

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Ben Finney
Ben Finney ben+pyt...@benfinney.id.au writes: Raymond Hettinger pyt...@rcn.com writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. Thanks for this. Could you

How Python works: What do you know about support for negative indices?

2010-09-09 Thread Raymond Hettinger
Hello Folks. It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. I've put the answer below, but if you want to quickly test your own knowledge, ask yourself which of these

Re: How Python works: What do you know about support for negative indices?

2010-09-09 Thread Ben Finney
Raymond Hettinger pyt...@rcn.com writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. Thanks for this. Could you post your messages using a channel that doesn't