[issue43443] Should shelve support dict union?

2021-07-26 Thread Łukasz Langa

Change by Łukasz Langa :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-26 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 7482fff297727bb5faf64cc92c73561ccf48feda by Miss Islington (bot) 
in branch '3.9':
bpo-43443: Clarify difference between shelve objects and dicts (GH-27004) 
(GH-27370)
https://github.com/python/cpython/commit/7482fff297727bb5faf64cc92c73561ccf48feda


--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-26 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 563e05743c8f31366db7ef35a00e396c9f442b17 by Miss Islington (bot) 
in branch '3.10':
bpo-43443: Clarify difference between shelve objects and dicts (GH-27004) 
(GH-27369)
https://github.com/python/cpython/commit/563e05743c8f31366db7ef35a00e396c9f442b17


--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25908
pull_request: https://github.com/python/cpython/pull/27370

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-26 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c97c2a050cf753003012ae3f08e035326b8f6167 by Serhiy Storchaka in 
branch 'main':
bpo-43443: Clarify difference between shelve objects and dicts (GH-27004)
https://github.com/python/cpython/commit/c97c2a050cf753003012ae3f08e035326b8f6167


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-26 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +25907
pull_request: https://github.com/python/cpython/pull/27369

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-07-03 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +25564
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27004

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Dominik Vilsmeier


Dominik Vilsmeier  added the comment:

It's true, having `__ior__` but not `__or__` would probably be weird. In the 
end it's just "nice to have", but I'm not even sure that this applies. Calling 
`db.update(...)` is still more explicit than `db |= ...`.  The docs mention that

> This eases the transition from dictionary based scripts to those requiring 
> persistent storage.

For my use cases, however, I always knew right from the beginning that I want 
object persistence between different runs of a script (e.g. for data analysis, 
caching the expensive results), so it was always clear that I'm working with a 
Shelf object and not a dict (i.e. no expectations on the availability of `|=`).

Primarily, this issue was meant to point out the mismatch of 
docs/implementation and not to get `|=` implemented for `Shelf`. In the end, I 
think updating the docs is all that is needed.

--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Brandt Bucher


Brandt Bucher  added the comment:

+1 for the MutableMapping comment.

We purposely omitted shelve when determining what classes should grow the new 
operators. Guido's thoughts:

> I definitely think we should leave Shelf alone, it's a toy class from a 
> different era.

(https://bugs.python.org/msg364196)

I personally have no experience with shelve, so I'd rather defer to the 
judgement of others here.

--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

One other thought.  While __ior__() could be used as a short-cut for update(), 
the related __or__() method is more problematic because it would need to create 
a new underlying DB.  So maybe this is a can worms that we should not open. It 
would be weird to have __ior__() but not __or__().

--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Maybe say that they implement the MutableMapping interface?

Yes, that's a good idea (also add link to the MutableMapping docs).

> Right, that seems like a good idea. But `__ior__` could
> be implemented nevertheless?

Off-hand, I don't see why not.

Adding Brandt to the nosy list to see what he thinks.

--
nosy: +brandtbucher

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Dominik Vilsmeier


Dominik Vilsmeier  added the comment:

Right, that seems like a good idea. But `__ior__` could be implemented 
nevertheless?

--

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The comment is outdated. Shelf objects also do not support methods copy and 
fromkey. Creating a new Shelve object without specifying a new underlying 
database object does not make much sense.

Maybe say that they implement the MutableMapping interface?

>>> sorted(set(dir(dict)) - set(dir(shelve.Shelf)))
['__ior__', '__or__', '__ror__', 'copy', 'fromkeys']
>>> sorted(set(dir(collections.abc.MutableMapping)) - set(dir(shelve.Shelf)))
[]

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue43443] Should shelve support dict union?

2021-03-09 Thread Dominik Vilsmeier


New submission from Dominik Vilsmeier :

The docs of shelve mention that

> Shelf objects support all methods supported by dictionaries. This eases the 
> transition from dictionary based scripts to those requiring persistent 
> storage.

However the `|=` operator is not implemented, preventing a seamless transition 
from `dict` to `shelve`. So should this be implemented for `Shelf` as well? `|` 
on the other hand doesn't make much sense.

Otherwise the docs could be updated.

--
components: Library (Lib)
messages: 388335
nosy: Dominik V.
priority: normal
severity: normal
status: open
title: Should shelve support dict union?
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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