Re: [Tutor] Tkinter and canvas question

2017-04-17 Thread boB Stepp
Sorry for the unnecessary post with no response -- inadvertent click on "Send" button which was too near Gmail's "..." button to expand content. On Mon, Apr 17, 2017 at 6:13 PM, Phil wrote: > Thank you for reading this. > > How do I reference the_canvas from my solve()

Re: [Tutor] Tkinter and canvas question

2017-04-17 Thread boB Stepp
On Mon, Apr 17, 2017 at 6:13 PM, Phil wrote: > Thank you for reading this. > > How do I reference the_canvas from my solve() method? Despite hours of > searching I haven't been able to solve this or find a similar example. All > that I've gained is a headache. > >

Re: [Tutor] sqlite3 making a spurious duplicate?

2017-04-17 Thread Steven D'Aprano
I made one more diagnostic change to your script, changing the FillWithStars function to this: def FillWithStars(): with sqlite3.connect("stars.db") as connection: connection.executescript(""" CREATE TABLE brightest( name, constellation,

Re: [Tutor] sqlite3 making a spurious duplicate?

2017-04-17 Thread Steven D'Aprano
On Mon, Apr 17, 2017 at 04:36:50PM -0700, Marilyn Davis wrote: > #!/usr/bin/env python3 > """ > Hello Tutors, > > I can't figure out why the FillWithStars() function puts Canopus in the db > twice. Good question. And thank you for providing a really well-written, simple, clear script that we

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread boB Stepp
Ah, Peter, if only I could achieve your understanding and mastery! On Mon, Apr 17, 2017 at 3:37 AM, Peter Otten <__pete...@web.de> wrote: > Perhaps it becomes clearer if we build our own class discovery / method > runner system. Given T as the baseclass for classes that provide foo_...() >

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread boB Stepp
On Sun, Apr 16, 2017 at 11:50 PM, Mats Wichmann wrote: > > You got me thinking as well, as I don't much care for unittest, at least > partly because it forces you to use classes even when it doesn't feel > all that natural. I have looked into pytest multiple times, but have

[Tutor] Tkinter and canvas question

2017-04-17 Thread Phil
Thank you for reading this. How do I reference the_canvas from my solve() method? Despite hours of searching I haven't been able to solve this or find a similar example. All that I've gained is a headache. Exception in Tkinter callback Traceback (most recent call last): File

Re: [Tutor] reg. list update

2017-04-17 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
This is an aliasing problem. Change the code to super = [] sub = [""]*3 other = ["a","b","c","d"] sub[0] = "hi" sub[1] = "hello" for item in other: l = sub[:] l[2] = item super.append(l) for item in super: print item regards, Sarma. On Tue, Apr 18, 2017 at 2:16 AM, Mats Wichmann

Re: [Tutor] sqlite3 making a spurious duplicate?

2017-04-17 Thread Alan Gauld via Tutor
On 18/04/17 00:36, Marilyn Davis wrote: > #!/usr/bin/env python3 > """ > Hello Tutors, > > I can't figure out why the FillWithStars() function puts Canopus in the db > twice. > > What am I missing? I don;t know but I converted your script into the more conventional form and it worked. it was

Re: [Tutor] reg. list update

2017-04-17 Thread Mats Wichmann
>> >> Is there anything wrong in this code or any feature of python? > > yeah, feature of Python. you could google for "deep copy". > the reference issue is involved here, but my explanation was off, I confused myself, listen to Peter instead :) It's just the same list four times.

[Tutor] sqlite3 making a spurious duplicate?

2017-04-17 Thread Marilyn Davis
#!/usr/bin/env python3 """ Hello Tutors, I can't figure out why the FillWithStars() function puts Canopus in the db twice. What am I missing? Thank you for any help. Marilyn Davis p.s. That Reset(db_name) is in there so that you can run it over and over if you want. --- """ import os,

Re: [Tutor] reg. list update

2017-04-17 Thread Mats Wichmann
On 04/17/2017 12:41 PM, Rasika Sapate via Tutor wrote: > Dear Python group, > I had written following code. > > super = [] > sub = [""]*3 > other = ["a","b","c","d"] > sub[0] = "hi" > sub[1] = "hello" > for item in other: > sub[2] = item > super.append(sub) > for item in super: >

Re: [Tutor] Can a virtual environment be renamed?

2017-04-17 Thread Jim
On 04/16/2017 11:24 AM, Chris Warrick wrote: On 16 April 2017 at 18:16, Jim wrote: On 04/16/2017 10:10 AM, Chris Warrick wrote: On 16 April 2017 at 16:45, Jim wrote: My system python is 2.7.12 so I created a virtual environment using venu to

Re: [Tutor] Can a virtual environment be renamed?

2017-04-17 Thread Jim
On 04/16/2017 02:18 PM, Mats Wichmann wrote: On 04/16/2017 10:16 AM, Jim wrote: On 04/16/2017 10:10 AM, Chris Warrick wrote: On 16 April 2017 at 16:45, Jim wrote: My system python is 2.7.12 so I created a virtual environment using venu to run 3.5.2. I put it in

Re: [Tutor] reg. list update

2017-04-17 Thread Peter Otten
Rasika Sapate via Tutor wrote: > Dear Python group, > I had written following code. > > super = [] > sub = [""]*3 > other = ["a","b","c","d"] > sub[0] = "hi" > sub[1] = "hello" > for item in other: > sub[2] = item > super.append(sub) > for item in super: > print item > > > Output :

[Tutor] reg. list update

2017-04-17 Thread Rasika Sapate via Tutor
Dear Python group, I had written following code. super = [] sub = [""]*3 other = ["a","b","c","d"] sub[0] = "hi" sub[1] = "hello" for item in other: sub[2] = item super.append(sub) for item in super: print item Output : ['hi', 'hello', 'd'] ['hi', 'hello', 'd'] ['hi', 'hello', 'd']

Re: [Tutor] bracket issue

2017-04-17 Thread Danny Yoo
> coming to recursion well i currently use eval() so everything ok i don't > have to worry about brackets but i want to write my own parser. a top down > parser for expressions. Do *not* use eval to parse expressions. It is an extremely bad idea to do this. Instead, you can use ast.parse,

Re: [Tutor] Need help with code

2017-04-17 Thread Danny Yoo
On Mon, Apr 17, 2017 at 12:00 AM, Alan Gauld via Tutor wrote: > On 16/04/17 18:26, Tyler Seacrist wrote: > >> I need to draw a stack diagram for print_n >> called with s = 'Hello' and n=2 and am unsure of how to do so. Are you referring to this?

Re: [Tutor] Python 3.6 Multiply the elements of a 2D Array by the elements of a 1D Aeeay

2017-04-17 Thread Stephen P. Molnar
On 04/16/2017 04:57 PM, Sergio Rojas wrote: On 04/14/2017 04:21 AM, Peter Otten wrote: Stephen P. Molnar wrote: However, what I want to do is multiply each element ob D by each element of s and sum all of the products. If you *really* want this: sum_of_all_products = s.sum() * D.sum()

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread Peter Otten
Peter Otten wrote: > class M: > def foo_one(self): > print(self.__class__.__name__, "one") > def foo_two(self): > print(self.__class__.__name__, "one") Oops, foo_two() should of course print "two", not "one". ___ Tutor

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread Peter Otten
boB Stepp wrote: > It is here that I am struggling. If the mixin class does not inherit > from unittest.TestCase, then how is test_func ever seen? Perhaps it becomes clearer if we build our own class discovery / method runner system. Given T as the baseclass for classes that provide foo_...()

Re: [Tutor] Need help with code

2017-04-17 Thread Alan Gauld via Tutor
On 16/04/17 18:26, Tyler Seacrist wrote: > I need to draw a stack diagram for print_n > called with s = 'Hello' and n=2 and am unsure of how to do so. Me too. What is print_n? Which stack? One in your program or the interpreters internal stack? We need a lot more detail. -- Alan G Author

Re: [Tutor] bracket issue

2017-04-17 Thread Palm Tree
-- Forwarded message -- From: "Palm Tree" Date: 16 Apr 2017 10:07 Subject: Re: [Tutor] bracket issue To: "Peter Otten" <__pete...@web.de> Cc: Ok thanks for the answers. Perfect. Just to clarify why i wanted recursion was that well coming to compiler

[Tutor] Need help with code

2017-04-17 Thread Tyler Seacrist
Hello, I need to draw a stack diagram for print_n called with s = 'Hello' and n=2 and am unsure of how to do so. Thanks, Tyler ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] How do we create a GUI to run a simple calculation program in Python?

2017-04-17 Thread Palm Tree
On 16 Apr 2017 10:01, "Palm Tree" wrote: Sorry for late reply. We usually organise python challenges. Once we organise a gui calculator challenge. You can view the submissions on my blog here: https://abdurrahmaanjanhangeer.wordpress.com/gui-py-

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread Mats Wichmann
On 04/16/2017 10:01 PM, boB Stepp wrote: > OK, between Alan and Martin I think that I see how to make the code > snippet actually test a *function* as the snippet seems to suggest. > Recollect that my original question(s) started: You got me thinking as well, as I don't much care for unittest,

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread Alan Gauld via Tutor
On 17/04/17 05:01, boB Stepp wrote: > Am I missing anything? If not, then why did the code snippet use the > (I believe to be misleading.) class variable approach with "func = > mySuperWhammyFunction" and "self.func(self.arg)"? I suspect it was a slightly broken attempt at reuse in that you can