Re: More elegant way to avoid this hacky implementation of single line reduce for grouping a collection?

2019-01-25 Thread MRAB
On 2019-01-25 22:58, Travis Griggs wrote: Yesterday, I was pondering how to implement groupby, more in the vein of how Kotlin, Swift, Objc, Smalltalk do it, where order doesn’t matter. For example: def groupby(iterable, groupfunc): result = defaultdict(list) for each in it

More elegant way to avoid this hacky implementation of single line reduce for grouping a collection?

2019-01-25 Thread Travis Griggs
Yesterday, I was pondering how to implement groupby, more in the vein of how Kotlin, Swift, Objc, Smalltalk do it, where order doesn’t matter. For example: def groupby(iterable, groupfunc): result = defaultdict(list) for each in iterable: result[groupfunc(each)].ap

Re: preferences file

2019-01-25 Thread Karsten Hilbert
On Fri, Jan 25, 2019 at 11:04:51AM -0500, songbird wrote: > if the system doesn't have home directories but does have > /usr/local you can put things in there (just check to make > sure first that you aren't clobbering someone else's directories > or files :) ). I don't that that's typically wr

Re: Exercize to understand from three numbers which is more high

2019-01-25 Thread Terry Reedy
On 1/25/2019 6:56 AM, ^Bart wrote: number1 = int( input("Insert the first number: ")) number2 = int( input("Insert the second number: ")) number3 = int( input("Insert the third number: ")) if number1 > number2 and number1 > number3:     print("Max number is: ",number1) if number2 > number1 a

Re: preferences file

2019-01-25 Thread songbird
Dave wrote: > I'm doing a small application and want to add user preferences. Did > some googling to see if there are standard Python ways/tools, but it > seems not so much. My specific questions are: > > 1. Best practices for a user preference file/system? use as many default parameters as

Re: Exercize to understand from three numbers which is more high

2019-01-25 Thread Bob Gailer
On Jan 25, 2019 7:00 AM, "^Bart" wrote: > > number1 = int( input("Insert the first number: ")) > > number2 = int( input("Insert the second number: ")) > > number3 = int( input("Insert the third number: ")) > > if number1 > number2 and number1 > number3: > print("Max number is: ",number1) > > i

Re: Exercize to understand from three numbers which is more high

2019-01-25 Thread Joel Goldstick
On Fri, Jan 25, 2019 at 7:16 AM Dan Purgert wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > ^Bart wrote: > > > > if number1 > number2 and number1 > number3: > > print("Max number is: ",number1) > > > > if number2 > number1 and number2 > number3: > > print("Max number is:

Re: Exercize to understand from three numbers which is more high

2019-01-25 Thread Dan Purgert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 ^Bart wrote: > > if number1 > number2 and number1 > number3: > print("Max number is: ",number1) > > if number2 > number1 and number2 > number3: > print("Max number is: ",number2) > > else: > print("Max number is: ",number3) > > Try

Exercize to understand from three numbers which is more high

2019-01-25 Thread ^Bart
number1 = int( input("Insert the first number: ")) number2 = int( input("Insert the second number: ")) number3 = int( input("Insert the third number: ")) if number1 > number2 and number1 > number3: print("Max number is: ",number1) if number2 > number1 and number2 > number3: print("Max

Re: preferences file

2019-01-25 Thread Karsten Hilbert
On Thu, Jan 24, 2019 at 02:42:59PM -0500, Dave wrote: > I'm doing a small application and want to add user preferences. Did some > googling to see if there are standard Python ways/tools, but it seems not so > much. My specific questions are: > > 1. Best practices for a user preference file/sys