[issue33519] Should MutableSequence provide .copy()?

2019-05-18 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2019-05-18 Thread Cheryl Sabella


Cheryl Sabella  added the comment:


New changeset 9892f454d11b7ea9ba394a115b3e6f48ef6f78fe by Cheryl Sabella (Jelle 
Zijlstra) in branch 'master':
bpo-33519: clarify that .copy() is not part of the MutableSequence ABC (GH-6965)
https://github.com/python/cpython/commit/9892f454d11b7ea9ba394a115b3e6f48ef6f78fe


--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-17 Thread Jelle Zijlstra

Change by Jelle Zijlstra :


--
keywords: +patch
pull_requests: +6623
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread Jelle Zijlstra

Jelle Zijlstra  added the comment:

Makes sense. I can provide a patch to the docs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> Should we add .copy() to the ABC or remove the promise that all mutable 
> sequences implement .copy()?

The second option would be best.  Let's just clarify that copy() isn't part of 
the MutableSequence API.

The first option isn't really a choice be it would break existing uses that 
don't implement copy and because the ABC have a reliable way to create a new 
instance using the given abstract methods (it has no way of even knowing 
whether the data is stored locally, in a database, or updated through a REST 
API, it may not even be possible to reliably create an independent instance).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

MutableSequence defines an interface. Adding a new method will break all 
classes that implemented this protocol but not the new method.

And what should .copy() return? list subclasses return an exact list, bytearray 
subclasses return an exact bytearray, but deque subclasses try to create an 
instance of the same type. Not all mutable sequences can be copyable. The 
constructor is not the part of the protocol.

The same problems are in MutableSet and MutableMapping. This is why they don't 
provide copy() methods (but concrete classes set and dict do).

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread R. David Murray

R. David Murray  added the comment:

On the other hand, that section does reference the ABC directly, so I can see 
the point of your question.  So I guess I'm not sure what the answer is...I 
don't think copy is an essential part of the ABC, but I'm not sure.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread R. David Murray

R. David Murray  added the comment:

The ABCs are different from the standard types provided by python itself.  The 
former are a minimal subset of the methods provided by the latter.  So I think 
the answer is neither.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33519] Should MutableSequence provide .copy()?

2018-05-15 Thread Jelle Zijlstra

New submission from Jelle Zijlstra :

https://docs.python.org/3.7/library/stdtypes.html#mutable-sequence-types lists 
.copy() among the methods provided by mutable sequences. However, 
MutableSequence does not actually define .copy(): 
https://github.com/python/cpython/blob/master/Lib/_collections_abc.py#L945.

Should we add .copy() to the ABC or remove the promise that all mutable 
sequences implement .copy()?

--
components: Library (Lib)
messages: 316664
nosy: Jelle Zijlstra, rhettinger, stutzbach
priority: normal
severity: normal
status: open
title: Should MutableSequence provide .copy()?
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com