Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Paul Moore
On 3 May 2017 at 02:48, Erik wrote: > Anyway, I know you can't stop anyone from *proposing* something like this, > but as soon as they do you may decide to quote the recipe from > "https://docs.python.org/3/library/functions.html#zip"; and try to block > their proposition. There are already thread

Re: [Python-ideas] Suggestion: Add shutil.get_dir_size

2017-05-03 Thread Paul Moore
On 3 May 2017 at 06:43, Serhiy Storchaka wrote: > On 02.05.17 22:07, Ram Rachum wrote: >> >> I have a suggestion: Add a function shutil.get_dir_size that gets the >> size of a directory, including all the items inside it recursively. I >> currently need this functionality and it looks like I'll ha

Re: [Python-ideas] Suggestion: Add shutil.get_dir_size

2017-05-03 Thread Cameron Simpson
On 03May2017 09:13, Ram Rachum wrote: Calling `du` is possible but I prefer to avoid these kinds of solutions. (OS-specific, parsing text output from a third-party program.) Your choice, and fair enough. However I'd point out that "du" is available on all UNIX systems (includes MacOS) and UN

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Steven D'Aprano
On Tue, May 02, 2017 at 09:07:41PM -0400, Juancarlo AƱez wrote: > On Tue, May 2, 2017 at 8:43 PM, Steven D'Aprano wrote: > > > String methods should return strings. > > > > >>> "A-B-C".split("-") > ['A', 'B', 'C'] Yes, thank you. And don't forget: py> 'abcd'.index('c') 2 But in context, I wa

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Steven D'Aprano
On Wed, May 03, 2017 at 02:48:03AM +0100, Erik wrote: > On 03/05/17 01:43, Steven D'Aprano wrote: > >I'm not stopping anyone from proposing a generalisation of this that > >works with other sequence types. As somebody did :-) > > Who? I didn't spot that in the thread - please give a reference. Th

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Nick Coghlan
On 3 May 2017 at 08:10, Greg Ewing wrote: > For a name, I think "group" would be better than "chunk". > We talk about grouping the digits of a number, not chunking > them. As soon as I added an intermediate variable to my example, I came to the same conclusion: >>> digit_groups = b'\xb9\x01\

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Erik
Hi Paul, On 03/05/17 08:57, Paul Moore wrote: > On 3 May 2017 at 02:48, Erik wrote: >> Anyway, I know you can't stop anyone from *proposing* something like this, >> but as soon as they do you may decide to quote the recipe from >> "https://docs.python.org/3/library/functions.html#zip"; and try

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Steven D'Aprano
On Thu, May 04, 2017 at 12:13:25AM +0100, Erik wrote: > I had a use-case where splitting an iterable into a sequence of > same-sized chunks efficiently improved the performance of my code [...] > So I didn't propose it. I have no idea now what I spent my saved hours > doing, but I imagine that i

Re: [Python-ideas] Add an option for delimiters in bytes.hex()

2017-05-03 Thread Erik
On 04/05/17 01:24, Steven D'Aprano wrote: On Thu, May 04, 2017 at 12:13:25AM +0100, Erik wrote: I had a use-case where splitting an iterable into a sequence of same-sized chunks efficiently improved the performance of my code [...] So I didn't propose it. I have no idea now what I spent my sav