Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70066
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; 'python.': 0.02; 'python,': 0.02; 'parameters': 0.04; 'interpreter': 0.05; 'deprecated': 0.09; 'item.': 0.09; 'parameter': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; '__getitem__,': 0.16; 'called.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subclass': 0.16; 'index': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'numerical': 0.19; '(in': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'supported': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'subject:) ': 0.29; 'originally': 0.30; 'getting': 0.31; "skip:' 10": 0.31; 'implied': 0.31; 'object.': 0.31; 'steven': 0.31; 'class': 0.32; 'regular': 0.32; 'implemented': 0.33; 'objects': 0.35; 'but': 0.35; 'sequence': 0.36; "didn't": 0.36; 'method': 0.36; 'thanks': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'gone': 0.61; 'introduced': 0.61; 'john': 0.61; 'received:173': 0.61; 'simply': 0.61; 'benefit': 0.68; 'results': 0.69; 'saw': 0.77; 'ethan': 0.84; 'received:fios.verizon.net': 0.84; 'replies.': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Method(s) called by square brackets, slice objects |
| Date | Thu, 10 Apr 2014 18:20:22 -0400 |
| References | <74d6fb5c-baca-4606-9fa8-66238a561e0c@googlegroups.com> <a059f84b-e5b0-4482-9dd5-4489ec0d2563@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| In-Reply-To | <a059f84b-e5b0-4482-9dd5-4489ec0d2563@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9151.1397168450.18130.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1397168450 news.xs4all.nl 2833 [2001:888:2000:d::a6]:50341 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:70066 |
Show key headers only | View raw
On 4/10/2014 2:52 PM, John Ladasky wrote: > Thanks to both Ethan and Steven for their replies. > > Steven: I was trying to use the interpreter and wasn't getting results that I understood -- because I didn't know that __getslice__ was simply gone in Python 3. I implemented a __getslice__ method in my subclass that never got called. > > Ethan: I saw that slice objects were being sent to __getitem__, but that confused me as I thought that its purpose, as implied by the method name, was to return a SINGLE item. A slice is a single sequence object. Sequences can result from any of index lookup, key lookup, or slicings. The backstory is that slicing originally supported only start and stop positions. The 3 __xyzslice__ had separate start and stop parameters instead of the 1 index/key parameter of __xyzitem__. Strides and the slice class were introduced for the benefit of numerical python. When they were 'mainstreamed' into regular python, the __xyzslice__ methods were deprecated (in 2.0) as a single slice object can just as well be passed to __xyzitem__. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Method(s) called by square brackets, slice objects John Ladasky <john_ladasky@sbcglobal.net> - 2014-04-09 13:24 -0700
Re: Method(s) called by square brackets, slice objects Ethan Furman <ethan@stoneleaf.us> - 2014-04-09 13:34 -0700
Re: Method(s) called by square brackets, slice objects Steven D'Aprano <steve@pearwood.info> - 2014-04-10 02:52 +0000
Re: Method(s) called by square brackets, slice objects John Ladasky <john_ladasky@sbcglobal.net> - 2014-04-10 11:52 -0700
Re: Method(s) called by square brackets, slice objects Terry Reedy <tjreedy@udel.edu> - 2014-04-10 18:20 -0400
csiph-web