Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread boB Stepp
On Tue, Jul 30, 2019 at 7:26 PM Mats Wichmann wrote: > > On 7/30/19 5:58 PM, Alan Gauld via Tutor wrote: > > On 30/07/2019 17:21, boB Stepp wrote: > > > >> musings I am wondering about -- in general -- whether it is best to > >> store calculated data valu

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread boB Stepp
On Tue, Jul 30, 2019 at 7:05 PM Alan Gauld via Tutor wrote: > > On 30/07/2019 18:20, boB Stepp wrote: > > > What is the likelihood of file storage corruption? I have a vague > > sense that in earlier days of computing this was more likely to > > happen, but nowadays?

Re: [Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread boB Stepp
On Tue, Jul 30, 2019 at 12:05 PM Zachary Ware wrote: > > On Tue, Jul 30, 2019 at 11:24 AM boB Stepp wrote: > > In this trivial example I cannot imagine there is any realistic > > difference between the two approaches, but I am trying to generalize > > my thoughts f

[Tutor] Which is better in principle: to store (in file) calculated data or to re-calculate it upon restarting program?

2019-07-30 Thread boB Stepp
I have been using various iterations of a solitaire scorekeeper program to explore different programming thoughts. In my latest musings I am wondering about -- in general -- whether it is best to store calculated data values in a file and reload these values, or whether to recalculate such data

[Tutor] Unit testing: Just the API or internal use only methods, too?

2019-07-16 Thread boB Stepp
Peter Otten, while responding to one of my questions in the past, mentioned something in passing that apparently has been mulling around in the back of my head. I don't recall his exact words, but he essentially said that I should be testing the public interface to my classes, but not the methods

Re: [Tutor] Python 3.7 Grids

2019-06-29 Thread boB Stepp
On Sat, Jun 29, 2019 at 2:02 AM David Merrick wrote: > > Hi Looking for a way to use the determine the position of a card in a grid > using the mouse click event in Python. Code is attached. There are no > viruses. > > Unfortunately using Tinkter grids / frames can't determine between the two >

Re: [Tutor] Query about python recipies for practices

2019-05-27 Thread boB Stepp
On Sun, May 19, 2019 at 12:55 PM bijaya dalei <2212bij...@gmail.com> wrote: > > Hii, Good morning. I am a new user of python programming language. I have a > small query on "where to get python recepies for practices".plz > suggest.Thanks. It is not very clear to me what you are asking for, which

Re: [Tutor] Looking for some direction

2019-05-12 Thread boB Stepp
On Sun, May 12, 2019 at 5:19 PM boB Stepp wrote: > > On Sun, May 12, 2019 at 1:05 PM David L Neil > wrote: > > > I'm using Gnome Terminal under Fedora (Linux). This allows multiple > > terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it > > irri

Re: [Tutor] Looking for some direction

2019-05-12 Thread boB Stepp
On Sun, May 12, 2019 at 1:05 PM David L Neil wrote: > I'm using Gnome Terminal under Fedora (Linux). This allows multiple > terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it > irritates me that whilst I can set "profiles" for particular purposes; > there does not seem to be a

Re: [Tutor] Local variable look up outside the function and method

2019-05-12 Thread boB Stepp
On Sun, May 12, 2019 at 8:05 AM Arup Rakshit wrote: > > In the following the function, x is reachable outside the scope of foo > function. > > In [1]: x = 10 > > In [2]: def foo(): >...: return x >...: > > In [3]: print(foo()) > 10 To what the others have said I wish to point out

Re: [Tutor] Collating date data from a csv file

2019-05-08 Thread boB Stepp
On Wed, May 8, 2019 at 10:29 PM boB Stepp wrote: > > On Wed, May 8, 2019 at 10:09 PM Cameron Simpson wrote: > > > > A defaultdict is a dict which magicly makes missing elements when they > > get access, using a factory function you supply. Here we're using "int

Re: [Tutor] Collating date data from a csv file

2019-05-08 Thread boB Stepp
On Wed, May 8, 2019 at 10:09 PM Cameron Simpson wrote: > > A defaultdict is a dict which magicly makes missing elements when they > get access, using a factory function you supply. Here we're using "int" > as that factory, as int() returns zero. Is int() guaranteed to always return zero as

Re: [Tutor] Off-Topic: Tutor group specific to Java

2019-04-19 Thread boB Stepp
On Wed, Apr 17, 2019 at 11:09 AM Karthik Bhat wrote: > > Hello Guys, > This is kind of off-topic, but I would really appreciate it if > anyone could provide me with a tutor mailing list/group specific to Java. > I am a beginner, and it would be really helpful for me. Try Java Ranch:

[Tutor] Questions about the deprecation of standard library modules

2019-03-30 Thread boB Stepp
While reading in chapter 3 of "Learning Python, 5th ed." by Mark Lutz, I was playing around with reload() in the imp module. In the interpreter I did a "from imp import reload" and then help(reload). This had a warning that it was deprecated. After a search online I found that the entire imp

Re: [Tutor] [OT] Problem with auto-complete package installation in Atom [Was: Re: After virtualenv, how to use ide]

2019-03-24 Thread boB Stepp
On Sun, Mar 24, 2019 at 8:51 PM anand warik wrote: > > I am sorry for not sticking to my original question but editors are > complicated in itself. So many costimization instruction to read through just > to finally execute a simple .Py file which can be just executed using the > terminal. > >

Re: [Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-24 Thread boB Stepp
Oh, happy day! eval() has been expunged from my program!! I will now continue from where I left off earlier. On Sun, Mar 24, 2019 at 12:22 AM Cameron Simpson wrote: > > On 23Mar2019 22:15, boB Stepp wrote: > > The lambda is just a single line function definition, and doesn't get

[Tutor] [OT] Problem with auto-complete package installation in Atom [Was: Re: After virtualenv, how to use ide]

2019-03-24 Thread boB Stepp
On Sun, Mar 24, 2019 at 2:45 AM anand warik wrote: > > I gave up on Spyder and shifted to Atom, which seems easy to port to > different versions of python created by virtual environments. But now facing > a new problem. I have installed a package named autocomplete-python on atom > but it

Re: [Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-24 Thread boB Stepp
, Mar 24, 2019 at 12:22 AM Cameron Simpson wrote: > > Discussion below your post here, since I feel I should quote it all: > > On 23Mar2019 22:15, boB Stepp wrote: > >Traceback (most recent call last): > > File "pages_per_day.py", line 250, in > >start_

[Tutor] How to avoid "UnboundLocalError: local variable 'goal_year' referenced before assignment"?

2019-03-23 Thread boB Stepp
I have just written a small program earlier today to allow the user (me) to enter a date by which I wish to finish reading a book (= massive programming-related book) and calculate how many pages I need to read each day (starting today) in order to finish the book by the target date. Looking over

Re: [Tutor] After virtualenv, how to use ide

2019-03-23 Thread boB Stepp
On Sat, Mar 23, 2019 at 12:50 PM anand warik wrote: > > I had installed Python on Ubuntu 14.04 using Anaconda package long back > after failing to install independently for a long time. I was quietly using > it's packaged ide Spyder and had no troubles, in fact I love spider more > then atom. I

Re: [Tutor] Is this the preferred way to change terminal screen color using curses?

2019-03-02 Thread boB Stepp
On Sat, Mar 2, 2019 at 4:28 PM Cameron Simpson wrote: > Is the painting of the screen with spaces actually required? I would > have thought not (again, untested). The main window (stdscr) should > start filled with spaces. I had read this along the way, but had forgotten it. > [Reads more

[Tutor] Is this the preferred way to change terminal screen color using curses?

2019-03-02 Thread boB Stepp
I wanted to be able to change the background screen color of a terminal window using curses. My weak Google-Foo did not turn up a clear example of how to do this despite much searching. The two _obvious_curses methods to attempt this seemed to be window.bkgdset(ch, attr) to initially set a

Re: [Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

2019-02-27 Thread boB Stepp
On Wed, Feb 27, 2019 at 6:50 PM Chip Wachob wrote: > > Hello again, > > As always, this list has been very helpful, and thank you. > > So, I thought I was good to go until I attempted to run my code on a > Windows 7 vintage machine this morning. The application is intended to be > run in the

Re: [Tutor] Why does using "window.addchr()" to place a character at the lower right corner raise an exception?

2019-02-27 Thread boB Stepp
On Wed, Feb 27, 2019 at 8:09 PM Alex Kleider wrote: > > On 2019-02-27 17:48, boB Stepp wrote: > > Under https://docs.python.org/3/library/curses.html#window-objects in > > the curses docs, it states: > > > > > > window.addch(ch[, attr]) > > window.addc

[Tutor] Why does using "window.addchr()" to place a character at the lower right corner raise an exception?

2019-02-27 Thread boB Stepp
Under https://docs.python.org/3/library/curses.html#window-objects in the curses docs, it states: window.addch(ch[, attr]) window.addch(y, x, ch[, attr]) [...] Note Writing outside the window, subwindow, or pad raises a curses.error. Attempting to write to the lower right corner of a window,

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-24 Thread boB Stepp
On Sun, Feb 24, 2019 at 4:40 PM Cameron Simpson wrote: > I've modified your script. Please try the script appended below. The > short answer is that resizeterm() is _not_ normally useful to you, the > programmer; it will only be useful if curses does not get to notice > terminal size changes -

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-24 Thread boB Stepp
On Sun, Feb 24, 2019 at 2:52 PM Mats Wichmann wrote: > > On 2/24/19 1:30 PM, boB Stepp wrote: > > > So what am I misunderstanding? Can someone show me a code snippet > > that I can run which will demonstrate the usefulness and usage of > > curses.resizeterm()? &

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-24 Thread boB Stepp
On Sun, Feb 24, 2019 at 4:40 PM Cameron Simpson wrote: > > On 24Feb2019 14:30, boB Stepp wrote: > >What you say makes sense and supports much of what I had concluded > >from my coding experiments. However, I still cannot get the function > >call, curses.resizeterm(), t

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-24 Thread boB Stepp
On Sun, Feb 24, 2019 at 1:39 AM Cameron Simpson wrote: > It looks like the resizeterm() function updates the curses _internal_ > records of what it believes the physcial terminal size to be. When you > physically resize a terminal the processes within it receive a SIGWINCH > signal, and those

[Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-23 Thread boB Stepp
I am trying to understand the functionality that the Python module, curses, provides. But I am stuck on how to use the command, curses.resizeterm(nlines, ncols). At https://docs.python.org/3/library/curses.html#curses.resizeterm it says: curses.resizeterm(nlines, ncols)¶ Resize the standard

[Tutor] Good tutorials about Python 2 and 3 OOP by Leonardo Giordani

2019-02-13 Thread boB Stepp
I have stumbled upon some articles by Leonardo Giordani that deal with OOP in Python. He has two sets of articles. The one concerning Python 2 is located at: http://blog.thedigitalcatonline.com/blog/2014/03/05/oop-concepts-in-python-2-dot-x-part-1/ The one concerning Python 3 is at:

[Tutor] Fwd: [Tkinter-discuss] New docs: using tkinter GUIs on Android

2019-02-10 Thread boB Stepp
I thought that this might be of interest to the group for those who do not follow the Tkinter mailing list as I have seen questions here about how to do Python GUIs in Android where the usual response is to try Kivy. Perhaps there is now a tkinter solution? -- Forwarded message -

Re: [Tutor] Putting a Bow on It

2019-02-09 Thread boB Stepp
On Fri, Feb 8, 2019 at 12:35 PM Chip Wachob wrote: > > Hello, > > I've been off working on other projects, but I'm finally back to the > project that so many here have helped me work through. Thank you to the > group at large. > > So, this leads me to my question for today. > > I'm not sure what

[Tutor] OT: A bit of humor related to my sporadic quest to learn Python

2019-01-13 Thread boB Stepp
My son sent me this link, which I think captures my situation with Python quite nicely: https://cdn-images-1.medium.com/max/720/1*7RZKI-g4K_syDf6XQEGWKw.jpeg -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Defining variable arguments in a function in python

2018-12-31 Thread boB Stepp
On Mon, Dec 31, 2018 at 10:36 AM David Rock wrote: > > > On Dec 30, 2018, at 18:39, Alan Gauld via Tutor wrote: > > > > On 30/12/2018 22:25, Avi Gross wrote: > > > >> I admit I have not studied the charter for the group. > > > > As moderator I feel the need to step in here because the > >

Re: [Tutor] loop error

2018-12-20 Thread boB Stepp
Greetings Aine! On Thu, Dec 20, 2018 at 6:57 PM Aine Gormley wrote: > > Hello, could somebody take a quick look at my code? I am unsure why I am > getting a loop error? This is a plain text only list that does not (typically) allow file attachments. So I do not see any code. So if you wish

Re: [Tutor] (no subject)

2018-10-27 Thread boB Stepp
Greetings! On Sat, Oct 27, 2018 at 6:48 AM Jesse Stockman wrote: > > Hi there > > I need to draw a patten with turtle in python 3.7 but I cant get it to work > ... What is the problem? Describe what you expected to happen, what did happen, and *copy and paste* the Traceback that Python

Re: [Tutor] Fwd: Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-22 Thread boB Stepp
On Mon, Oct 22, 2018 at 11:57 AM Mats Wichmann wrote: > > On 10/22/18 8:24 AM, boB Stepp wrote: > > Forwarding to the Tutor list. Herr Maier offers a good idea that > > would take away much of a remaining issue -- the name "Temporary". I > > need to look into

Re: [Tutor] What is the best way for a program suite to know where it is installed?

2018-10-22 Thread boB Stepp
On Mon, Oct 22, 2018 at 9:47 AM Mats Wichmann wrote: > > On 10/20/18 9:00 PM, boB Stepp wrote: > > So far the best method I've come up with is to make use of "__file__" > > for the initiating program file. But from past discussions I am not > > certain this is

[Tutor] Fwd: Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-22 Thread boB Stepp
Oct 22, 2018 at 5:25 AM Subject: Re: Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files? To: boB Stepp On 21.10.18 08:13, boB Stepp wrote: > Use case: I want to allow a user of my Solitaire Scorekeeper program > to be able to give any

Re: [Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread boB Stepp
On Sun, Oct 21, 2018 at 1:47 AM Quentin Agren wrote: > > Hi Robert, > > Far from being an expert, my two cents on this: > > - As I understand it, you should at least use the 'dir' parameter to > NamedTemporaryFile, otherwise your files will be created in a '/tmp/'-like > directory that may be

[Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-21 Thread boB Stepp
Use case: I want to allow a user of my Solitaire Scorekeeper program to be able to give any name he wants to each game of solitaire he wishes to record. My thought for permanent storage of each game's parameters is to use a dictionary to map the user-chosen game names to a unique json filename.

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
On Sat, Oct 20, 2018 at 11:21 PM Alex Kleider wrote: > > On 2018-10-20 14:52, boB Stepp wrote: > > > >> > In case it helps, my current project structure is: > >> > > >> > ~/Projects/solitaire_scorekeeper/# I left off the actual project &g

[Tutor] What is the best way for a program suite to know where it is installed?

2018-10-20 Thread boB Stepp
I was just re-reading the entire thread at https://www.mail-archive.com/tutor@python.org/msg77864.html And I have asked similar questions previous to that thread. I still do not have a satisfactory answer for the subject line's question that both makes sense to me and seems to be good

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
On Sat, Oct 20, 2018 at 1:36 PM Peter Otten <__pete...@web.de> wrote: > > boB Stepp wrote: > > > Linux Mint 19 Cinnamon, Python 3.6.6 [snip] > > I was expecting this error and will shortly correct it. So my > > question remains, when are "__init__.py" fi

[Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
Linux Mint 19 Cinnamon, Python 3.6.6 I would have sworn that I had read, either on this list or the main Python list, that in the most recent versions of Python 3 that "__init__.py" files were no longer needed in nested project file structures. But when I attempted to run tests for the first

Re: [Tutor] Advanced python recommendations

2018-10-10 Thread boB Stepp
On Wed, Oct 10, 2018 at 12:09 PM Mats Wichmann wrote: > This is actually the concept of test driven development (TDD), which I'm > not a huge proponent of personally, but kind of useful for this: I'm curious: What are the things you find less than satisfactory for TDD? -- boB

Re: [Tutor] Advanced python recommendations

2018-10-09 Thread boB Stepp
On Tue, Oct 9, 2018 at 6:54 PM Mariam Haji wrote: > > Hi guys, I am on the last exercises of learn python the hard by Zed.A Shaw > and I am looking for recommendations on what to follow next or what book to > try next to advance my python skills to intermediate level. If you are a fan of Zed

[Tutor] OT: How to automate the setting of file permissions for all files in a collection of programs?

2018-08-29 Thread boB Stepp
At work I have accumulated a motley collection of programs I have written since I started around 2012. These all run on the Solaris OS. As long-time readers of my past ramblings may recall, I am not allowed to install any outside programs on this Solaris system, but I am allowed to write my own

Re: [Tutor] Contour Plots

2018-08-28 Thread boB Stepp
Welcome Tara! On Tue, Aug 28, 2018 at 6:46 PM Tara 38 wrote: > > Hi, > > > I wonder if someone can give me some advice? I need to build a contour plot > (ideally with Seaborn) in python. The plot would document text data. I cannot > work out how I need to convert the data file (currently csv

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-27 Thread boB Stepp
On Mon, Aug 27, 2018 at 3:44 AM Alan Gauld via Tutor wrote: > > On 27/08/18 04:58, boB Stepp wrote: > >> Maybe JSON for that? Or even a shelve database? > > > > I plan to keep this simple. I will use a ".cfg" file to store game > > configuration inform

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-26 Thread boB Stepp
On Sun, Aug 26, 2018 at 6:10 PM Alan Gauld via Tutor wrote: > > On 26/08/18 23:38, boB Stepp wrote: > > > class SolitaireGame(): > > def __init__(self, name): > > self.name = name > > > Say I go with the aforementioned game with 13 separate sco

Re: [Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-26 Thread boB Stepp
On Sun, Aug 26, 2018 at 7:48 PM Steven D'Aprano wrote: > > On Sun, Aug 26, 2018 at 05:38:52PM -0500, boB Stepp wrote: > > > I feel that I may be missing something truly obvious. I am pondering > > the design of a solitaire scorekeeper program. It is just meant to

[Tutor] How to have unique identifiers for multiple object instances of a given class?

2018-08-26 Thread boB Stepp
Python 3.6.6, Linux Mint I feel that I may be missing something truly obvious. I am pondering the design of a solitaire scorekeeper program. It is just meant to be an electronic scorekeeper for hands of solitaire that I plan with a "real" deck of cards, instead of a computer game. I might want

Re: [Tutor] How to write a function which reads files

2018-08-08 Thread boB Stepp
On Wed, Aug 8, 2018 at 8:30 PM boB Stepp wrote: > > On Tue, Aug 7, 2018 at 9:13 AM Rafael Knuth wrote: Curses! Sorry, Chris! This should be: > > Chris Warrick wrote: > > > Also, consider using snake_case instead of PascalCase for your > > > function name, sinc

Re: [Tutor] How to write a function which reads files

2018-08-08 Thread boB Stepp
On Tue, Aug 7, 2018 at 9:13 AM Rafael Knuth wrote: > Alan Gauld wrote: > > Also, consider using snake_case instead of PascalCase for your > > function name, since the latter is typically used for classes, and > > perhaps call it read_file to better describe it? > > thanks, I wasn't aware of the

Re: [Tutor] Questions about the formatting of docstrings

2018-07-27 Thread boB Stepp
On Fri, Jul 27, 2018 at 12:50 AM Steven D'Aprano wrote: > > On Thu, Jul 26, 2018 at 11:34:11PM -0500, boB Stepp wrote: > > (1) The author claims that reStructuredText is the official Python > > documentation standard. Is this true? If yes, is this something I > > sh

[Tutor] Questions about the formatting of docstrings

2018-07-26 Thread boB Stepp
I am near the end of reading "Documenting Python Code: A Complete Guide" by James Mertz, found at https://realpython.com/documenting-python-code/ This has led me to a few questions: (1) The author claims that reStructuredText is the official Python documentation standard. Is this true? If

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-15 Thread boB Stepp
On Sat, Jul 14, 2018 at 8:23 PM Mats Wichmann wrote: > > take a look at pyenv. should make it fairly easy. > > https://github.com/pyenv/pyenv I just completed getting access to Python 3.6.6 using pyenv, so I guess I'll post my experience for future searchers. It was not totally painless, and I

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-15 Thread boB Stepp
On Sun, Jul 15, 2018 at 3:30 PM Terry Carroll wrote: > That being said, if you do want to update to the latest version available > for Mint, this command should do it for you: > >sudo apt-get install --only-upgrade python3 > > If Mint doesn't have a vetted 3.6.6 yet, I would leave it alone.

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-15 Thread boB Stepp
On Sun, Jul 15, 2018 at 1:38 AM boB Stepp wrote: > > On Sat, Jul 14, 2018 at 11:52 PM boB Stepp wrote: > > > > On Sat, Jul 14, 2018 at 8:43 PM boB Stepp wrote: > > > > > > On Sat, Jul 14, 2018 at 8:23 PM Mats Wichmann wrote: > > > > > >

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-15 Thread boB Stepp
On Sat, Jul 14, 2018 at 11:52 PM boB Stepp wrote: > > On Sat, Jul 14, 2018 at 8:43 PM boB Stepp wrote: > > > > On Sat, Jul 14, 2018 at 8:23 PM Mats Wichmann wrote: > > > > > > take a look at pyenv. should make it fairly easy. > > > > > >

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-14 Thread boB Stepp
On Sat, Jul 14, 2018 at 8:43 PM boB Stepp wrote: > > On Sat, Jul 14, 2018 at 8:23 PM Mats Wichmann wrote: > > > > take a look at pyenv. should make it fairly easy. > > > > https://github.com/pyenv/pyenv > > This does look interesting. On the linked page, afte

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-14 Thread boB Stepp
On Sat, Jul 14, 2018 at 8:23 PM Mats Wichmann wrote: > > take a look at pyenv. should make it fairly easy. > > https://github.com/pyenv/pyenv This does look interesting. On the linked page, after installing and configuring pyenv, it says to install Python as follows giving a 2.7.8 example: $

Re: [Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-14 Thread boB Stepp
On Sat, Jul 14, 2018 at 8:18 PM Jim wrote: > If you look you might find a PPA that has packaged it. I installed > python 3.6.5 (no help to you) on Mint 18 from here: > https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6'. That is an interesting thought. My only concern is how does one

[Tutor] Wish to upgrade Python 3.6.5 to Python 3.6.6 for Linux Mint 19

2018-07-14 Thread boB Stepp
I have finally taken the plunge and abandoned Windows for Linux Mint 19. I had been doing a dual-boot, but I found I spent most of my time where I was comfortable -- Windows 7 -- and mostly avoided my Linux installation. So I took my pacifier away and went for it! Linux Mint 19 comes with

Re: [Tutor] learn python to build payment processor

2018-07-11 Thread boB Stepp
On Wed, Jul 11, 2018 at 9:01 PM Mats Wichmann wrote: From: > (see https://www.python.org/dev/peps/pep-0020/) It says: "Abstract Long time Pythoneer Tim Peters succinctly channels the BDFL's guiding principles for Python's design into 20 aphorisms, only 19 of which have been written down." What

Re: [Tutor] egg timer

2018-06-24 Thread boB Stepp
Greetings, Paula! On Sun, Jun 24, 2018 at 4:52 PM Paula Malimba wrote: > > Hello, > > I'm new to programming and am studying the book Begin to Code with Python. > I'm stuck in lesson 3, trying to make an egg timer. I keep having a syntax > error. > > Please help!!! Please pretend for a moment

Re: [Tutor] Nested use of replication operator on lists

2018-05-26 Thread boB Stepp
24, 2018 at 10:33:56PM -0500, boB Stepp wrote: > The result of list * 3 is always a list. What matters is the items > inside the list. > > What the * operator does is create a new list containing the entries of > the old list repeated. I was not properly appreciating that that the

[Tutor] Nested use of replication operator on lists

2018-05-24 Thread boB Stepp
On Python-list Steve started a thread, "List replication operator" (https://mail.python.org/pipermail/python-list/2018-May/733513.html) and wrote the following: Python has a sequence replication operator: py> [1, 2]*3 [1, 2, 1, 2, 1, 2] Unfortunately, it is prone to a common "gotcha": py> x

Re: [Tutor] Help

2018-05-15 Thread boB Stepp
On Tue, May 15, 2018 at 7:51 PM, Steven D'Aprano wrote: > You also seem to be using Python 2. In Python 2, you should never use > the input() function. Instead, use raw_input() instead. What are you seeing that suggests the OP is using Python 2? I am missing what you are

Re: [Tutor] Help

2018-05-15 Thread boB Stepp
Greetings! On Tue, May 15, 2018 at 2:49 PM, Sam Hoffman wrote: > Traceback (most recent call last): > File "/Users/samhoffman/Documents/test.py", line 54, in > Battle() > File "/Users/samhoffman/Documents/test.py", line 41, in Battle > Move = input('What

Re: [Tutor] Iteration issues

2018-05-10 Thread boB Stepp
On Wed, May 9, 2018 at 6:27 PM, Roger Lea Scherer wrote: > Hello, again. > > I want to count words in a text file. If a word repeats I want to increase > the count by 1; if the word is new to the dictionary, I want to add the > word to the dictionary. Everything works like I

Re: [Tutor] Iteration issues

2018-05-10 Thread boB Stepp
Greetings! On Wed, May 9, 2018 at 6:27 PM, Roger Lea Scherer wrote: > Hello, again. > > I want to count words in a text file. If a word repeats I want to increase > the count by 1; if the word is new to the dictionary, I want to add the > word to the dictionary. Everything

Re: [Tutor] How to separate UI code from program logic?

2018-05-08 Thread boB Stepp
On Mon, May 7, 2018 at 12:26 AM, boB Stepp <robertvst...@gmail.com> wrote: > def get_collatz_number(integer): > """Returns the Collatz sequence number corresponding to integer. integer > must be > 0, or the sequence will not converge to 1.""&quo

Re: [Tutor] How to separate UI code from program logic?

2018-05-06 Thread boB Stepp
On Sun, May 6, 2018 at 5:05 PM, Alan Gauld <alan.ga...@yahoo.co.uk> wrote: > On 6 May 2018, at 23:00, boB Stepp <robertvst...@gmail.com> wrote: >>My understanding of best practice here is that I should not have any >>print() calls inside my generate_collatz_sequence() f

Re: [Tutor] How to separate UI code from program logic?

2018-05-06 Thread boB Stepp
On Sun, May 6, 2018 at 5:05 PM, Alan Gauld <alan.ga...@yahoo.co.uk> wrote: > On 6 May 2018, at 23:00, boB Stepp <robertvst...@gmail.com> wrote: >>My understanding of best practice here is that I should not have any >>print() calls inside my generate_collatz_sequence() f

Re: [Tutor] Need help with a virtual environment mess

2018-05-06 Thread boB Stepp
On Sun, May 6, 2018 at 11:05 AM, Jim wrote: > In a prior thread you guys helped me fix a problem with pip after I upgraded > an installed version of python 3.6 on my Mint 18 system. Pip would not run > in my python 3.6 virtual environment. The fix was to use synaptic to

[Tutor] How to separate UI code from program logic?

2018-05-06 Thread boB Stepp
I was solving a programming problem in one of my books concerning the generation of a Collatz sequence (https://en.wikipedia.org/wiki/Collatz_conjecture), and started to wonder how I should separate my program's output from its logic. It seems like this should be obvious to me, but,

Re: [Tutor] Extract main text from HTML document

2018-05-05 Thread boB Stepp
On Sat, May 5, 2018 at 12:59 PM, Simon Connah wrote: > I was wondering if there was a way in which I could download a web > page and then just extract the main body of text without all of the > HTML. I do not have any experience with this, but I like to collect books.

Re: [Tutor] Pi approximation

2018-03-28 Thread boB Stepp
I see I wrote the below a little too quickly! Don't forget to take the reciprocal when printing. You might want to modify my naming of variables to reflect this. And return the reciprocal, which actually gives the pi approximation in the function form. On Wed, Mar 28, 2018 at 9:08 PM, boB

Re: [Tutor] Pi approximation

2018-03-28 Thread boB Stepp
On Wed, Mar 28, 2018 at 2:09 PM, Roger Lea Scherer wrote: > In one of my lessons I am asked to compare approximations for pi. I got > everything to work properly and my attempt is successful and matches > Python's approximation up to 15 digits to the right of the decimal, but I

Re: [Tutor] Pong using python

2018-02-13 Thread boB Stepp
Greetings! On Mon, Feb 12, 2018 at 8:49 PM, wrote: > Tutor, > > Are you aware/familiar with DeVry University using python to educate > students using a PONG game? You should assume that we do not. But we probably can help you if you provide a specific, targeted

Re: [Tutor] Does Python and its standard libraries use semantic versioning?

2018-02-10 Thread boB Stepp
On Sat, Feb 10, 2018 at 5:34 PM, Alex Kleider <aklei...@sonic.net> wrote: > On 2018-02-10 01:07, Alan Gauld via Tutor wrote: >> >> On 10/02/18 05:44, boB Stepp wrote: >>> >>> I have been reading the interesting web page "Semantic Versioning > >

[Tutor] Does Python and its standard libraries use semantic versioning?

2018-02-09 Thread boB Stepp
I have been reading the interesting web page "Semantic Versioning 2.0.0" at https://semver.org/ I like how its use can supposedly make "dependency hell" a thing of the past. So I am wondering if Python and its standard libraries make use of semantic versioning as described in this article? But

Re: [Tutor] Java equivalent of Python-Tutor?

2018-02-07 Thread boB Stepp
On Wed, Feb 7, 2018 at 2:06 PM, Terry Carroll wrote: > > In my early days of using Python I benefited greatly from this Tutor list, > thanks to both Alan and Steven as well as as many contributors. I still check > in now and then and try to chime in to help now that I have a

[Tutor] Do _all_ Python builtin methods/functions return "None" IF ...

2018-01-26 Thread boB Stepp
... they are not designed to explicitly return something else? The reason I ask is that I almost fell into the following trap: py3: a_lst = [0, 1, 2] py3: b_lst = a_lst.append(3) py3: a_lst, b_lst ([0, 1, 2, 3], None) Instead of "None" I was expecting "[0, 1, 2, 3]". Obviously I have a GCE

[Tutor] When is and isn't "__file__" set?

2018-01-10 Thread boB Stepp
I am actually interested in the answer to this question for Python versions 2.4, 2.6 and 3.x. At https://docs.python.org/3/reference/import.html?highlight=__file__#__file__ it says: __file__ is optional. If set, this attribute’s value must be a string. The import system may opt to leave

Re: [Tutor] Testing

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 5:38 PM, Steven D'Aprano wrote: > I've tried emailing in response to the os.path.realpath thread twice, > and neither email has made it through. > > Alan, am I stuck in the moderator queue for some reason? This one made it through. My original answer

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 8:32 AM, Alan Gauld via Tutor <tutor@python.org> wrote: > On 07/01/18 09:07, boB Stepp wrote: >> clarify this? What is the methodology that os.path.realpath(path) is >> actually following to yield a particular path name? And why does it >> not ca

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 4:51 AM, Albert-Jan Roskam wrote: > > On Jan 7, 2018 09:08, Steven D'Aprano wrote: >> realpath() returns the canonical path of the given filename. It doesn't >> try to locate some actual existing file. > > I always thought

Re: [Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-07 Thread boB Stepp
On Sun, Jan 7, 2018 at 2:05 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Sun, Jan 07, 2018 at 12:49:59AM -0600, boB Stepp wrote: > >> Win7, Python 3.6.2 >> >> If I run a unit test with the following embedded: >> >> print('realpath =', os.

[Tutor] Why does os.path.realpath('test_main.py') give different results for unittest than for testing statement in interpreter?

2018-01-06 Thread boB Stepp
Win7, Python 3.6.2 If I run a unit test with the following embedded: print('realpath =', os.path.realpath('test_main.py')) I get the following in my test output (Only relevant line is shown): Ensure expected list of string integers is returned. ... realpath =

[Tutor] How to handle passwords in programs that perform FTP processes?

2018-01-03 Thread boB Stepp
Python 2.4, Solaris 10. I have several programs that must transfer files from our Solaris 10-based intranet to our Windows-based intranet. They each have their own shell script to perform these file transfers, each customized for each program. Today I wrote a Python 2 program using the ftplib

[Tutor] Is len(a_list) a computed value or a stored attribute of a_list?

2017-12-31 Thread boB Stepp
I was wondering if len(a_list) is computed on the fly or is it a stored attribute of the a_list object? And is the answer the same for both Python 2 and 3? -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] Finding written and video tutorials for Python [Was: IDLE]

2017-12-31 Thread boB Stepp
I am renaming this thread as it has drifted off its original subject. On Sat, Dec 30, 2017 at 9:53 AM, nelson jon kane wrote: > Thanks. What do you mean when you say "find a written tutorial"? > > > > From: Tutor

Re: [Tutor] Code

2017-12-19 Thread boB Stepp
Welcome to Tutor! We won't do your homework for you, but will help you if you get stuck. Normally you would show us your current best coding effort and we would help you from there. On Tue, Dec 19, 2017 at 6:22 PM, Vinay Rao wrote: > Hi, > > We need help coding the range

Re: [Tutor] Aggregation vs Composition

2017-12-10 Thread boB Stepp
I own this book, too. I'll insert the portions of the text that I believe the OP is referring to. On Sun, Dec 10, 2017 at 3:01 AM, Alan Gauld via Tutor wrote: > On 10/12/17 05:07, jia yue Kee wrote: > >> in Dusty Philips's Python 3: Object-Oriented >> Programming book. > >

Re: [Tutor] FW: confused about Pypi

2017-10-29 Thread boB Stepp
On Sun, Oct 29, 2017 at 3:05 AM, Mark Anderson wrote: > The text is > > C:\Users\marka> python -m pip install "pyglet" > 'python' is not recognized as an internal or external command, > operable program or batch file. I'm on Windows 7, but I have found when I have not

Re: [Tutor] problem with program in python in easy steps

2017-10-26 Thread boB Stepp
On Thu, Oct 26, 2017 at 3:02 PM, Chris Coleman wrote: > > i wrote these programs and saved them per instructions on page 128 and 129 > in the book "python in easy steps". > > class Person: > '''A base class to define Person properties.''' > def__init__(self,name): The

  1   2   3   4   5   6   7   >