[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-13 Thread Daniel Moisset

Daniel Moisset added the comment:

Thanks for the feedback. Just for the context, I opened this issue also based 
on this email: http://permalink.gmane.org/gmane.comp.python.devel/156411

 Probably there are two different discussions to have here:

1) Is the "Buffer" a useful ABC to have even if there's no python API involved? 
My thoughts (that come from working with typing and PEP 484 and numpy) are "yes"

2) Where is the right place to put it? I suggested collections.abc after seeing 
the thread I linked, although I wouldn't mind if this was in typing.py or 
somewhere else.

--

___
Python tracker 

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



[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'll defer to typing gurus as to whether something like this might make sense 
in typing.py, but it doesn't make much sense as a collections.abc without an 
API exposed in pure python and without useful mixin methods.  By way of 
comparison, consider that the named tuple protocol is in typing.NamedTuple but  
not in collections.abc; instead, we just use _fields to recognize it when the 
need arises (which is almost never).   

I would like collections.abc to remain a place for ABCs that can be usefully 
subclassed, that provide guaranteed behaviors, and that are in fact related to 
collections.  The module's utility will be impaired if it becomes a dumping 
ground for miscellaneous type hinting concepts and registrations.

Early on there was some experimentation with the "one-trick ponies" in 
collections.abc such as Callable and Hashable that turned-out to almost never 
be used in practice, so we don't want to continue to that line of development 
when there are more promising avenues such as typing.py.

--
nosy: +rhettinger
versions: +Python 3.6

___
Python tracker 

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



[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-12 Thread Daniel Moisset

Changes by Daniel Moisset :


--
components: +Library (Lib)
type:  -> enhancement

___
Python tracker 

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



[issue27501] Create a collections.abc class that describes PEP 3118 buffer

2016-07-12 Thread Daniel Moisset

New submission from Daniel Moisset:

The buffer protocol is a low level C protocol, but even if it doesn't expose a 
specific python API, it's currently not possible to say "this object implements 
the buffer protocol" in Python

This might be useful for some applications, including PEP-484 typing hints. It 
would be useful to have a collections.abc.Buffer which already registers the 
types that already support the protocol (bytes, strings, array.array, struct, 
mmap, ctype arrays/pointers, etc)

--
messages: 270261
nosy: Daniel Moisset
priority: normal
severity: normal
status: open
title: Create a collections.abc class that describes PEP 3118 buffer

___
Python tracker 

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