[issue30100] WeakSet should allow discard and remove on items that can't have weak references

2018-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> my original motivating case was objects that are hashable but not weakly 
> referenceable.  

It is probably not good design to extend discard() to handle types that aren't 
handled by the other methods.  To me, it isn't at all surprising that the 
business of a WeakSet is to handle objects that are both hashable and weak 
referenceable.  Muddying those waters may do more harm than good.  My 
recommendation is to decline the feature request.

One other thought.  As the Python world starts to encourage type annotations 
and static type checking, one benefit we would hope for is code with cleaner 
matches between the caller and callee signatures.  Accordingly, we shouldn't 
encourage people to write code with odd signatures:
  
x : thing_that_cant_possibly_be_in_the_weakset
some_weakset.discard(x)  # Someday, we might hope this would be flagged

--
status: pending -> open
type:  -> enhancement
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



[issue30100] WeakSet should allow discard and remove on items that can't have weak references

2018-03-26 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue30100] WeakSet should allow discard and remove on items that can't have weak references

2017-04-23 Thread donkopotamus

Changes by donkopotamus :


--
title: WeakSet should all discard and remove on items that can have weak 
references -> WeakSet should allow discard and remove on items that can't have 
weak references

___
Python tracker 

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