[Tutor] Best way to do FTP login?

2016-06-17 Thread boB Stepp
I could do this: from ftplib import FTP ftp = FTP('ip_address', 'username', 'password') Or, I could do this: ftp = FTP('ip_address') ftp.login('username', 'password') Most of the examples I am seeing online use the second approach. Is there some reason why this is to be preferred? TIA! --

[Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
I have (Finally!) gotten a bit of time to look at Peter's answer to my Model-View-Controller question from May 29th, particularly his CircleImageView class to which he added a "#FIXME" comment. I thought it would be helpful to abbreviate his distance function in the interpreter while I played arou

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 3:14 PM, Joel Goldstick wrote: > On Sat, Jun 18, 2016 at 3:04 PM, boB Stepp wrote: >> Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 >> 64 bit (AMD64)] on win32 >> Type "help", "copyright", "credits&quo

Re: [Tutor] Why are expressions not allowed as parameters in function definition statements?

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 9:10 PM, Steven D'Aprano wrote: > On Sat, Jun 18, 2016 at 02:04:46PM -0500, boB Stepp wrote: > Can you explain what you expected > > def d(row, col/2) > > to mean? I have literally no idea. You know Steve, as I was typing the beginning of a reply

Re: [Tutor] Correct use of model-view-controller design pattern

2016-06-18 Thread boB Stepp
On Sun, May 29, 2016 at 9:28 AM, Peter Otten <__pete...@web.de> wrote: > Here's a commandline example with two views (the circle-drawing routine has > to be fixed)... I have to admit that now that I have finally gotten around to your code, I am left scratching my head. My main issue is what am I

Re: [Tutor] Correct use of model-view-controller design pattern

2016-06-18 Thread boB Stepp
On Sat, Jun 18, 2016 at 11:18 PM, boB Stepp wrote: > On Sun, May 29, 2016 at 9:28 AM, Peter Otten <__pete...@web.de> wrote: > >> Here's a commandline example with two views (the circle-drawing routine has >> to be fixed)... > > I have to admit that now that I

Re: [Tutor] ASCII-Art circles, was Re: Why are expressions not allowed as parameters in function definition statements?

2016-06-20 Thread boB Stepp
On Mon, Jun 20, 2016 at 3:36 AM, Peter Otten <__pete...@web.de> wrote: > I'm now really sorry that I wrote that comment. It should have been > something like > > # I know that the following code is inefficient and produces > # underwhelming results. As its only purpose is to illustrate > # the vie

Re: [Tutor] My code isn't working properly

2016-06-20 Thread boB Stepp
On Mon, Jun 20, 2016 at 2:59 AM, Sopan Shewale wrote: > You need to worry about indentation ;) & spells (.. you seriously want to > use input instead of raw_input? ) The book the OP is using is Python 3-based. He should be using "input()" as he did. Otherwise, it does look like a lack of inden

[Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-27 Thread boB Stepp
My eyes are glazing over from hours and hours of Googling on this. I cannot come to a rational conclusion. Perhaps someone can help me to do so. I currently have a 64-bit desktop PC that I built myself. It is running Win7 Pro 64-bit. I need to keep this OS as I need to run various chess softwa

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-28 Thread boB Stepp
On Mon, Jun 27, 2016 at 9:52 PM, boB Stepp wrote: [...] > 10) ... I forgot one concern last night: 11) My current graphics adapter is made by NVIDIA. Their drivers are proprietary. Is this going to be a deal breaker for Linux? 12) And what about wireless networking? My ASUS motherbo

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-28 Thread boB Stepp
On Mon, Jun 27, 2016 at 10:48 PM, Steven D'Aprano wrote: > On Mon, Jun 27, 2016 at 09:52:50PM -0500, boB Stepp wrote: >> My eyes are glazing over from hours and hours of Googling on this. I >> cannot come to a rational conclusion. Perhaps someone can help me to >> do

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Tue, Jun 28, 2016 at 6:34 PM, David Rock wrote: > >> On Jun 28, 2016, at 18:16, boB Stepp wrote: >> >> On Mon, Jun 27, 2016 at 10:48 PM, Steven D'Aprano >> wrote: >>> >>> >>> What about running Win7 in a virtual machine? >

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Wed, Jun 29, 2016 at 12:02 PM, David Rock wrote: > >> On Jun 29, 2016, at 11:20, boB Stepp wrote: >> >> My Christmas present of a Corsair mechanical gaming keyboard was not >> _seen_ during the boot up sequence until *after* Windows started up. >> So I could

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Wed, Jun 29, 2016 at 1:12 PM, David Rock wrote: > >> On Jun 29, 2016, at 12:32, boB Stepp wrote: >> >> On Wed, Jun 29, 2016 at 12:02 PM, David Rock wrote: >>> >>>> On Jun 29, 2016, at 11:20, boB Stepp wrote: >>>> >>>> My

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Wed, Jun 29, 2016 at 7:56 PM, boB Stepp wrote: > Now I can get into BIOS. BIOS sees my USB flash drive as "UEFI: Lexar > USB Flash Drive 1100", but it silently refuses to boot to the iso > image installed on it. Something new to puzzle out! OK, I'm into a live Mint

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Wed, Jun 29, 2016 at 10:37 PM, David Rock wrote: >> I typed both "python" and "python3" in the terminal window to see what >> is here: Python 2.7.6 and Python 3.4.3 [Does this mean we are *on* >> topic now? ~(:>))]. Question: Is Python 3 used by any of Mint's OS >> functions? Or does it o

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-29 Thread boB Stepp
On Thu, Jun 30, 2016 at 12:09 AM, Alan Gauld via Tutor wrote: > On 29/06/16 23:58, boB Stepp wrote: > >> One point I just discovered for those new to this and Linux: tkinter >> does *not* come pre-installed with the Python distributions; it will >> have to be installed

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-07-02 Thread boB Stepp
This is an update and a test to see if I have figured out Thunderbird's settings so that everything comes over as plain text instead of something else. If there are any issues let me know. Friday the Mint crew announced that they were releasing their new version of Mint, version 18, Sarah, so

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-07-03 Thread boB Stepp
On 07/03/2016 02:32 PM, Ries Rommens wrote: Hello boB, On the latter I was surprised that Thunderbird did not support conversation views out of the box. After opening Thunderbird you will see a listing of your emails. Clicking on the header of the very first column of the listing will give you

Re: [Tutor] iterators

2016-07-04 Thread boB Stepp
On 07/04/2016 03:38 PM, Colby Christensen wrote: I'm sure this is something simple but I'm missing it. When I check the statement with two values, the if statement works. However, for the statement with one value I get an error. keycode = event.GetKeyCode() if keycode in (13, 370): self.ent

Re: [Tutor] help with exercise 15 of zed shaw's LPTHW

2016-07-05 Thread boB Stepp
Welcome! On 07/05/2016 06:56 PM, loh...@tuta.io wrote: hey everyone. this is my first time trying this -- actually, I've been studying python only for some days now, and I'm afraid my questions are going to be rally simple, but I can't seem to understand this piece of code and thus can't mov

Re: [Tutor] need help

2016-08-11 Thread boB Stepp
On Aug 11, 2016 12:15 PM, "Pallab Amway" wrote: > > Respected sir > > Myself pallab kumar seal from India I am using python2.7 > in my window 7 but while I am using python to compile my program I am > getting following error > > Programe1 > > age = 21 > > if age < 12: > > pr

[Tutor] Fwd: Re: need help

2016-08-12 Thread boB Stepp
Pallab, please reply to the Tutor list. -- Forwarded message -- From: "Pallab Amway" Date: Aug 12, 2016 1:05 AM Subject: Re: [Tutor] need help To: "boB Stepp" Cc: > Respected sir,lots of thanks for your advice,but while i am compiling > those programe

Re: [Tutor] pip says no downloads for PyMedia

2016-09-12 Thread boB Stepp
On Sep 10, 2016 7:20 PM, "Jim Byrnes" wrote: > > > I am using python3 could that be the problem? I looked but couldn't find any info on what version of python is needed. > I went to pymedia.org. The copyright at the bottom of the page is 2004. The "latest" news entry is February 1, 2006. So thi

Re: [Tutor] pip says no downloads for PyMedia

2016-09-13 Thread boB Stepp
On Tue, Sep 13, 2016 at 2:17 PM, Jim Byrnes wrote: > On 09/12/2016 07:59 PM, Jim Byrnes wrote: >> >> On 09/12/2016 06:06 PM, boB Stepp wrote: >>> >>> On Sep 10, 2016 7:20 PM, "Jim Byrnes" wrote: >>>> >>>> >>>> >

[Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-23 Thread boB Stepp
After another long layoff from studying Python due to "that's life", I am back at it again. I am trying to combine learning unit testing and TDD with working through the text, "Think Python 2" by Allen Downey. I am currently in chapter 3 which is an introduction to functions. In trying to apply T

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-23 Thread boB Stepp
I wanted to add a clarification as to what I was hoping to achieve. On Sat, Sep 24, 2016 at 12:55 AM, boB Stepp wrote: > > Of course, this code passed its test when the string was "Monty > Python", so I next wanted to run the same test with different strings > each time,

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 2:04 AM, Ben Finney wrote: > Bob, you may want to also subscribe to the specific forum for testing in > Python http://lists.idyll.org/listinfo/testing-in-python>. You're > beyond the beginner material that's usually discussed on this Tutor forum. Honestly, Ben, I thought t

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 11:05 PM, Steven D'Aprano wrote: > On Sat, Sep 24, 2016 at 12:55:28AM -0500, boB Stepp wrote: >> def right_justify(a_string): >> '''This fucntion will take the string, "a_string", and left justify it by >

[Tutor] Testing print

2016-09-29 Thread boB Stepp
Testing output of print functions (Py 3). First off, is it worth it to do so? Second, it seems that prints are often intermingled with the main logic of a function and only serve to pass on a message to the user. For example, in an earlier thread ( Questions as to how to run the same unit test m

[Tutor] Passing functions as arguments to other functions

2016-09-29 Thread boB Stepp
I believe I understand the barebone mechanics on how to do this. But I do not understand the rationale of why Python does it the way it does. Say def f(g, *args): g(*args) def g(*args): # Do something. do_things = f(g, *args) is the outline of how I understand the mechanics of doing t

Re: [Tutor] Testing print

2016-09-30 Thread boB Stepp
On Fri, Sep 30, 2016 at 5:07 AM, Steven D'Aprano wrote: > On Thu, Sep 29, 2016 at 09:24:51PM -0500, boB Stepp wrote: >> Second, it seems that prints are often intermingled with the main >> logic of a function and only serve to pass on a message to the user. > > Yeah,

Re: [Tutor] Passing functions as arguments to other functions

2016-09-30 Thread boB Stepp
On Fri, Sep 30, 2016 at 3:43 AM, Alan Gauld via Tutor wrote: > On 30/09/16 03:43, boB Stepp wrote: > >> Also, I note that if I just type a function name without the >> parentheses in the interpreter, I will get something like this: >> >>>>> def f(): >>

Re: [Tutor] Passing functions as arguments to other functions

2016-09-30 Thread boB Stepp
On Fri, Sep 30, 2016 at 6:55 AM, Steven D'Aprano wrote: > On Thu, Sep 29, 2016 at 09:43:57PM -0500, boB Stepp wrote: >> But why does Python require >> separating the function object from its parameters when it is being >> passed as an argument to another function? &g

Re: [Tutor] Testing print

2016-09-30 Thread boB Stepp
On Fri, Sep 30, 2016 at 5:07 AM, Steven D'Aprano wrote: [snip] > and preferably three: > > (1) function that does the calculation; > (2) function that does the output; > (3) function that calls (1) and then (2) > > > If (1) and (2) are well-designed, then (3) is so trivial it needs no > tests: >

Re: [Tutor] Testing print

2016-09-30 Thread boB Stepp
On Sat, Oct 1, 2016 at 12:12 AM, Richard Doksa wrote: > unsubscibe please If you wish to unsubscribe, go to the bottom of this page and follow its instructions: https://mail.python.org/mailman/listinfo/tutor boB ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 2:02 AM, Alan Gauld via Tutor wrote: > On 01/10/16 05:24, boB Stepp wrote: > >> === >> '''Exerise 3.1 from "Think Python 2" by Allen Downey. >> >&

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 2:02 AM, Alan Gauld via Tutor wrote: > Do you need print_msgs()? > Won't it work the same with > >print(right_justify(input_string)) > > You are only feeding one line at a time into the print msgs. > > You could do it all in a new print_msgs() like: > > def prin

Re: [Tutor] Unsubscribe

2016-10-01 Thread boB Stepp
Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor wrote: > ... Personally I don't like functions that > sometimes return one and sometimes two results. I'd rather > you returned a None first argument in the first case > to make it consistent. Why don't you like doing this? What are the plus

Re: [Tutor] Testing print

2016-10-01 Thread boB Stepp
On Sat, Oct 1, 2016 at 7:19 PM, Alan Gauld via Tutor wrote: > On 01/10/16 23:08, boB Stepp wrote: >> On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor >> wrote: >> >>> ... Personally I don't like functions that >>> sometimes return one and someti

[Tutor] How to test a function which runs a passed in function twice?

2016-10-02 Thread boB Stepp
In exercise 3.2 of Downey's "Think Python 2" he has a function: def do_twice(f): f() f() As you know, I am trying to learn testing/TDD while doing these exercises. How do I test such a *general* function? Should I create a variety of arbitrary functions in my test file, call the do_twic

Re: [Tutor] How to test a function which runs a passed in function twice?

2016-10-02 Thread boB Stepp
On Sun, Oct 2, 2016 at 6:00 PM, Steven D'Aprano wrote: > On Sun, Oct 02, 2016 at 05:47:51PM -0500, boB Stepp wrote: >> In exercise 3.2 of Downey's "Think Python 2" he has a function: >> >> def do_twice(f): >> f() >> f() >> >>

[Tutor] TDD: How to test input()?

2016-10-07 Thread boB Stepp
I think I have this figured out, but I want to be certain I am doing it both correctly and in the preferred way. I have a need for a get_input() function and have written my first test for this function as follows: class TestGetInput(unittest.TestCase): '''Tests for the function get_input().'

Re: [Tutor] TDD: How to test input()?

2016-10-07 Thread boB Stepp
Oops! On Fri, Oct 7, 2016 at 8:26 PM, boB Stepp wrote: > I think I have this figured out, but I want to be certain I am doing > it both correctly and in the preferred way. I have a need for a > get_input() function and have written my first test for this function > as follow

[Tutor] Do not understand why I am getting "EOFError: EOF when reading a line".

2016-10-07 Thread boB Stepp
My current get_input() function: == def get_input(): '''Get string input from the user and convert it to an integer. This integer is returned to the caller. :num_sides: Number of sides for the displayed grid.''' while True:

Re: [Tutor] Do not understand why I am getting "EOFError: EOF when reading a line".

2016-10-07 Thread boB Stepp
I think I now understand why I am getting this EOF exception. On Fri, Oct 7, 2016 at 10:16 PM, boB Stepp wrote: > My current get_input() function: > > == > def get_input(): > '''Get string input from the use

Re: [Tutor] compress directory

2016-11-03 Thread boB Stepp
On Thu, Nov 3, 2016 at 10:48 AM, Bill Nolf wrote: > How do I compress (gzip and/or tar) a directory in python? I found examples > of compressing a file using gzip or tar but not a directory. > thanks I did a search for almost your exact question and got this: http://stackoverflow.com/questions

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Greetings! On Thu, Dec 8, 2016 at 4:00 AM, M Ali wrote: > > I was wondering if you can help me, as I am struggling to create a numbered > grid in Python. I am trying to be able to create a snakes and ladders game in > Python and it must have a numbered grid and involve 2 players. I would > app

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Apologies! My ever friendly Gmail reset my font preferences along the way and put me on a non-monospace font. However, I hope the OP can determine my intent below despite the misalignment of my big one. Cheers! boB On Thu, Dec 8, 2016 at 8:51 AM, boB Stepp wrote: > Greetings! > > On

Re: [Tutor] FW: 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
be stored in a text file and loaded at the start > of the program > > • Need to have 4 obstacles stored in a text file, along with the number > of squares they move forward or backward by. Must be loaded at the start of > the game > > > > > > From: M Ali > S

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Please respond to the entire Tutor list. Also, note that Tutor is a plain text only list so your image is not going to show up. On Thu, Dec 8, 2016 at 9:21 AM, M Ali wrote: > > Hi Bob > > > > Thank you ever so much in getting in touch. I have been given an exemplar work of what I am suppose do b

Re: [Tutor] unknown syntax error

2016-12-15 Thread boB Stepp
On Sun, Dec 11, 2016 at 10:30 AM, oliver patterson < oliverjamespatter...@hotmail.com> wrote: > hey i dont know if this is the right place but i was just coding in idle and kept getting this syntax error and i can not see m to fix it here is my bit of code: Yes, this is the right place. Welcome t

Re: [Tutor] Using Python to solve factoria

2016-12-21 Thread boB Stepp
Welcome! On Wed, Dec 21, 2016 at 1:50 AM, Hedgar wrote: > Hello, > > I really happy to be accepted to the list! > This is my current function: > > def factoria(numb): > While numb > 1: > If numb==0: > return 1 > Else: > result = numb*(numb-1) > numb = numb -1 > return result > factoria(5) > #shou

Re: [Tutor] Open a libreoffice calc file in Python

2016-12-21 Thread boB Stepp
On Wed, Dec 21, 2016 at 9:37 PM, Jim Byrnes wrote: > Python 3.4 on Ubuntu > > If I was going to open a libreoffice calc file from the terminal I would go: > libreoffice --calc /home/path/to/myfile.ods. > > How would I do this from Python? My first thought was: import os os.system(insert_your_co

Re: [Tutor] Open a libreoffice calc file in Python

2016-12-22 Thread boB Stepp
On Wed, Dec 21, 2016 at 10:50 PM, wrote: > To my mind the more important thing is to use the "shell=False" version of > Popen. os.system() inherently accepts a shell command string, which means > you need to hand quote the /home/path/to/myfile.ods. But it is better to > pass an array of strings:

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-24 Thread boB Stepp
On Sat, Dec 24, 2016 at 7:21 PM, Jim Byrnes wrote: > On 12/24/2016 05:10 PM, Danny Yoo wrote: >> >> On Sat, Dec 24, 2016 at 2:40 PM, Jim Byrnes wrote: >>> >>> subprocess.call(['libreoffice', '/home/jfb/test.ods']) >>> k.tap_key(k.enter_key) >>> k.tap_key(k.enter_key) >>> >>> If I run the above co

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-25 Thread boB Stepp
On Sun, Dec 25, 2016 at 3:08 AM, Alan Gauld via Tutor wrote: > > On 25/12/16 01:58, boB Stepp wrote: > > > the stdin option of call()might be used to direct the desired > > keystrokes to LO? After looking at > > The problem is that keystrokes in a GUI are not read fro

Re: [Tutor] I hope you can build a platform for studying in Traditional Chinese.Please

2017-01-29 Thread boB Stepp
Hello! On Sun, Jan 29, 2017 at 12:31 PM, 劉權陞 <01patrick...@gmail.com> wrote: > Hello: I am the student in junior high school.I would like to learn python, > but there are few traditional Chinese resources on the website, especially > the Python's documents are all in English I can not read it.( >

[Tutor] Best Python 3 module to create simple text editor in Windows command prompt?

2017-02-02 Thread boB Stepp
I wish to create a primitive text editor in Windows 7 command prompt to enable me to manually enter and solve simple substitution cryptograms by hand. I would want the cipher text to be one color and the plain text in another. My intent is to set up things this way in command prompt before creati

Re: [Tutor] Best Python 3 module to create simple text editor in Windows command prompt?

2017-02-02 Thread boB Stepp
On Thu, Feb 2, 2017 at 8:35 PM, eryk sun wrote: > On Fri, Feb 3, 2017 at 2:22 AM, boB Stepp wrote: >> What would be the best Python 3 module to best assist me in controlling >> the command prompt window display, font colors, positioning the cursor >> dynamically, etc.? &g

[Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
py3: a ['Mary', 'had', 'a', 'little', 'lamb', 'break'] py3: for w in a: ... print(w) ... print('Huh?') File "", line 3 print('Huh?') ^ SyntaxError: invalid syntax I don't understand why this throws a SyntaxError. If I wrap essentially the same code into a function it works: py3

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 4:40 PM, David wrote: > On 5 February 2017 at 09:02, boB Stepp wrote: >> py3: a >> ['Mary', 'had', 'a', 'little', 'lamb', 'break'] >> py3: for w in a: >> ... print(w) >> ...

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 5:44 PM, Alan Gauld via Tutor wrote: > On 04/02/17 22:56, boB Stepp wrote: >> On Sat, Feb 4, 2017 at 4:40 PM, David wrote: >>> On 5 February 2017 at 09:02, boB Stepp wrote: >>>> py3: a >>>> ['Mary', 'h

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread boB Stepp
I'm beginning to believe I am being incredibly dense today ... On Sat, Feb 4, 2017 at 6:16 PM, Ben Finney wrote: > boB Stepp writes: > >> But would it not be more consistent to assume the user knows what he >> is doing based on the new (lack of) indentation being use

[Tutor] Function annotations

2017-02-04 Thread boB Stepp
I just finished looking at https://docs.python.org/3/tutorial/controlflow.html#function-annotations and skimming through PEP 484--Type Hints (https://www.python.org/dev/peps/pep-0484/). My initial impression is that the purpose of function annotations is to enable static code analysis tools like l

[Tutor] sort() method and non-ASCII

2017-02-04 Thread boB Stepp
Does the list sort() method (and other sort methods in Python) just go by the hex value assigned to each symbol to determine sort order in whichever Unicode encoding chart is being implemented? If yes, then my expectation would be that the French "á" would come after the "z" character. I am not r

Re: [Tutor] Function annotations

2017-02-04 Thread boB Stepp
On Sat, Feb 4, 2017 at 9:23 PM, Steven D'Aprano wrote: > On Sat, Feb 04, 2017 at 08:50:00PM -0600, boB Stepp wrote: >> Of course, these are >> apparently optional. I now wonder if I should be endeavoring to add >> these to my code? > > Do you run a linter? If no

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 2:32 AM, Steven D'Aprano wrote: > On Sat, Feb 04, 2017 at 09:52:47PM -0600, boB Stepp wrote: >> Does the list sort() method (and other sort methods in Python) just go >> by the hex value assigned to each symbol to determine sort order in >> whiche

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: > On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: >> Does the list sort() method (and other sort methods in Python) just go >> by the hex value assigned to each symbol to determine sort order in >> whichever Unicode en

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 5:25 PM, Cameron Simpson wrote: > You might want to drop this term "hexadecimal"; they're just ordinals (plain > old numbers). Though Unicode ordinals are often _written_ in hexadecimal for > compactness and because various character grouping are aligned on ranges > based o

Re: [Tutor] sort() method and non-ASCII

2017-02-05 Thread boB Stepp
On Sun, Feb 5, 2017 at 7:23 PM, Steven D'Aprano wrote: > On Sun, Feb 05, 2017 at 04:31:43PM -0600, boB Stepp wrote: >> On Sat, Feb 4, 2017 at 10:50 PM, Random832 wrote: >> > On Sat, Feb 4, 2017, at 22:52, boB Stepp wrote: > Alternatively, you can embed it right in t

Re: [Tutor] sort() method and non-ASCII

2017-02-06 Thread boB Stepp
On Sun, Feb 5, 2017 at 10:49 PM, Cameron Simpson wrote: > On 05Feb2017 22:27, boB Stepp wrote: >> >> On Sun, Feb 5, 2017 at 7:23 PM, Steven D'Aprano >> wrote: >>> >>> Alternatively, you can embed it right in the string. For code points >>>

[Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
I was playing around with type() tonight. If I type (pun intended), I get: py3: type(5) So I naively thought a test for type int should go like: py3: type(5) == "" False Hmm. So I tried these other failing tests: py3: type(5) == File "", line 1 type(5) == ^ SyntaxErro

[Tutor] Python-list thread: int vs. float

2017-02-10 Thread boB Stepp
I have been following the thread "int vs. float" (https://mail.python.org/pipermail/python-list/2017-February/719287.html) on the main list. A search for the OP on the Tutor archive came up negative, so I am hoping he is not following Tutor tonight (Or anytime prior to the due date for his homewor

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
On Fri, Feb 10, 2017 at 7:50 PM, Zachary Ware wrote: > Try `help(repr)` and `int` on its own at the interactive prompt, and py3: help(repr) Help on built-in function repr in module builtins: repr(obj, /) Return the canonical string representation of the object. For many object types, i

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
On Fri, Feb 10, 2017 at 8:05 PM, eryk sun wrote: > Speaking of classes and metaclasses, note that you can't call > int.__repr__(int) to get this representation, because the __repr__ > special method of int is meant for instances of int such as int(5). This bit got me experimenting. Since the in

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
Thanks for the detailed information. I have a final really nitpicky question. On Fri, Feb 10, 2017 at 11:27 PM, eryk sun wrote: > On Sat, Feb 11, 2017 at 4:32 AM, boB Stepp wrote: >> >> This bit got me experimenting. Since the integer "5" is an integer >> object

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
On Fri, Feb 10, 2017 at 11:49 PM, eryk sun wrote: > On Sat, Feb 11, 2017 at 3:22 AM, boB Stepp wrote: >> >> py3: help(repr) >> Help on built-in function repr in module builtins: >> >> repr(obj, /) >> Return the canonical string representation of the

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread boB Stepp
On Sat, Feb 11, 2017 at 12:57 AM, eryk sun wrote: > > The '/' syntax for positional-only arguments is documented in PEP 457. > > https://www.python.org/dev/peps/pep-0457 At https://www.python.org/dev/peps/pep-0457/#id14 in PEP 457 it says: >From the "ten-thousand foot view", and ignoring *arg

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread boB Stepp
On Fri, Feb 10, 2017 at 7:59 PM, boB Stepp wrote: > I have been following the thread "int vs. float" > (https://mail.python.org/pipermail/python-list/2017-February/719287.html) > on the main list. A search for the OP on the Tutor archive came up > negative, so I am hopi

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread boB Stepp
On Sat, Feb 11, 2017 at 11:10 AM, Alex Kleider wrote: > Also of interest (at least to me) was the 'magic' you demonstrated in the > print function parameter list; my efforts to figure it out: Isn't this just argument unpacking? Thus the necessary "*". word = "Hello" print((c for c in

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread boB Stepp
On Sat, Feb 11, 2017 at 11:10 AM, Alex Kleider wrote: > On 2017-02-11 00:36, eryk sun wrote: >> >> Note that Python 3 uses the Unicode database to determine the decimal >> value of characters, if any. It's not limited to the ASCII decimal >> digits 0-9. For example: >> >> >>> s >> '௧꘢୩' >

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread boB Stepp
On Sat, Feb 11, 2017 at 2:06 AM, Steven D'Aprano wrote: > On Fri, Feb 10, 2017 at 07:59:04PM -0600, boB Stepp wrote: > >> He cannot figure out how to reliably tell if the user's input is an >> integer, float or neither. So I thought I would come up with my >

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread boB Stepp
On Sat, Feb 11, 2017 at 7:08 PM, Steven D'Aprano wrote: > On Sat, Feb 11, 2017 at 02:28:42PM -0600, boB Stepp wrote: > >> Back in the main Python list thread, Marko Rauhamaa suggested >> (https://mail.python.org/pipermail/python-list/2017-February/719322.html): >>

Re: [Tutor] Resources/Books for teaching OOP in Python and Tkinter

2017-02-20 Thread boB Stepp
On Sun, Feb 19, 2017 at 10:34 AM, Marie Shaw via Tutor wrote: > I am a teacher of 16-18 year olds. Since September, my classes have been > learning to program in Python, using all of the basics in console mode. > I now need to teach them OOP using Python, and GUI programming using Python. > Pleas

[Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-22 Thread boB Stepp
I am trying to wrap my head around the mechanics of inheritance in Python 3. I thought that all attributes of a superclass were accessible to an instance of a subclass. But when I try the following: py3: class A: ... def __init__(self): ... self.aa = 'class A' ... py3: class B(A)

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-22 Thread boB Stepp
On Wed, Feb 22, 2017 at 10:25 PM, boB Stepp wrote: > I am trying to wrap my head around the mechanics of inheritance in > Python 3. I thought that all attributes of a superclass were > accessible to an instance of a subclass. But when I try the > following: > > py3: clas

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread boB Stepp
Thank you to everyone that provided illumination in this thread! Things seem much clearer now, which caused me to realize that what I wrote below cannot work as written (Even though I did copy and paste it from the interpreter): On Wed, Feb 22, 2017 at 10:53 PM, boB Stepp wrote: > On Wed, Feb

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-23 Thread boB Stepp
On Wed, Feb 22, 2017 at 10:49 PM, Zachary Ware wrote: > On Wed, Feb 22, 2017 at 10:25 PM, boB Stepp wrote: > > I'll give you a couple of hints. First, try this: > > print('defining A') > class A: > print('Setting a on class A') When I typed

Re: [Tutor] Lists of duplicates

2017-03-08 Thread boB Stepp
On Wed, Mar 8, 2017 at 10:29 PM, Alex Kleider wrote: > On 2017-03-08 17:03, Alan Gauld via Tutor wrote: >> >> My first reaction was to sort the initial list then iterate >> over it creating a new sublist for each change of value. >> But, it only works for homogenous lists. For mixed types >> I'd

Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 3:27 AM, Alan Gauld wrote: > OK, the first thing to point out is that software engineering is not the > same as programming. In the same way that civil engineering is not the same > as bricklaying. > > SE is about the skills and practices needed to run repeatable software

Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 6:48 AM, Wayne Werner wrote: > > Rather than simple self-study, why not take advantage of the offerings by > such folks as Coursera, Edx, or Kahn Academy? > I had briefly looked at Kahn Academy quite a while back, but it did not seem (at that time) to have what I needed.

Re: [Tutor] Trailing spaces affect output in a way I don't understand.

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 10:43 PM, Steven D'Aprano wrote: >> What greatly puzzles me is that "GAME" prints correctly, but "OVER" >> does not. Why? > > > Wow! This is a tricky question, but so obvious in hindsight. > > The problem is that you have three lines, all in "OVER", that end with > a backs

Re: [Tutor] Trailing spaces affect output in a way I don't understand.

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 10:55 PM, boB Stepp wrote: > It is funny in retrospect: If I had wanted to create a newline > character I would do the correct thing, but seeing the backslashes as > part of a picture, even after I went into PyScripter's options and > turned on ALL spec

[Tutor] Limitation of int() in converting strings

2012-12-16 Thread boB Stepp
>>> int('10.0') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '10.0' >>> int("10") 10 It is apparent that int() does not like strings with floating-point formats. None of my books (as far as my flipping can tell) or the below built-in

Re: [Tutor] Limitation of int() in converting strings

2012-12-16 Thread boB Stepp
On Sun, Dec 16, 2012 at 10:41 PM, Mitya Sirenef wrote: > What would you want to happen for int("10.5")? If 10.0 was accepted, > it would be consistent to accept 10.5, too. I was expecting int("10.5") to return 10 . > The issue, I think, is that a simple operation should not go too far > beyond

[Tutor] Your thoughts on using Python 2.4.x?

2012-12-18 Thread boB Stepp
At my workplace we have nearly completed the hardware and software upgrades. Up to this point I have been using Perl to write scripts that work with our planning software which has its own proprietary scripting environment. Generally speaking the scripts I write are always text files which run Sola

Re: [Tutor] Your thoughts on using Python 2.4.x?

2012-12-21 Thread boB Stepp
On Fri, Dec 21, 2012 at 5:57 PM, Steven D'Aprano wrote: > Yes; using Python 2.4 is painful compared to Python 3.x because it is > missing so many cool and useful features. 2.4 is quite old now, and > there have been many, many bug-fixes and new features added since then. > > Some of those missing

[Tutor] Runs in IDLE with F5, but not in Windows Command Prompt

2013-04-24 Thread boB Stepp
In my on again, off again studies of Python I am stumped on something that ought to be trivial, but I am not seeing it. When I run this program (only the part up to where the error occurs is shown): import random numberToGuess = random.randint(1, 20) numberOfGuesses = 0 print("Hello! What is yo

<    1   2   3   4   5   6   7   >