[issue21414] Add an intersperse function to itertools
New submission from Alexander Boyd: Itertools would benefit greatly from a function (which I've named intersperse, after Haskell's equivalent) for yielding the items of an iterator with a given value placed between each. Sort of a str.join-like function, but for arbitrary sequences. Something like: list(itertools.intersperse(1, [2, 3, 4])) [2, 1, 3, 1, 4] -- messages: 217746 nosy: javawizard priority: normal severity: normal status: open title: Add an intersperse function to itertools type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21414 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20012] Re: Allow Path.relative_to() to accept non-ancestor paths
Alexander Boyd added the comment: Then perhaps the docstring of relative_to could note this (like relpath does), or a separate method that's explicitly not symlink safe created. Or better yet, what about a function that does (or at least tries to) give the correct answer in the face of symlinks? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20012 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20012] Allow Path.relative_to() to accept non-ancestor paths
New submission from Alexander Boyd: pathlib.Path.relative_to() blows up when given a path that's not an ancestor of the path on which relative_to is being called: pathlib.Path(/usr/bin).relative_to(/etc) Traceback (most recent call last): File stdin, line 1, in module File pathlib.py, line 822, in relative_to .format(str(self), str(formatted))) ValueError: '/usr/bin' does not start with '/etc' The equivalent with posixpath.relpath (or ntpath.relpath) works just fine: posixpath.relpath(/usr/bin, /etc) '../usr/bin' It'd be nice if Path.relative_to supported this type of usage. -- components: Library (Lib) messages: 206497 nosy: javawizard, pitrou priority: normal severity: normal status: open title: Allow Path.relative_to() to accept non-ancestor paths type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20012 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18144] FD leak in urllib2
Changes by Alexander Boyd a...@opengroove.org: -- nosy: +javawizard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18144 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12955] urllib.request example should use with ... as:
Changes by Alexander Boyd a...@opengroove.org: -- nosy: +javawizard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12955 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19213] platform.linux_distribution detects Oracle Linux as Red Hat Enterprise Linux
Alexander Boyd added the comment: Yep, that fixes it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19213 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19213] platform.linux_distribution detects Oracle Linux as Red Hat Enterprise Linux
Alexander Boyd added the comment: They're providing both /etc/oracle-release and /etc/redhat-release (as Oracle Linux is based on RHEL). I've attached /etc/oracle-release for reference. -- Added file: http://bugs.python.org/file32147/oracle-release ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19213 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19213] platform.linux_distribution detects Oracle Linux as Red Hat Enterprise Linux
New submission from Alexander Boyd: Tested on 3.3.2 and 2.6.6. On Oracle Linux, platform.linux_distribution detects the current distribution as Red Hat Enterprise Linux: import platform platform.linux_distribution() ('Red Hat Enterprise Linux Server', '6.2', 'Santiago') I would have expected something along the lines of: import platform platform.linux_distribution() ('Oracle Linux', '6.2', '') Or perhaps ('Oracle Linux Server', '6.2', ''). -- components: Library (Lib) messages: 199345 nosy: javawizard priority: normal severity: normal status: open title: platform.linux_distribution detects Oracle Linux as Red Hat Enterprise Linux type: behavior versions: Python 2.6, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19213 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering
Alexander Boyd a...@opengroove.org added the comment: I've attached a file demonstrating the stack overflow. It assumes total_ordering has been defined as per new_total_ordering.py. -- Added file: http://bugs.python.org/file21712/new_total_ordering_overflow.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering
Alexander Boyd a...@opengroove.org added the comment: That's my point. My version, sane_total_ordering.py, fixes this by using traditional functions and explicit NotImplemented checks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering
Alexander Boyd a...@opengroove.org added the comment: Ok. Yeah, I won't argue that it's pretty :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering stack overflow
Alexander Boyd a...@opengroove.org added the comment: This is not fixed. The accepted fix doesn't take NotImplemented into account, with the result that comparing two mutually-incomparable objects whose ordering operations were generated with total_ordering causes a stack overflow instead of the expected TypeError: unorderable types: Foo() op Bar(). I've attached a fix for this. It properly takes NotImplemented into account. It also generates __eq__ from __ne__ and vice versa if only one of them exists. -- nosy: +javawizard Added file: http://bugs.python.org/file21708/sane_total_ordering.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering stack overflow
Alexander Boyd a...@opengroove.org added the comment: But it seems pointless to force someone to implement all of the rich comparison methods when they may want to do something as simple as this: class Foo: ... def __lt__(self, other): if not isinstance(other, Foo): return NotImplemented return self.some_value other.some_value -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10042] total_ordering
Alexander Boyd a...@opengroove.org added the comment: Ok. I did write that against Python 2, so I wasn't aware of __eq__ and __ne__. I'll keep that in mind. I am curious, however, as to how this could break existing code. It seems like code that relies on a stack overflow is already broken as it is. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10042 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com