Re: Plot not working

2018-05-04 Thread Sharan Basappa
On Saturday, 5 May 2018 10:59:13 UTC+5:30, John Ladasky wrote: > On Friday, May 4, 2018 at 9:13:02 PM UTC-7, Sharan Basappa wrote: > > I am new to Python and using it to learn machine learning. > > > > Below is a sample program I am running to plot IRIS data set. > > The code runs but no plot com

Re: Plot not working

2018-05-04 Thread John Ladasky
On Friday, May 4, 2018 at 9:13:02 PM UTC-7, Sharan Basappa wrote: > I am new to Python and using it to learn machine learning. > > Below is a sample program I am running to plot IRIS data set. > The code runs but no plot comes up. I am not sure what the issue is with the > code. > > # Imports >

Plot not working

2018-05-04 Thread Sharan Basappa
I am new to Python and using it to learn machine learning. Below is a sample program I am running to plot IRIS data set. The code runs but no plot comes up. I am not sure what the issue is with the code. # Imports from matplotlib import pyplot as plt from sklearn.datasets import load_iris import

Re: itemgetter with default arguments

2018-05-04 Thread Steven D'Aprano
On Fri, 04 May 2018 14:38:54 -0600, Ian Kelly wrote: > On Fri, May 4, 2018 at 11:04 AM, Steven D'Aprano > wrote: [...] >> My guess is that they were thinking that there's no need to complicate >> itemgetter for this use-case when it is just as easy to write up a >> quick lambda to do the job. >

Re: itemgetter with default arguments

2018-05-04 Thread Steven D'Aprano
On Fri, 04 May 2018 15:27:02 +0200, Thomas Jollans wrote: spamgetter = (lambda seq, i=2, fallback="spam": > ... seq[i] if abs(i) < len(seq) or i == -len(seq) > ... else fallback) spamgetter("abcd", i=-4) > 'a' spamgetter("abcd") > 'c' spamgett

Re: itemgetter with default arguments

2018-05-04 Thread Steven D'Aprano
On Fri, 04 May 2018 15:27:16 +0200, Antoon Pardon wrote: >> I might be slow today, but I cannot see how to write a clear, obvious, >> efficient lambda that provides functionality equivalent to itemgetter >> with a default value. [...] > This seems to work: > > f = (lambda seq: (list(seq) + 3 * [

Re: itemgetter with default arguments

2018-05-04 Thread Thomas Jollans
On 04/05/18 22:38, Ian Kelly wrote: > On Fri, May 4, 2018 at 11:04 AM, Steven D'Aprano > wrote: >> On Fri, 04 May 2018 09:17:14 -0600, Ian Kelly wrote: >> >>> On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano >>> wrote: Here are the specifications: * you must use lambda, not def; >>>

Re: itemgetter with default arguments

2018-05-04 Thread Ian Kelly
On Fri, May 4, 2018 at 11:04 AM, Steven D'Aprano wrote: > On Fri, 04 May 2018 09:17:14 -0600, Ian Kelly wrote: > >> On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano >> wrote: >>> Here are the specifications: >>> >>> * you must use lambda, not def; >> >> Why? This seems like an arbitrary constraint

Re: Tk covering the entire screen

2018-05-04 Thread Skip Montanaro
I forgot to mention that when running on Linux (displaying back on Windows), the Python 3 version (3.6.4, Tk 8.6) does cover all three screens. The Windows Python 2.7.14 version with Tk 8.5 has problems. -- https://mail.python.org/mailman/listinfo/python-list

Tk covering the entire screen

2018-05-04 Thread Skip Montanaro
I have a little typing watcher (buggy as can be, nearly 20 years old): https://github.com/smontanaro/python-bits/tree/master/watch It does the trick most of the time, so I ignore the bugs for the most part. I had to drag it out last week after my wrists started flairing up again. I moved it to P

Re: itemgetter with default arguments

2018-05-04 Thread Steven D'Aprano
On Fri, 04 May 2018 09:17:14 -0600, Ian Kelly wrote: > On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano > wrote: >> Here are the specifications: >> >> * you must use lambda, not def; > > Why? This seems like an arbitrary constraint. You'll have to ask the two core devs. In my post, in the part y

Re: itemgetter with default arguments

2018-05-04 Thread Chris Angelico
On Sat, May 5, 2018 at 1:17 AM, Ian Kelly wrote: > On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano > wrote: >> Here are the specifications: >> >> * you must use lambda, not def; > > Why? This seems like an arbitrary constraint. > > def itemgetter2(*items, default): > return lambda seq: tuple(

Re: itemgetter with default arguments

2018-05-04 Thread Ian Kelly
On Fri, May 4, 2018 at 7:01 AM, Steven D'Aprano wrote: > Here are the specifications: > > * you must use lambda, not def; Why? This seems like an arbitrary constraint. > * the lambda must take a single function, the sequence you want to > extract an item from; > > * you can hard-code the index

Re: itemgetter with default arguments

2018-05-04 Thread Antoon Pardon
On 04-05-18 15:01, Steven D'Aprano wrote: > A re-occurring feature request is to add a default to itemgetter and > attrgetter. For example, we might say: > > from operator import itemgetter > f = itemgetter(1, 6, default="spam") # proposed feature > f("Hello World!") # returns ('e', 'W') > f("He

Re: itemgetter with default arguments

2018-05-04 Thread Thomas Jollans
On 2018-05-04 15:01, Steven D'Aprano wrote: > A re-occurring feature request is to add a default to itemgetter and > attrgetter. For example, we might say: > > from operator import itemgetter > f = itemgetter(1, 6, default="spam") # proposed feature > f("Hello World!") # returns ('e', 'W') > f(

itemgetter with default arguments

2018-05-04 Thread Steven D'Aprano
A re-occurring feature request is to add a default to itemgetter and attrgetter. For example, we might say: from operator import itemgetter f = itemgetter(1, 6, default="spam") # proposed feature f("Hello World!") # returns ('e', 'W') f("Hello") # returns ('e', 'spam') Two senior deve

Re: Weird side effect of default parameter

2018-05-04 Thread Steven D'Aprano
On Thu, 03 May 2018 19:47:37 +, Robert Latest via Python-list wrote: > Hello, > > I don't understand the behavior of the code below. Why does the dict > property "a" of both objects contain the same keys? This is only if > "a=dict" is in the initializer. If I put self.a = dict() into the init

Re: ImportError: cannot import name _remove_dead_weakref

2018-05-04 Thread joseph pareti
thank you for the advice: depending on the value of PYTHONPATH (version 2.7, 3.5, or unset), tensorflow stops with 3 different error traps 2018-05-04 7:55 GMT+02:00 dieter : > Chris Angelico writes: > > ... > > Somewhere, you have a mismatch of versions. Make sure you're using the > > same Pytho