[Numpy-discussion] Re: PEP 688: Making the buffer protocol accessible in Python

2022-04-26 Thread bas van beek
Hi Jelle,

I’ve stumbled upon buffer-related issues multiple times when typing with numpy, 
be It either with annotating functions such as `np.frombuffer` or when passing 
a numpy array to the likes of `memoryview` (resulting in a false positive by 
type checkers).
All in all I’d say this buffer-type would very much be a welcome addition.

I do have a small remark about the name though: why not `BufferType` instead of 
`Buffer`?
the classes in the `types` namespace generally have the `Type` suffix, so the 
lack thereof stands out a bit here.

Regards, Bas

From: Jelle Zijlstra 
Sent: Monday, 25 April 2022 05:47
To: Discussion of Numerical Python 
Subject: [Numpy-discussion] PEP 688: Making the buffer protocol accessible in 
Python

I just posted https://peps.python.org/pep-0688/, which proposes adding a 
types.Buffer type that will make it possible to check in Python code whether a 
type implements the buffer protocol.

I'm reaching out to the numpy community because numpy was an important driver 
for creating the buffer protocol. I'd be happy to hear any feedback or possible 
use cases for the PEP.


___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: PEP 688: Making the buffer protocol accessible in Python

2022-04-26 Thread Jelle Zijlstra
El mar, 26 abr 2022 a las 4:08, bas van beek ()
escribió:

> Hi Jelle,
>
>
>
> I’ve stumbled upon buffer-related issues multiple times when typing with
> numpy, be It either with annotating functions such as `np.frombuffer` or
> when passing a numpy array to the likes of `memoryview` (resulting in a
> false positive by type checkers).
>
> All in all I’d say this buffer-type would very much be a welcome addition.
>

Thank you!

>
>
> I do have a small remark about the name though: why not `BufferType`
> instead of `Buffer`?
>
> the classes in the `types` namespace generally have the `Type` suffix, so
> the lack thereof stands out a bit here.
>
I see it as more akin to the classes in collections.abc, which don't have a
Type suffix. I don't feel strongly about this though; I may change it if
more people bring up this feedback.


>
>
> Regards, Bas
>
>
>
> *From:* Jelle Zijlstra 
> *Sent:* Monday, 25 April 2022 05:47
> *To:* Discussion of Numerical Python 
> *Subject:* [Numpy-discussion] PEP 688: Making the buffer protocol
> accessible in Python
>
>
>
> I just posted https://peps.python.org/pep-0688/, which proposes adding a
> types.Buffer type that will make it possible to check in Python code
> whether a type implements the buffer protocol.
>
>
>
> I'm reaching out to the numpy community because numpy was an important
> driver for creating the buffer protocol. I'd be happy to hear any feedback
> or possible use cases for the PEP.
>
>
>
>
> ___
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: jelle.zijls...@gmail.com
>
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com