[issue30146] Difference in behavior between set() and collections.abc.MutableSet() derived objects

2017-04-27 Thread Horacio Hoyos

Horacio Hoyos added the comment:

Although I agree that some design decisions forge a language and sometimes 
these historical developments win over sounder or more "logical" arguments.

That being said, I believe (as the OP of issue 8743) that the ABC collections 
should comply to the API of the Python base collections. In that sense, I would 
expect any custom collection implemented by extending the ABC collections to be 
used in place of an exiting base one, without any "hiccups". Thus, the custom 
collection should pass all the tests in the Lib/tests.

Of course, for the moment, this would just require extra work on my part in 
order to implement all the magic methods and such.

If history is to win again, then at least the documentation of the ABC  
collections should clearly state the subtle, but IMHO important, differences 
between the two.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30146>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30146] Fix for issue 8743 not available in python MacOS 3.6.1

2017-04-23 Thread Horacio Hoyos

Horacio Hoyos added the comment:

Guess my second attempt didn't work as expected ;-).

I have attached the file now. To run just invoke the script:

$ python3 example.py
s did not screen-out general iterables

I would expect to see no output.

--
Added file: http://bugs.python.org/file46829/example.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30146>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30146] Fix for issue 8743 not available in python MacOS 3.6.1

2017-04-23 Thread Horacio Hoyos

New submission from Horacio Hoyos:

Hi, attempt 2.

My system is MacOs Yosemite (10.10.5), I have installed Python 3.6.1 downloaded 
from the official Python website.

I was having issues while testing a custom Set implementation using the 
_collections_abc base MutableSet and found that my issue was apparently 
resolved with issue 8743. From the fix, in the attached script I would expect 
the and operation between my set implementation and a string to fail with a 
TypeError, given that string is not an instance of Set. However, the error is 
not raised, i.e. the print statement is executed. 

>From the discussion on issue 8743, I would expect _collections_abc.py to have 
>a test for Set instances, but is not the case (for example):

def __and__(self, other):
if not isinstance(other, Iterable):
return NotImplemented
return self._from_iterable(value for value in other if value in self)

That is, I was expecting a isinstance(other, Set) somewhere there.

In my previous post I was told my python installation was broken. However, I 
checked the collections_abc.py in my windows system and is the same. I am not 
an expert on the Python build system, but the patch in bug 8743 applies to 
/Lib/_abcoll.py, but I guess _collections_abc.py is generated somehow.

--
components: Library (Lib), macOS
messages: 292175
nosy: Horacio Hoyos, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Fix for issue 8743 not available in python MacOS 3.6.1
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30146>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Horacio Hoyos

New submission from Horacio Hoyos:

Hi all,

I was having issues while testing a custom Set implementation using the 
_collections_abc base MutableSet and found that my issue was apparently 
resolved with issue 8743. My test is simple:

ms = MySetImpl()
ms & 'testword'

which should fail with TypeError, given that in the 8743 fix the __and__ 
incorporated a test for isinstance(other, Set).

Looking at the _collections_abc.py in my installation 
(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_collections_abc.py)
 I can not see the changes in the patches submitted for issue 8743.

--
components: Library (Lib), macOS
messages: 292134
nosy: Horacio Hoyos, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Fix for issue 8743 not available in python MacOS 3.5.1
versions: Python 3.5

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30139>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com