[Python-ideas] Add a way to execute code in the context of different frame

2020-02-17 Thread Serhiy Storchaka
The idea is inspired by the following StackOverflow question: https://stackoverflow.com/questions/40945752/inspect-who-imported-me and the corresponding BPO issue: https://bugs.python.org/issue39643. In the older Python versions the f_back attribute of the frame in which the module code is

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Kyle Stanley
> Anyway, I think the spelled-out “Synchronous” may be a better name, to avoid the (very likely) case of people mistakenly reading “Sync” as short for “Synchronized”. It’s no longer than “ProcessPool”, and, although it is easy to typo, tab-completion or copy-paste helps, and how many times do you

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Andrew Barnert via Python-ideas
On Feb 17, 2020, at 15:41, Jonathan Crall wrote: > > FWIW I found the term "SyncExecutor" really confusing when I was reading this > thread. I thought it was short for Synchonized, but I just realized its > actually short for Synchronous, which makes much more sense. While >

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Jonathan Crall
Based on the conversation so far, I agree with @Kyle Stanley's breakdown of the proposal. I think shelving the "*Add a new way to create and specify executor*" and focusing on "*Add a SerialExecutor, which does not use threads or processes*" is the best way forward. For context, I'm a machine

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Kyle Stanley
> I'm much more lukewarm on set_state(). How hard is it to reimplement > one's own Future if someone wants a different implementation? By > allowing people to change the future's internal state, we're also > giving them a (small) gun to shoot themselves with. Yeah, I don't feel quite as

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Antoine Pitrou
On Mon, 17 Feb 2020 12:19:59 -0800 Guido van Rossum wrote: > It's actually really hard to implement your own Future class that works > well with concurrent.futures.as_completed() -- this is basically what > complicated the OP's implementation. Maybe it would be useful to look into > a protocol to

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread Andrew Barnert via Python-ideas
On Feb 17, 2020, at 04:09, ananthan ananthan wrote: > > At last found what I was trying to convey. > > A new class>>BinaryInt(n: Integer *, bits,signed=False) > > It should accept float values.(now >> "bin(5.8)".. will raise an error). Just float, or any type convertible to int?

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Guido van Rossum
It's actually really hard to implement your own Future class that works well with concurrent.futures.as_completed() -- this is basically what complicated the OP's implementation. Maybe it would be useful to look into a protocol to allow alternative Future implementations to hook into that? On

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread Rupert Spann
The module should also support bit masking (left or right justified) with AND / OR / XOR / NotAND / NotOR / NotXOR operations. ieg following the same structure: binary.AND(a,b) binary.OR(a,b) binary.XOR(a,b) binary.NOTAND(a,b) binary.NOTOR(a,b) binary.NOTXOR(a,b) The number of larger length of

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread Rupert Spann
The module should also support bit masking (left and/or right justified) with AND / OR / XOR / NotAND / NotOR / NotXOR operations. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Exception-aware operators

2020-02-17 Thread Andrew Barnert via Python-ideas
> On Feb 17, 2020, at 05:21, Soni L. wrote: > > missing items raise, rather than being None. as such I feel like None-aware > operators would encourage ppl to put None everywhere, which from what I can > tell, goes completely against Python's data model. I don’t think this is entirely true.

[Python-ideas] Re: Exception-aware operators

2020-02-17 Thread Steven D'Aprano
On Sun, Feb 16, 2020 at 10:07:13PM -0300, Soni L. wrote: > I looked at the PEP for None-aware operators and I really feel like they > miss one important detail of Python's data model: [...] > that is: missing items raise, rather than being None. You are conflating two distinct cases. Your

[Python-ideas] Re: Exception-aware operators

2020-02-17 Thread Chris Angelico
On Tue, Feb 18, 2020 at 12:20 AM Soni L. wrote: > > I looked at the PEP for None-aware operators and I really feel like they > miss one important detail of Python's data model: > > >>> {}[0] > Traceback (most recent call last): >File "", line 1, in > KeyError: 0 > >>> [][0] > Traceback

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
I want >>BinaryInt(-2, 4) 0b1110 >>BinaryInt(-2, 4, True) -0b010 >>BinaryInt(-0b010, 4) 0b1110 It should accept float values also. Can anyone tell what should be the input and return types??? ___ Python-ideas mailing list -- python-ideas@python.org To

[Python-ideas] Exception-aware operators

2020-02-17 Thread Soni L.
I looked at the PEP for None-aware operators and I really feel like they miss one important detail of Python's data model: >>> {}[0] Traceback (most recent call last):   File "", line 1, in KeyError: 0 >>> [][0] Traceback (most recent call last):   File "", line 1, in IndexError: list index

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread Richard Damon
On 2/17/20 7:08 AM, ananthan ananthan wrote: At last found what I was trying to convey. A new class>>BinaryInt(n: Integer *, bits,signed=False) It should accept float values.(now >> "bin(5.8)".. will raise an error). BinaryInt(-2,4) 0b1110 I would expect this to be an error, as

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
At last found what I was trying to convey. A new class>>BinaryInt(n: Integer *, bits,signed=False) It should accept float values.(now >> "bin(5.8)".. will raise an error). >>BinaryInt(-2,4) 0b1110 >>BinaryInt(5,4) 0b0101 >>BinaryInt(-2,4,True) -0b010

[Python-ideas] Re: Add Binary module.

2020-02-17 Thread ananthan ananthan
It should accept float,int values . ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: SerialExecutor for concurrent.futures + Convenience constructor

2020-02-17 Thread Antoine Pitrou
On Sun, 16 Feb 2020 19:46:13 -0500 Kyle Stanley wrote: > > Based on the proposal in the OP, I had considered that it might also be > needed to be able to manually set the state of the future through something > like a `Future.set_state()`, which would have a parameter for accessing it > safely