Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-12 Thread boB Stepp
On Tue, Sep 12, 2017 at 2:17 PM, Mats Wichmann wrote: > On 09/12/2017 01:05 PM, boB Stepp wrote: >> As I continue to read about SQL, one thing jumps out: There are many >> differences between how SQL statements are implemented among the >> different database products. Even

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-12 Thread boB Stepp
On Tue, Sep 12, 2017 at 8:58 PM, boB Stepp wrote: > On Tue, Sep 12, 2017 at 2:17 PM, Mats Wichmann wrote: >> On 09/12/2017 01:05 PM, boB Stepp wrote: >>> As I continue to read about SQL, one thing jumps out: There are many >>> differences between how SQL statement

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-13 Thread boB Stepp
On Wed, Sep 13, 2017 at 2:41 AM, Alan Gauld via Tutor wrote: > The classic approach is to have 3 tiers in the architecture. > 1) UI layer - usually a GUI toolkit - the VC part of MVC > 2) Business logic - its the M bit of MVC... and where most OOP happens > 3) data access - the ugly underbelly wh

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-13 Thread boB Stepp
On Wed, Sep 13, 2017 at 2:55 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: >> >> And these would be the SQL commands/statements I would have >> cursor.execute use from the sqlite3 module. They would be different >> depending on which database pr

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-13 Thread boB Stepp
I forgot one other thing you mentioned that I had a question about. On Wed, Sep 13, 2017 at 2:41 AM, Alan Gauld via Tutor wrote: > If you limit your SQL to queries fetching raw fields you > should find you are working with the portable subset of > standard SQL most of the time. Basically you are

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-15 Thread boB Stepp
On Thu, Sep 14, 2017 at 2:06 AM, Peter Otten <__pete...@web.de> wrote: > That's the "Law of leaky abstractions", > https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/ Thanks for the link to this article. I really enjoyed reading it. In fact, so far every article I have read

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-15 Thread boB Stepp
On Wed, Sep 13, 2017 at 11:33 PM, Mark Lawrence via Tutor wrote: > SQLAlchemy isn't the only Python ORM of course. There is a useful little > article about ORMs and their availability here > https://www.fullstackpython.com/object-relational-mappers-orms.html. A more > detailed comparison is giv

Re: [Tutor] Python programming for the absolute beginner

2017-09-30 Thread boB Stepp
On Fri, Sep 29, 2017 at 1:20 PM, Alan Gauld via Tutor wrote: > On 29/09/17 08:51, Peter Collidge wrote: >> I have borrowed the above book from my local library but I believe it was >> written in 2010 and as a result I am having difficulty in deciding which >> version of Python to download. >> Can

Re: [Tutor] OT: how to best follow the posting style on this list

2017-09-30 Thread boB Stepp
On Fri, Sep 29, 2017 at 9:55 AM, Albert-Jan Roskam wrote: > > Hi, > > I often read messages to this list from my Android from the mobile Hotmail > page. On other occasions I would read from my browser, from a Windows or a > Linux desktop. Howver, Hotmail pretty much sucks when it comes to obeyin

Re: [Tutor] logging to cmd.exe

2017-09-30 Thread boB Stepp
On Tue, Sep 26, 2017 at 6:22 AM, Albert-Jan Roskam wrote: > PS: sorry about the missing quote (>>) markers. Hotmail can't do this. Is > Gmail better? Yeah, in Gmail it will handle the quote markers when doing plain text. -- boB ___ Tutor maillist

[Tutor] Am I missing something obvious about "FizzBuzz"?

2017-09-30 Thread boB Stepp
On the main Python list there is a thread entitled, "Beginners and experts (Batchelder blog post)", and Stefan Ram mentioned: "... The fact that programmers can't program is known since the invention of the "FizzBuzz" programmer test. ..." I vaguely recall seeing some reference to "FizzBuzz" in m

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-09-30 Thread boB Stepp
On Sun, Oct 1, 2017 at 12:32 AM, Steven D'Aprano wrote: > On Sun, Oct 01, 2017 at 12:09:55AM -0500, boB Stepp wrote: > >> If I understand the problem correctly, this gives the desired result. >> I would have had this in < 30 seconds if I did not stop at each stage >&g

[Tutor] Fwd: Python programming for the absolute beginner

2017-10-01 Thread boB Stepp
-- Forwarded message -- From: Howard B Date: Sun, Oct 1, 2017 at 2:20 PM Subject: Re: [Tutor] Python programming for the absolute beginner To: boB Stepp The 2010 copyright version, ISBN 978-1-4354-5500-9, discusses installing Python 3.1 (main text on page 5, and Appendix A on

[Tutor] OT: New book on pytest

2017-10-13 Thread boB Stepp
I just got the book in The Pragmatic Programmers series, "Python Testing with pytest -- Simple, Rapid, Effective, and Scalable" by Brian Okken, c. 2017. I've gone through about three chapters so far and I am really liking this book and pytest. Now that I am playing around with pytest, I must say

[Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-13 Thread boB Stepp
I want to use Alan's (and others') idea to run a SQL file to create a table if that table does not exist. Alan suggested using executescript() to do this. I misunderstood Alan and thought that this would take a filename and execute it. Instead, it appears that I must pass to it a string which is

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-13 Thread boB Stepp
On Sat, Oct 14, 2017 at 1:27 AM, srinivas devaki wrote: > SQL has "CREATE TABLE IF NOT EXISTS" > > so you change your instructions to > ```python > import sqlite3 > conn = sqlite3.connect(':memory:') > c = conn.cursor() > c.execute(""" > CREATE TABLE IF NOT EXISTS BloodPressureReadings ( > Rea

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread boB Stepp
On Sat, Oct 14, 2017 at 1:43 AM, boB Stepp wrote: > I am currently trying to make the following work: > > py3: tb_exists = c.execute('select name from sqlite_master where > type="table"') > > so that I can embed this in an if statement. But it is not beha

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread boB Stepp
On Sat, Oct 14, 2017 at 2:11 AM, boB Stepp wrote: > So I get "None" as a result if the target table has not been created > yet. But if I *do* create the table I want: > > py3: with open('create_sqlite3_db.sql') as f: > ... sql = f.read() > ... > py3:

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread boB Stepp
On Sat, Oct 14, 2017 at 4:45 AM, Peter Otten <__pete...@web.de> wrote: > If this is a long term project there will be changes in the schema. > However, I don't think it is necessary to check for individual tables. You > typically start with a few tables > > create table alpha > create table beta >

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread boB Stepp
On Sun, Oct 15, 2017 at 12:07 AM, boB Stepp wrote: > > #!/usr/bin/env python3 > > """This file starts the blood pressure readings program.""" > > import sqlite

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-15 Thread boB Stepp
On Sun, Oct 15, 2017 at 3:09 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: > >> I have not used a "finally" block before. I just had the thought that >> maybe it would run even if an uncaught exception might occur. I tried >> to test

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-15 Thread boB Stepp
On Sun, Oct 15, 2017 at 2:56 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: >> >> I am puzzled. If one is using version control, then what is the >> advantage of this incremental approach in creating and populating the >> database? Instead, why 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 above line should ge

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 bothered to set the path to

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. > > Caveat: I've not read

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 formula, and we don’t re

[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 on behalf of > Leam Hall > Sent: Saturday, Decem

[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: ht

[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 mo

[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 = c:\Projects\solitaire_scorekeeper\t

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 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.path.realpath(&#

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 that os.path.realpath is the Python equivalent of

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 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 care if path refers

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 to your post last nigh

[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 __file__

[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 (Gr

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 bit more > experien

[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 I

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 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 > > > This link may be of

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 question. Copy and paste a self

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 > suspect I can do

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

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. One of them [1] says on pag

[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, unfortunately,

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 install > python3-distutils

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 wrote: > On 6 May 2018, at 23:00, boB Stepp wrote: >>My understanding of best practice here is that I should not have any >>print() calls inside my generate_collatz_sequence() function. I >>_could_ store the generated sequence in

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 wrote: > On 6 May 2018, at 23:00, boB Stepp wrote: >>My understanding of best practice here is that I should not have any >>print() calls inside my generate_collatz_sequence() function. I >>_could_ store the generated sequence in

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 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.""" > > if integer %

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 works like I would like

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 would like and expect,

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 Will You Do? Fight or Run: ')

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 seeing/understanding.

[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] Nested use of replication operator on lists

2018-05-25 Thread boB Stepp
The subtleties of the interactions between the concepts of references to objects, mutable objects, immutable objects, shallow copy of objects and deep copy of objects continue to surprise me! On Fri, May 25, 2018 at 1:27 AM, Steven D'Aprano wrote: > On Thu, May 24, 2018 at 10:33:56PM -0

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 th

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

[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 Python

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 c

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: $ py

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 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 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 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. T

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 a

[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 yes,

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 > &g

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 n

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

[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 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 mea

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 scores

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] 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 fi

[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 pr

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 Sh

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

[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 time

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] 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 programm

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] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-20 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] 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 w

[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 nam

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 thi

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] (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 generat

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 for

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 > > charter

[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] 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] 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 -

[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: http://blog.

[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 an

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 wh

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 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: > 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 - _t

[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, su

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

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 comm

<    1   2   3   4   5   6   7   >