[Python-ideas] Re: [Python-Dev] constants in Python: Starting simple and gradually adding more features, was: Re: Pattern Matching controversy

2020-11-16 Thread Chris Angelico
On Mon, Nov 16, 2020 at 6:51 PM Paul Sokolovsky wrote: > As I mentioned, under "level 0", "from __future__ import const" has a > magic meaning (akin to other "from __future__"'s). Under "level 1", > "const" is just a normal annotation symbol imported from a module. So, > following would be possibl

[Python-ideas] Re: [Python-Dev] constants in Python: Starting simple and gradually adding more features, was: Re: Pattern Matching controversy

2020-11-16 Thread Paul Sokolovsky
Hello, On Mon, 16 Nov 2020 19:47:32 +1100 Chris Angelico wrote: > > def sub(): > > # Gimme powerz back > > from __future__ import const > > BAR: const = 2 > > SyntaxError: from __future__ imports must occur at the beginning of > the file > > If it's just a normal s

[Python-ideas] Re: Use __bytes__ to access buffer-protocol from "user-land"

2020-11-16 Thread Serhiy Storchaka
15.11.20 21:19, Ben Rudiak-Gould пише: > I don't think __bytes__ is necessarily a bad idea, but I want to point > out a couple of things you may be unaware of. First, slicing a > memoryview object creates a subview, so you can wrap your mmap object in > a memoryview and then create slices for each