Re: [Python-ideas] Rewriting file - pythonic way

2018-04-15 Thread Mahmoud Hashemi
Depending on how firm your requirements around locking are, you may find this code useful: https://github.com/mahmoud/boltons/blob/6b0721b6aeda6d3ec6f5d31be7c741bc7fcc4635/boltons/fileutils.py#L303 (docs here: http://boltons.readthedocs.io/en/latest/fileutils.html#atomic-file-saving ) Basically e

Re: [Python-ideas] Adding quantile to the statistics module

2018-03-17 Thread Mahmoud Hashemi
Hahaha, that Hyndman story will never get old. FWIW, based on much informal polling, the most common intuition on the topic stems from elementary education: a median of an even-numbered set is the mean of the two central values. So, linear-weighted average on discontinuities seems to be least surp

Re: [Python-ideas] ImportError raised for a circular import

2017-06-18 Thread Mahmoud Hashemi
ion. :) On Sun, Jun 18, 2017 at 11:21 AM, Barry Scott wrote: > > On 14 Jun 2017, at 07:33, Nick Coghlan wrote: > > On 14 June 2017 at 13:02, Mahmoud Hashemi wrote: > > That would be amazing! If there's anything I can do to help make that > happen, please let me know. I

Re: [Python-ideas] ImportError raised for a circular import

2017-06-13 Thread Mahmoud Hashemi
That would be amazing! If there's anything I can do to help make that happen, please let me know. It'll almost certainly save that much time for me alone down the line, anyway :) On Tue, Jun 13, 2017 at 7:41 PM, Nick Coghlan wrote: > On 14 June 2017 at 08:49, Mahmoud Hashemi wr

Re: [Python-ideas] ImportError raised for a circular import

2017-06-13 Thread Mahmoud Hashemi
plemented. On Tue, Jun 13, 2017 at 3:36 PM, Chris Angelico wrote: > On Wed, Jun 14, 2017 at 8:10 AM, Mahmoud Hashemi > wrote: > > I didn't interpret the initial email as wanting an error on *all* > circular > > imports. Merely those which are unresolvable. I&#

Re: [Python-ideas] ImportError raised for a circular import

2017-06-13 Thread Mahmoud Hashemi
I didn't interpret the initial email as wanting an error on *all* circular imports. Merely those which are unresolvable. I've definitely helped people diagnose circular imports and wished there was an error that called that out programmatically, even if it's just a string admonition to check for ci

Re: [Python-ideas] dict(default=int)

2017-03-08 Thread Mahmoud Hashemi
That's already valid dict syntax. >>> dict(default=int) {'default': } Generally that in itself makes this a no go. Mahmoud On Wed, Mar 8, 2017 at 2:09 PM, Steven Piantadosi wrote: > Hi All, > > I find importing defaultdict from collections to be clunky and it seems > like having a default sho

Re: [Python-ideas] math.nextafter

2017-02-24 Thread Mahmoud Hashemi
By the way, it looks like math doesn't have machine epsilon either: > > > https://en.wikipedia.org/wiki/Machine_epsilon > > which would be handy as well. > > -CHB > > Pretty sure machine epsilon is in the sys module's float_info object. Or are you saying it would be handy to alias sys.float_info.ep

Re: [Python-ideas] Is it Python 3 yet? Results on my poll on Twitter

2017-02-07 Thread Mahmoud Hashemi
Let the dissection of the Twitter-based biases and bubbles begin. :) On Tue, Feb 7, 2017 at 1:15 AM, Victor Stinner wrote: > Hi, > > I created the following poll on Twitter with a duration of 7 days: > """ > Is it Python 3 yet? > https://mail.python.org/pipermail/python-ideas/2017-January/01

Re: [Python-ideas] Function arguments in tracebacks

2016-12-28 Thread Mahmoud Hashemi
On Wed, Dec 28, 2016 at 2:13 PM, Nathaniel Smith wrote: > On Dec 28, 2016 12:44, "Brett Cannon" wrote: > > My quick on-vacation response is that attaching more objects to exceptions > is typically viewed as dangerous as it can lead to those objects being kept > alive longer than expected (see th

Re: [Python-ideas] Add sorted (ordered) containers

2016-10-14 Thread Mahmoud Hashemi
I'm all for adding more featureful data structures. At the risk of confusing Nick's folks, I think it's possible to do even better than Sorted/Ordered for many collections. In my experience, the simple Ordered trait alone was not enough of a feature improvement over the simpler builtin, leading me

Re: [Python-ideas] Shuffled

2016-09-05 Thread Mahmoud Hashemi
I tend to agree with Arek. I've been bitten multiple times, including once yesterday, because shuffle works in place, when I really expect a sorted()-like behavior for a standalone function like that. Mahmoud https://github.com/mahmoud http://sedimental.org On Mon, Sep 5, 2016 at 6:59 PM, Arek Bu