Re: [Python-Dev] Tunning binary insertion sort algorithm in Timsort.
On 3/8/2015 8:17 PM, nha pham wrote: We can optimize the TimSort algorithm by optimizing its binary insertion sort. The current version of binary insertion sort use this idea: Use binary search to find a final position in sorted list for a new element X. Then insert X to that location. I sugge
Re: [Python-Dev] boxing and unboxing data types
On 03/08/2015 11:07 PM, Serhiy Storchaka wrote:> If you don't call isinstance(x, int) (PyLong_Check* in C).> > Most conversions from Python to C implicitly call __index__ or __int__, but > unfortunately not all. [snip examples] Thanks, Serhiy, that's what I was looking for. -- ~Ethan~ si
Re: [Python-Dev] boxing and unboxing data types
On 09.03.15 06:33, Ethan Furman wrote: I guess it could boil down to: if IntEnum was not based on 'int', but instead had the __int__ and __index__ methods (plus all the other __xxx__ methods that int has), would it still be a drop-in replacement for actual ints? Even when being used to talk t
Re: [Python-Dev] boxing and unboxing data types
On 03/08/2015 09:12 PM, Steven D'Aprano wrote:> Does that answer your questions? No, unfortunately. You correctly guessed my question is motivated by the IntFlag discussion. I guess it could boil down to: if IntEnum was not based on 'int', but instead had the __int__ and __index__ methods (
Re: [Python-Dev] boxing and unboxing data types
On Mar 8, 2015 9:13 PM, "Steven D'Aprano" wrote:>> There's no built-in way of calling __index__ that I know of (no> equivalent to int(obj)), There's operator.index(obj), at least.> but slicing at the very least will call it,> e.g. seq[a:] will call type(a).__index__. -n ___
Re: [Python-Dev] boxing and unboxing data types
On Sun, Mar 08, 2015 at 08:31:30PM -0700, Ethan Furman wrote:> When data is passed from Python to a native library (such as in an O/S > call), how does the unboxing of data types occur? [...]> So the real question: anywhere in Python where an int is expected (for > lower-level API work), but n
[Python-Dev] boxing and unboxing data types
When data is passed from Python to a native library (such as in an O/S call), how does the unboxing of data types occur? For a specific instance, os.open allows an integer whose various bits express desired behavior as `flags` -- if flags is 1, for example, the file is open write-only. If I pas
[Python-Dev] Tunning binary insertion sort algorithm in Timsort.
We can optimize the TimSort algorithm by optimizing its binary insertion sort. The current version of binary insertion sort use this idea: Use binary search to find a final position in sorted list for a new element X. Then insert X to that location. I suggest another idea: Use binary search
Re: [Python-Dev] PEP 471 Final: os.scandir() merged into Python 3.5
On 8 March 2015 at 13:31, Ben Hoyt wrote:> Thanks for committing this, Victor! And fixing the d_type issue on funky> platforms.>> Others: if you want to benchmark this, the simplest way is to use my> os.walk() benchmark.py test program here:> https://github.com/benhoyt/scandir -- it compare
Re: [Python-Dev] PEP 448 review
Anyone have time to do a code review? http://bugs.python.org/issue2292 On Mon, Mar 2, 2015 at 4:54 PM, Neil Girdhar wrote:> It's from five days ago. I asked Joshua to take a look at something, but> I guess he is busy.>> Best,>> Neil>> —>> The latest file there is from Feb 26, while y
Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support
On Sun, Mar 8, 2015, 08:40 Paul Moore wrote: On 26 February 2015 at 21:48, Paul Moore wrote:> On 26 February 2015 at 21:34, Guido van Rossum wrote:>> Accepted!>>>> Thanks for your patience, Paul, and thanks everyone for their feedback.>>>> I know there are still a few small edits to the
Re: [Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support
On 26 February 2015 at 21:48, Paul Moore wrote:> On 26 February 2015 at 21:34, Guido van Rossum wrote:>> Accepted!>>>> Thanks for your patience, Paul, and thanks everyone for their feedback.>>>> I know there are still a few small edits to the PEP, but those don't affect>> my acceptance. Co
Re: [Python-Dev] PEP 471 Final: os.scandir() merged into Python 3.5
On 8 March 2015 at 02:13, Victor Stinner wrote:> FYI I commited the implementation of os.scandir() written by Ben Hoyt.> I hope that it will be part of Python 3.5 alpha 2 (Ben just sent the> final patch today). Yay! Great news. Paul ___ Python-Dev ma
Re: [Python-Dev] PEP 471 Final: os.scandir() merged into Python 3.5
On 8 March 2015 at 12:13, Victor Stinner wrote:> Hi,>> FYI I commited the implementation of os.scandir() written by Ben Hoyt.> I hope that it will be part of Python 3.5 alpha 2 (Ben just sent the> final patch today). Thanks to everyone that worked on getting this PEP through to Final status!
Re: [Python-Dev] PEP 488: elimination of PYO files
For the record here: +1 on the PEP from me (the comments I made on import-sig have already incorporated into this version of the PEP) On 8 March 2015 at 08:03, Brett Cannon wrote:>>> On Sat, Mar 7, 2015 at 12:39 PM Scott Dial > wrote:>>>> On 2015年03月06日 11:34 AM, Brett Cannon wrote:>>> Thi
Re: [Python-Dev] PEP 488: elimination of PYO files
On Mar 07, 2015, at 12:30 PM, Scott Dial wrote:>As a packager, this PEP is a bit silent on it's expectations about what>will happen with (for instance) Debian and Fedora packages for Python.>My familiarity is with Fedora, and on that platform, we ship .pyc and>.pyo files (using -O for the .pyo