Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31167

Re: __setitem__ without position

From Peter Otten <__peter__@web.de>
Subject Re: __setitem__ without position
Date 2012-10-12 18:42 +0200
Organization None
References <CA+C4C6c7GBdxs+jZPGNrpauvZXP7caGpPb8Q466HD7mV09731Q@mail.gmail.com> <CA+C4C6eMKa6i4Vk4b7hc8SxyDyutoRKkP9VLt0g3UWs+v5ehTw@mail.gmail.com> <50773AE5.7020400@davea.name> <k57lr2$umt$1@ger.gmane.org> <50784274.3000705@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.2093.1350060139.27098.python-list@python.org> (permalink)

Show all headers | View raw


Ethan Furman wrote:

> Terry Reedy wrote:
>> In 3.x, you would write __setitem__ to recognize that the 'key' is a
>> slice object rather than an int and act accordingly. (In 2.x, you would
>> write __setslice__.)
> 
> I'm not sure how far back it goes, but at least from 2.4 forward
> __setitem__ works with slices just fine.

The __...slice__() methods are deprecated since 2.0.

http://docs.python.org/release/2.0/ref/sequence-methods.html

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: __setitem__ without position Peter Otten <__peter__@web.de> - 2012-10-12 18:42 +0200

csiph-web