[issue4948] Make heapq work with all mutable sequences

2018-06-15 Thread Brett Cannon
Brett Cannon added the comment: FYI I had a teacher reach out to me who wanted to use heapq as an example of functions-based API that worked without resorting to OOP but ran into this issue of heapq being limited to lists. -- nosy: +brett.cannon

Re: mutable sequences

2018-06-14 Thread Sharan Basappa
Thanks, All, for the responses. -- https://mail.python.org/mailman/listinfo/python-list

Re: mutable sequences

2018-06-14 Thread Ben Finney
Larry Martell writes: > A string and a list go into a bar. The string asks for a cup of > coffee. The bartender says "We don't have coffee." The string asks for > a cup of coffee. The bartender says "I told you we don't have coffee." > The string asks for a cup of coffee. The bartender says to

Re: mutable sequences

2018-06-14 Thread Larry Martell
On Wed, Jun 13, 2018 at 10:56 PM, Sharan Basappa wrote: > The term mutable appears quite often in Python. > Can anyone explain what is meant by mutable and immutable sequences. A string and a list go into a bar. The string asks for a cup of coffee. The bartender says "We don't have coffee." The

RE: mutable sequences

2018-06-14 Thread Schachner, Joseph
ch could be huge), it passed a reference to a copy of your list. --- Joseph Schachner -Original Message- From: Sharan Basappa Sent: Wednesday, June 13, 2018 10:57 PM To: python-list@python.org Subject: mutable sequences The term mutable appears quite often in Python. Can anyone explai

Re: mutable sequences

2018-06-13 Thread Ben Finney
Sharan Basappa writes: > For example, Python lists are mutable. Yes, that's correct. > BTW, is the below explanation correct (it is taken from a book I am > reading) > > Python lists are mutable sequences. They are very similar to tuples, > but they don't have th

Re: mutable sequences

2018-06-13 Thread Chris Angelico
n from a book I am reading) > > Python lists are mutable sequences. They are very similar to tuples, but they > don't have the restrictions due to immutability. > > It says lists are mutable and then says they are immutable??? Lists are indeed mutable. Since they are mutable,

Re: mutable sequences

2018-06-13 Thread Jim Lee
, is the below explanation correct (it is taken from a book I am reading) Python lists are mutable sequences. They are very similar to tuples, but they don't have the restrictions due to immutability. It says lists are mutable and then says they are immutable???   You have come across a pet-peeve of mine

mutable sequences

2018-06-13 Thread Sharan Basappa
The term mutable appears quite often in Python. Can anyone explain what is meant by mutable and immutable sequences. For example, Python lists are mutable. BTW, is the below explanation correct (it is taken from a book I am reading) Python lists are mutable sequences. They are very similar

[issue26015] Add new tests for pickling iterators of mutable sequences

2016-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In 2.7 iterators are not pickleable. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 2.7 ___ Python tracker

[issue26015] Add new tests for pickling iterators of mutable sequences

2016-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: These tests look fine. I won't miss "orgit" ;-) In test_reversed_pickle, please add the blank line before each section like you did for the other tests. I agree that exhausted array iterator should change to match the others. Once an iterator is

[issue26015] Add new tests for pickling iterators of mutable sequences

2016-03-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___

[issue26015] Add new tests for pickling iterators of mutable sequences

2016-01-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch updates tests for iterators of mutable sequences. Now tested iterators in all four states (initial, running, empty and exhausted), and tested that unpickled iterator is linked with a sequence, not with an independed copy (as in case of dict

[issue4948] Make heapq work with all mutable sequences

2009-01-28 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: With no compelling use cases, it's not worth slowing down the module. Am sticking with the original design decision. -- resolution: - rejected status: open - closed ___ Python

[issue4981] Incorrect statement regarding mutable sequences in datamodel Reference

2009-01-17 Thread Mitchell Model
read There are currently two intrinsic mutable sequence types. -- assignee: georg.brandl components: Documentation messages: 80067 nosy: MLModel, georg.brandl severity: normal status: open title: Incorrect statement regarding mutable sequences in datamodel Reference versions: Python 3.0

[issue4981] Incorrect statement regarding mutable sequences in datamodel Reference

2009-01-17 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Fixed in r68707. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4981

[issue4981] Incorrect statement regarding mutable sequences in datamodel Reference

2009-01-17 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Never mind, I meant r68706. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4981 ___ ___

[issue4981] Incorrect statement regarding mutable sequences in datamodel Reference

2009-01-17 Thread Mitchell Model
Mitchell Model m...@acm.org added the comment: Benjamin Peterson benja...@python.org added the comment: Fixed in r68707. Sorry if I missed that. I checked some of the documentation problems I reported today against an updated subversion copy of 3.0 and 3.1, but I didn't check all. Got

[issue4981] Incorrect statement regarding mutable sequences in datamodel Reference

2009-01-17 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: On Sat, Jan 17, 2009 at 10:29 PM, Mitchell Model rep...@bugs.python.org wrote: Mitchell Model m...@acm.org added the comment: Benjamin Peterson benja...@python.org added the comment: Fixed in r68707. Sorry if I missed that. I

[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Benoit Boissinot
New submission from Benoit Boissinot bboissin+pythonb...@gmail.com: Generalize heapq to work with all kind of mutable sequences. It should be investigated PySequence_SetItem is a lot slower than PyList_SET_ITEM (same for GET_ITEM and GET_SIZE). -- components: Extension Modules messages

[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This was discussed at the outset and the decision was a conscious one. Do you have any particular use cases in mind (what other mutable sequences do you reach for when you need a heap)? Or is this just a general discussion

[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Benoit Boissinot
Benoit Boissinot bboissin+pythonb...@gmail.com added the comment: I was thinking about array.array. I don't know if it would be faster than using a list, but it seemed elegant to be able to do a heap on it anyway. ___ Python tracker rep...@bugs.python.org

[issue4948] Make heapq work with all mutable sequences

2009-01-14 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: array.array is terribly slow. It is optimized for space, not speed. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4948 ___

index method only for mutable sequences??

2007-04-05 Thread C.L.
there. A search of the Library Reference's index seemed to confirm that the function did not exist. A little later I realized it might be called index instead. Voila. My point is that the docs list and describe it as a method that only exists for MUTABLE sequences. Why only for mutables? The class

Re: index method only for mutable sequences??

2007-04-05 Thread 7stud
/typesseq.html); it wasn't there. A search of the Library Reference's index seemed to confirm that the function did not exist. A little later I realized it might be called index instead. Voila. My point is that the docs list and describe it as a method that only exists for MUTABLE sequences. Why

Re: index method only for mutable sequences??

2007-04-05 Thread James Stroud
/typesseq.html); it wasn't there. A search of the Library Reference's index seemed to confirm that the function did not exist. A little later I realized it might be called index instead. Voila. My point is that the docs list and describe it as a method that only exists for MUTABLE sequences. Why