[Tutor] How to test my code's interactions with SQLite db?

2015-08-15 Thread boB Stepp
Being committed to TDD for this project, I am not yet ready to write code till I figure out how to write the tests. It occurs to me that writing tests for code that interacts with the SQLite db may be non-trivial (At least for me!). After doing some online research tonight, it appears that I need

Re: [Tutor] How to test my code's interactions with SQLite db?

2015-08-16 Thread boB Stepp
On Sun, Aug 16, 2015 at 4:03 AM, Steven D'Aprano wrote: > On Sun, Aug 16, 2015 at 01:18:06AM -0500, boB Stepp wrote: >> 1) It would seem that I need to install a stand-alone version of >> SQLite, so that I can create this test db. Either that or write a >> separate

Re: [Tutor] How to test my code's interactions with SQLite db?

2015-08-16 Thread boB Stepp
On Sun, Aug 16, 2015 at 6:04 PM, Alan Gauld wrote: > On 16/08/15 23:29, boB Stepp wrote: > >> http://www.sqlite.org/download.html > > > You definitely want this. > You treat it like the >>> prompt in Pyython. I had just finished installing and testing the in

Re: [Tutor] How to test my code's interactions with SQLite db?

2015-08-16 Thread boB Stepp
On Sun, Aug 16, 2015 at 7:36 PM, Danny Yoo wrote: > By the way, when you're unit testing with Sqlite, you might find it > convenient to use the ":memory:" option, which keeps the database in > RAM rather than on disk. That should make the "setup" and "tear-down" > of the testing environment easi

Re: [Tutor] How to test my code's interactions with SQLite db?

2015-08-16 Thread boB Stepp
On Sun, Aug 16, 2015 at 7:55 PM, Alan Gauld wrote: > On 17/08/15 00:52, boB Stepp wrote: > >>> sqlite3> .read populate_base_data.sql >> >> >> I am assuming that the .read command would be replaced inside the >> program by the cursor.executescript() me

[Tutor] Is it possible to archive subsets of data from an SQLite db and restore it later?

2015-08-17 Thread boB Stepp
My wife had an interesting request tonight: Would it be possible to have two dbs, one that is the current working db, and the other an archival db for students who have left the school? If yes, then the archival db would need to be able to serve two functions: 1) If the teacher gets a request fo

[Tutor] Test discovery not locating module to test

2015-08-19 Thread boB Stepp
W7 64-bit. Py 3.4.3 unittest result: E:\Projects\mcm>python -m unittest E == ERROR: test.db.test_mcm_db_mgr (unittest.loader.ModuleImportFailure) -- Traceback (

Re: [Tutor] Test discovery not locating module to test

2015-08-20 Thread boB Stepp
On Thu, Aug 20, 2015 at 2:37 AM, Peter Otten <__pete...@web.de> wrote: > Assuming E:/Projects/mcm/src is in the PYTHONPATH mcm_db_mgr.py (what an > alphabet soup!)... Written out in full, this would be montessori_classroom_manager_database_manager.py Hmm. Perhaps just db_manager.py? > ...is p

[Tutor] Do not understand why test is running.

2015-08-20 Thread boB Stepp
I adopted Peter's suggestions (I think!) and now have these two paths that are pertinent to my questions: Projects/mcm/mcm/db/manager.py # The module I am beginning to write tests for. Projects/mcm/test/db/test_manager.py# The file for my module tests. The test code currently is: import un

Re: [Tutor] Do not understand why test is running.

2015-08-20 Thread boB Stepp
On Thu, Aug 20, 2015 at 10:13 PM, Steven D'Aprano wrote: > On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: > > >> import unittest >> >> # import modules to be tested: >> import mcm.db.manager >> >> class ManagerTestCase(unittest.Test

Re: [Tutor] Do not understand why test is running.

2015-08-21 Thread boB Stepp
On Fri, Aug 21, 2015 at 1:16 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: > >> On Thu, Aug 20, 2015 at 10:13 PM, Steven D'Aprano >> wrote: >>> On Thu, Aug 20, 2015 at 09:01:50PM -0500, boB Stepp wrote: >>> >>> >

Re: [Tutor] Do not understand why test is running.

2015-08-23 Thread boB Stepp
On Sat, Aug 22, 2015 at 3:18 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: > >> In the cold light of morning, I see that in this invocation, the path >> is wrong. But even if I correct it, I get the same results: >> >> e:\Projects\mcm>p

Re: [Tutor] Do not understand why test is running.

2015-08-23 Thread boB Stepp
On Sun, Aug 23, 2015 at 11:47 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: >> And am I misreading the docs at >> https://docs.python.org/3/library/unittes

Re: [Tutor] Do not understand why test is running.

2015-08-23 Thread boB Stepp
On Sun, Aug 23, 2015 at 11:47 AM, Peter Otten <__pete...@web.de> wrote: > boB Stepp wrote: > >> On Sat, Aug 22, 2015 at 3:18 AM, Peter Otten <__pete...@web.de> wrote: >>> boB Stepp wrote: >> ... I was not in the directory, E:\Projects\mcm. It is m

[Tutor] How should my code handle db connections? Should my db manager module use OOP?

2015-08-26 Thread boB Stepp
My ongoing project will be centered around an SQLite db. Since almost all data needed by the program will be stored in this db, my thought is that I should create a connection to this db shortly after program startup and keep this connection open until program closure. I am assuming that opening

Re: [Tutor] noob python question

2015-10-26 Thread boB Stepp
Greetings! On Sun, Oct 25, 2015 at 6:16 PM, bob5487 wrote: > Howdy! > > Reading *Learn Python the Hard Way* Zed Shaw > > All good so far but got to Ex 42 dealing with classes... > > I get a TypeError: getattr(): attribute name must be a string when I run the > program... > > I looked online, pyth

[Tutor] Are there any Python-based GUI builders for tkinter

2015-10-27 Thread boB Stepp
I have a friend at work and he is trying to develop GUI applications in Python, but he does not want to hand-code them. Are there any commercial or non-commercial products that would do this for him? He tried his own online search but was unsuccessful. His OS is Mac OS 10.10 and is using Python

Re: [Tutor] interface

2015-12-16 Thread boB Stepp
On Mon, Dec 14, 2015 at 10:08 PM, Alex Kleider wrote: > Thank you, gentlemen (Alan, Ben, Mark,) for your advice. > The consensus seems to be in favour of tkinter > so I'll head in that direction. If you are into books, "Programming Python, 4th ed." by Mark Lutz, has an extensive section on tkinte

[Tutor] OT: How to automate user interactions with GUI elements of closed-source programs?

2015-12-24 Thread boB Stepp
My Google-fu is weak on this question. I keep getting lots of hits on web scraping, but my interest is actually as follows: I find myself doing the same boring, repetitive tasks by hand, which amounts to copying certain information from one program and putting it into other programs. None of the

Re: [Tutor] OT: How to automate user interactions with GUI elements of closed-source programs?

2015-12-24 Thread boB Stepp
On Thu, Dec 24, 2015 at 11:34 AM, Oscar Benjamin wrote: > > On 24 Dec 2015 14:55, "boB Stepp" wrote: [...] >> I find myself doing the same boring, repetitive tasks by hand, which >> amounts to copying certain information from one program and putting it >> i

Re: [Tutor] reading an input stream

2015-12-24 Thread boB Stepp
On Thu, Dec 24, 2015 at 3:54 PM, Danny Yoo wrote: I tried to follow your example: > > For example, here's a generator that knows how to produce an infinite > stream of numbers: > > ## > def nums(): > n = 0 > while True: > yield n > n += 1 > ## > > W

Re: [Tutor] OT: How to automate user interactions with GUI elements of closed-source programs?

2015-12-24 Thread boB Stepp
On Thu, Dec 24, 2015 at 5:38 PM, Alan Gauld wrote: > To quote my recent book: [...] > This is a frustrating technique that is very error prone and also very > vulnerable to changes in the application being controlled—for example, > if an upgrade changes the screen layout, your code will likely

[Tutor] OT: How best to use Git for multi-directory projects?

2015-12-29 Thread boB Stepp
I have two situations that I wish to use Git for: 1) Multi-directory Python projects and 2) learning Python from various books which inevitably have suggested exercises to program solutions for. For (1) I might have multiple projects going simultaneously. Say something like: project1/ sourc

Re: [Tutor] OT: How best to use Git for multi-directory projects?

2016-01-01 Thread boB Stepp
On Tue, Dec 29, 2015 at 11:32 PM, Martin A. Brown wrote: > > Hello there boB, > > Hey, wait a second! What time zone are you in? You can't have 2016 > resolutions already. Not even the New Zealanders are there yet! Santa gave me a peek into you know who's time machine! >>My thoughts are that

[Tutor] What potential problems might I encounter installing Anaconda?

2016-01-01 Thread boB Stepp
Currently I have one version of Python installed, v. 3.4.4. My OS is W7-64bit. I use Vim 7.4 for my editing. Two of the textbooks I have started will use several Python scientific computing packages. Anaconda seems the way to go to get them all (plus others) in one fell swoop. Questions: 1) At

[Tutor] antigravity?!?

2016-01-01 Thread boB Stepp
Ok, you Python developers (If any follow the Tutor list.) are a quirky lot! Thinking about Martin's suggestion to explore the standard library, I typed "py" in my W7 Command Prompt, followed by "help()" and then modules to see what modules I had installed on my system. While doing so, I was intrig

[Tutor] Is there a preference of "class MyClass:" or "class MyClass(object):" for Py3?

2016-01-15 Thread boB Stepp
Pythonic style/preference question: For strictly Python 3 code, is there any preference for class MyClass: pass versus the more explicit class MyClass(object): pass ? TIA! -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

[Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
At https://docs.python.org/3.4/library/stdtypes.html#sequence-types-list-tuple-range it states: "s.insert(i, x) inserts x into s at the index given by i (same as s[i:i] = [x])" I find this confusing. First, at the interpreter, whenever I type in: >>> things [0, 'Hmm...', 3, 'WhackABunny', 6, '

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 10:53 PM, Cameron Simpson wrote: > On 15Jan2016 22:20, boB Stepp wrote: >> I always get an empty list, which is actually what I was expecting, so >> I do not see how s[i:i] can ever equal [x]. > > > It isn't an equality test (==), it is an

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 11:32 PM, Cameron Simpson wrote: > On 15Jan2016 23:05, boB Stepp wrote: >> >> On Fri, Jan 15, 2016 at 10:53 PM, Cameron Simpson wrote: >>>>>>> >>>>>>> things.insert(-1, 'What the heck?!?') >>>

Re: [Tutor] Is there a preference of "class MyClass:" or "class MyClass(object):" for Py3?

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 11:47 PM, Steven D'Aprano wrote: > > If there's any chance that the code might be used in Python 2, or copied > into a Python 2 module, or read by people expecting Python 2 semantics, > then you ought to be explicit about the base class. Hmm. I *try* to keep Python 3 at

Re: [Tutor] What is the square brackets about?

2016-01-16 Thread boB Stepp
On Sat, Jan 16, 2016 at 1:00 PM, Alan Gauld wrote: > As a side note, this function looks very fragile since > it depends on thing having nested data structures that > match the indexes provided by loc. As Alan's response arrived, I was in the interpreter trying out this function with a set of va

Re: [Tutor] What is the square brackets about?

2016-01-16 Thread boB Stepp
On Sat, Jan 16, 2016 at 1:14 PM, boB Stepp wrote: > > While learning I find it very helpful to either use IDLE or invoke the > Python interpreter in the shell and try these things out. Once I get > it to work, then I play around with the syntax and deliberately try to > break

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-16 Thread boB Stepp
On Sat, Jan 16, 2016 at 6:19 AM, Peter Otten <__pete...@web.de> wrote: > Steven D'Aprano wrote: > >> But slices are slightly different. When you provide two indexes in a >> slice, they mark the gaps BETWEEN items: > > The other explanation that Python uses half-open intervals works for me. > >> Now

Re: [Tutor] What is the square brackets about?

2016-01-16 Thread boB Stepp
On Sat, Jan 16, 2016 at 2:33 PM, Alan Gauld wrote: > On 16/01/16 19:35, boB Stepp wrote: > >> And so on. Until you (and I) can understand why the function produces >> these outputs with the given values of loc and thing, then we cannot >> claim we understand what is going

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-16 Thread boB Stepp
Alex sent me this off-list. I hope he does not mind me sharing part of what he wrote on-list! On Sat, Jan 16, 2016 at 4:57 PM, Alex Kleider wrote: > On 2016-01-16 14:39, boB Stepp wrote: > > >>>>> mylist[:0 or None] >> >> [100, 200, 300, 400, 500] >> &

[Tutor] Should a "data" directory have a __init__.py file?

2016-01-17 Thread boB Stepp
Py 3.4.4; W7-64-bit I've been reviewing all of the posts relevant to questions I asked last year on Python project directory structures. I was wondering about a data directory nested under the program's top-level directory. I can see no reason why I would need an __init__.py file for a data direc

[Tutor] How (and whether I should) use pkgutil.get_data()?

2016-01-17 Thread boB Stepp
>From "Python Cookbook, 3rd Ed." by David Beazley and Brian K. Jones, the authors recommend using pkgutil.get_data() to obtain the contents of data files. Normally I would use "with open..." giving my expected file's location, but the authors claim that using pkgutil.get_data() is a more robust wa

[Tutor] Why is the name "self" optional instead of mandatory?

2016-01-20 Thread boB Stepp
I'm whizzing along in "Python Crash Course" and am in the chapter on classes. Just to satisfy my suspicion that "self" is just a placeholder for creating an object instance, I tried the following: >>> class Dog(object): def __init__(this, name, age): this.name = name

[Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-20 Thread boB Stepp
My intent was to deliberately introduce an error into my class definition: >>> class Hmm(object): def __init__(self, sigh_type, sigh_strength): self.sigh_type = sigh_type self.sigh_strength = sigh_strength def snort(self): if self.sigh_strength =

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-22 Thread boB Stepp
On Thu, Jan 21, 2016 at 4:57 AM, Steven D'Aprano wrote: > On Wed, Jan 20, 2016 at 09:54:32PM -0800, Danny Yoo wrote: > >> Just to be explicit: you are pointing out that: >> >> humdrum.sigh_strenght = 'high' >> >> was a typo, and it would have been nice if it could be caught as an error. >> >>

Re: [Tutor] Why is the name "self" optional instead of mandatory?

2016-01-22 Thread boB Stepp
On Thu, Jan 21, 2016 at 5:49 AM, Steven D'Aprano wrote: > On Wed, Jan 20, 2016 at 09:42:29PM -0600, boB Stepp wrote: > >> So I really only have one question: Why not make Python's >> *traditional* name, "self", mandatory? Why give the programmer this

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-22 Thread boB Stepp
On Fri, Jan 22, 2016 at 11:04 PM, Cameron Simpson wrote: > On 22Jan2016 22:14, boB Stepp wrote: [...] > Consider: this is information you want assicated with a specific object. > Therefore it really _is_ an arribute of the object so that it can follow it > around. > >>

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-23 Thread boB Stepp
On Sat, Jan 23, 2016 at 3:30 AM, Cameron Simpson wrote: > On 23Jan2016 01:52, boB Stepp wrote: >> I guess no matter how new one is to OOP, one nevertheless brings one's >> preconceptions, however malformed, into the learning process. In my >> case, one of mine was

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-23 Thread boB Stepp
On Sat, Jan 23, 2016 at 12:07 PM, Danny Yoo wrote: > But Python has very little of this as a built-in part of the language. > Guarding who gets to touch something is instead done by convention and > by a very thin mechanism of name-mangling via an uncommonly-seen > character, the underscore "_".

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-23 Thread boB Stepp
On Sat, Jan 23, 2016 at 12:55 PM, boB Stepp wrote: > I still would like to do this via a method, but I am currently stuck > on how to replace ??? with the attribute name I would like to insert: > > class Dog(object): > ... > > def add_attribute(self, attribute_

Re: [Tutor] Why do I not get an error when I mistakenly type "humdrum.sigh_strenght" instead of the correct "humdrum.sigh_strength"?

2016-01-23 Thread boB Stepp
On Sat, Jan 23, 2016 at 7:20 PM, Alan Gauld wrote: > On 23/01/16 09:30, Cameron Simpson wrote: > >> Alan will take you up on doing purer OO practices in Python. > > In pure OO objects should only expose methods and the data > attributes should only be there to support the methods. > As such, nobod

[Tutor] Value of tracebacks to malicious attackers?

2016-01-23 Thread boB Stepp
>From page 202 of "Python Crash Course": "..., but it's also not a good idea to let users see tracebacks. Nontechnical users will be confused by them, and in a malicious setting, attackers will learn more than you want them to know from a traceback. For example, they'll know the name of your pro

Re: [Tutor] Value of tracebacks to malicious attackers?

2016-01-23 Thread boB Stepp
On Sun, Jan 24, 2016 at 12:43 AM, Danny Yoo wrote: >> How much concern do you give this in designing and implementing your >> production code? How far do you go in handling exceptions to ensure >> that tracebacks cannot arise for a malicious user? > We can plan ahead and develop a program to sup

Re: [Tutor] Help

2016-01-26 Thread boB Stepp
In case you cannot see what we are talking about in how your message is not keeping its proper indentation, go to the Tutor Mail Archive at: https://www.mail-archive.com/tutor@python.org/msg73411.html and perhaps you can better see the difficulty we are having reading your message. boB _

[Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-27 Thread boB Stepp
I am starting a new project and wish to do it from beginning to end using TDD best practices. This is also my practical foray for the first time into OOP. The application will have a primitive editor to create and edit certain text files that the program will need. The first file the program wil

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread boB Stepp
On Wed, Jan 27, 2016 at 11:24 PM, Danny Yoo wrote: > You can make the file input/output interface a parameter of your editor. > > ### > class Editor(object): > def __init__(self, filesystem): > self.filesystem = filesystem > ... > ##

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread boB Stepp
On Thu, Jan 28, 2016 at 2:44 AM, Alan Gauld wrote: > Danny has shown you one way using a mocked filesystem. > But for your case can't you just specify a file location > as an environment variable or argv? That way you get the > advantage of using real files, which can be an important > factor in

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread boB Stepp
On Thu, Jan 28, 2016 at 4:14 PM, Alan Gauld wrote: > On 28/01/16 20:03, Danny Yoo wrote: >> (Aside: this is somewhat why I think the topic of inheritance and >> inheritance >> hierarchies are entirely the wrong things to focus on when we're >> teaching OOP. > > Absolutely. > I always try to focus

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread boB Stepp
On Thu, Jan 28, 2016 at 5:09 PM, Martin A. Brown wrote: > I'll add one option to the mix, and summarize the other options I saw listed > earlier. > > Option A (tempfile): > > Create a directory and copy your pristine tree into the directory > and make the base directory for the important data

Re: [Tutor] How do I test file operations (Such as opening, reading, writing, etc.)?

2016-01-28 Thread boB Stepp
On Thu, Jan 28, 2016 at 2:03 PM, Danny Yoo wrote: > Just to emphasize what I think is an essential point: the basic > approach we're doing is here parameterization: to take something that > used to be hardcoded, and turn it into a parameter that allows us to > substitute with something else. Tha

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread boB Stepp
On Fri, Jan 29, 2016 at 11:41 AM, STF wrote: > ...How do you call this thing, BTW? I'm unable to > understand how to navigate inside this thing. I mean, when I open it, in > which folder am I in? Suppose I have a Python file in > D:\mycode\abc\myfile.py. How to run it? IDLE presents itself i

Re: [Tutor] Code Regress

2016-02-01 Thread boB Stepp
On Mon, Feb 1, 2016 at 8:22 AM, Evan Sommer wrote: > I tried the code suggestion that you proposed in december, and while > it did count down time, it actually set me back in a way because the > display is not how I desired it to be. I think you need to review all of Alan's previous suggestions.

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-06 Thread boB Stepp
On Sat, Feb 6, 2016 at 10:07 AM, Anubhav Yadav wrote: > class TestCase(unittest.TestCase): > def test_red_temperature_simulation(self): > """ > Method to test the red_temperature_simulation method > """ > for i in range(10): > self.assertLess(r

Re: [Tutor] Need help with two similar test cases that I have written. One works and the other fails

2016-02-06 Thread boB Stepp
On Sat, Feb 6, 2016 at 3:54 PM, boB Stepp wrote: > On Sat, Feb 6, 2016 at 10:07 AM, Anubhav Yadav wrote: Just read Danny's reply after sending mine, which means that the answer to my question: > If my understanding is indeed correct, then I will leave it to you to > figure o

[Tutor] Why does 01 give a syntax error, but 00 (or 00...0) does not?

2016-03-05 Thread boB Stepp
>>> 01 File "", line 1 01 ^ SyntaxError: invalid token >>> 00 0 >>> -00 0 >>> 000 0 Why do zeros not give a syntax error, but other numbers with a leading zero do give a syntax error? An online search reveals that in Python 2 a leading 0 starts an octal number, but this was changed in

Re: [Tutor] Help with an error

2016-03-05 Thread boB Stepp
On Sat, Mar 5, 2016 at 1:36 PM, Saad Mabror wrote: > Hello , So i'm totally new to programming and i decided to start with python > , i've installed python 2.7 on my laptop (running windows 7 ) at first i > started following a begginer's guide and everything was fine . But later i > started rec

[Tutor] Surprised that print("a" "b") gives "ab"

2016-03-05 Thread boB Stepp
I stumbled into finding out that >>> "a" "b" 'ab' or >>> print("a""b") ab Note that there is not even a space required between the two strings. I find this is surprising to me as "a" "b" is much less readable to me than "a" + "b" . And since Python is all about easily readable code, why was t

Re: [Tutor] Why does 01 give a syntax error, but 00 (or 00...0) does not?

2016-03-05 Thread boB Stepp
On Sat, Mar 5, 2016 at 11:32 PM, Steven D'Aprano wrote: > On Sat, Mar 05, 2016 at 05:20:21PM -0600, boB Stepp wrote: > >> Why do zeros not give a syntax error, but other numbers with a leading >> zero do give a syntax error? An online search reveals that in Python >

Re: [Tutor] Surprised that print("a" "b") gives "ab"

2016-03-05 Thread boB Stepp
On Sun, Mar 6, 2016 at 12:37 AM, Ben Finney wrote: > boB Stepp writes: > >> […] why was this feature implemented? > > You've been asking that a lot lately :-) This forum is unlikely to be > able to give authoritative answers to “why was the language designed the &

[Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
I must be bored tonight. I have to confess that when copying and pasting from the interpreter into a plain text email, I often find it cluttered to confusing by all the ">>>..." that can result from nested quoting. So I poked around on the Internet and found that I can temporarily change the prom

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 9:31 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" or "license" for more information. >>>> import s

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 11:02 PM, Cameron Simpson wrote: > On 11Mar2016 21:31, boB Stepp wrote: >> >> I must be bored tonight. I have to confess that when copying and >> pasting from the interpreter into a plain text email, I often find it >> cluttered to confusing b

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-11 Thread boB Stepp
On Fri, Mar 11, 2016 at 10:08 PM, wolfrage8...@gmail.com wrote: > On a web based terminal via codeanywhere.com setting sys.ps1 = > chr(16) results in no character being displayed. It is literally just > a new line. So something to think about. I set it back to sys.ps1 = > '>>>' Thanks for the fe

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-12 Thread boB Stepp
On Sat, Mar 12, 2016 at 2:14 AM, Cameron Simpson wrote: > On 12Mar2016 00:46, boB Stepp wrote: >> Additionally, one must set the font for cmd.exe and PowerShell to >> "Lucida Console" or the above will not work. > > > You may find some other fonts also work

[Tutor] OT: (Continuous) integration testing: Can a solo developer with very limited resources truly do this?

2016-03-12 Thread boB Stepp
>From "Practices of an Agile Developer" by Venkat Subramaniam and Andy Hunt, c. 2006, page 90: You're already writing unit tests to exercise your code. Whenever you modify or refactor your code, you exercise your test cases before you check in the code. All you have to do now is exercise your t

Re: [Tutor] OT: (Continuous) integration testing: Can a solo developer with very limited resources truly do this?

2016-03-12 Thread boB Stepp
On Sat, Mar 12, 2016 at 2:02 PM, Alan Gauld wrote: > On 12/03/16 18:10, boB Stepp wrote: > Virtual machines, eg VirtualBox. > You can install all of the required OS on a single physical machine > (assuming the same hardware of course). For example, on my > Linux Mint box I hav

Re: [Tutor] Pmw/Tkinter question

2016-03-12 Thread boB Stepp
On Sat, Mar 12, 2016 at 2:17 AM, Albert-Jan Roskam wrote: > Below is a slightly modified example about Pmw/Tkinter from > http://pmw.sourceforge.net/doc/howtouse.html. > I changed the geometry manager from 'pack' to 'grid', because I use that in > all other parts of my program. > The problem is

Re: [Tutor] Pmw/Tkinter question

2016-03-12 Thread boB Stepp
On Sat, Mar 12, 2016 at 2:17 AM, Albert-Jan Roskam wrote: > Hello, > > Below is a slightly modified example about Pmw/Tkinter from > http://pmw.sourceforge.net/doc/howtouse.html. > I changed the geometry manager from 'pack' to 'grid', because I use that in > all other parts of my program. > The

Re: [Tutor] Pmw/Tkinter question

2016-03-13 Thread boB Stepp
On Sun, Mar 13, 2016 at 11:01 AM, Albert-Jan Roskam wrote: > > Thanks! However, if you replace 'broccoli' with a much longer option, you > will see what I meant with the alignment problem. One can no longer read the > first letters of the option once it'

Re: [Tutor] Pmw/Tkinter question

2016-03-13 Thread boB Stepp
On Sun, Mar 13, 2016 at 6:06 PM, boB Stepp wrote: > On Sun, Mar 13, 2016 at 11:01 AM, Albert-Jan Roskam > wrote: >> > >> Thanks! However, if you replace 'broccoli' with a much longer option, you >> will see what I

Re: [Tutor] Pmw/Tkinter question

2016-03-13 Thread boB Stepp
I just cannot leave this problem alone; however, I *do* believe I have found the correct way to do what Albert-Jan desires within the publicly accessible features of Pmw and Tkinter. I looked at the Pmw documentation online at http://pmw.sourceforge.net/doc/OptionMenu.html and it said: menubut

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-15 Thread boB Stepp
Is the following result in PowerShell related to what Eryk has been discussing? Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Windows\system32> py Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on w in32 Type "help",

Re: [Tutor] Changing the interpreter prompt symbol from ">>>" to ???

2016-03-15 Thread boB Stepp
On Tue, Mar 15, 2016 at 7:35 PM, boB Stepp wrote: > Is the following result in PowerShell related to what Eryk has been > discussing? > > Windows PowerShell > Copyright (C) 2009 Microsoft Corporation. All rights reserved. > > PS C:\Windows\system32> py > Python 3.5.1 (

[Tutor] How to test function using random.randint()?

2016-03-18 Thread boB Stepp
If I had a function to roll a die, such as: import random def roll_die(num_sides): return random.randint(1, num_sides) How would I write unit tests for this? The first thing that suggests itself to me is to do something like assertIn(roll_die(num_sides), range(1, num_sides + 1) And I woul

Re: [Tutor] How to test function using random.randint()?

2016-03-19 Thread boB Stepp
On Sat, Mar 19, 2016 at 8:03 AM, Steven D'Aprano wrote: > On Sat, Mar 19, 2016 at 04:05:58PM +1100, Ben Finney wrote: > >> import random >> >> def roll_die(num_sides, rng=None): >> """ Return a result from a random die of `num_sides` sides. >> >> :param num_sides: The n

Re: [Tutor] How to test function using random.randint()?

2016-03-20 Thread boB Stepp
On Sun, Mar 20, 2016 at 8:19 PM, Ben Finney wrote: > > Steven D'Aprano writes: > > > On Mon, Mar 21, 2016 at 12:18:01AM +1100, Ben Finney wrote: > > > No, I meant what I wrote. The ‘rng’ parameter is expected to be > > > bound to a RNG. If the caller has not specified a custom RNG > > > instance,

Re: [Tutor] How to test function using random.randint()?

2016-03-20 Thread boB Stepp
On Sun, Mar 20, 2016 at 8:44 PM, Ben Finney wrote: > boB Stepp writes: >> Can I not use: >> >> if rng is None: >> rng = random.Random() > > That will work. > > It unfortunately creates a new random.Random instance every time that > line is execute

[Tutor] int(1.99...99) = 1 and can = 2

2016-04-30 Thread boB Stepp
Life has kept me from Python studies since March, but now I resume. Playing around in the interpreter I tried: py3: 1. 2.0 py3: 1.999 1.999 py3: int(1.) 2 py3: int(1.999) 1 It has been many years since I did problems in convertin

Re: [Tutor] META: Moderation and subscription to the tutor list

2016-04-30 Thread boB Stepp
On Sun, May 1, 2016 at 12:35 AM, wrote: > On 01May2016 14:18, Steven D'Aprano wrote: >> >> Hi Alan, >> >> I thought I'd mention that the list-owners of "python-list" have now >> decided to only allow people to post if they are subscribed to the list: >> >> https://mail.python.org/pipermail/pytho

Re: [Tutor] int(1.99...99) = 1 and can = 2

2016-05-01 Thread boB Stepp
On Sun, May 1, 2016 at 5:43 AM, Steven D'Aprano wrote: > On Sun, May 01, 2016 at 01:02:50AM -0500, boB Stepp wrote: >> Life has kept me from Python studies since March, but now I resume. >> Playing around in the interpreter I tried: >> >> py3: 1.

Re: [Tutor] Practice python

2016-05-08 Thread boB Stepp
On Sun, May 8, 2016 at 12:14 PM, monik...@netzero.net wrote: > Can you please recommend a free web class or site that offers lots of coding > exercises in python, not just the beginning but also intermediate and > advanced AND provides solutions. I need more practice. All the classes I have >

Re: [Tutor] How to make object disappear?

2016-05-09 Thread boB Stepp
Hello! I am not one of the experts; instead, I am one of the learners. But if you are seeking assistance on Tutor, it is necessary to post the actual code that you successfully or unsuccessfully ran. If you were unsuccessful, you need to copy and paste the full text of the error messages you rec

Re: [Tutor] How to make object disappear?

2016-05-09 Thread boB Stepp
On Mon, May 9, 2016 at 11:34 AM, Alan Gauld via Tutor wrote: > On 09/05/16 16:55, boB Stepp wrote: Did not! Lisa Hasler Waters (and her students?) wrote the code!! [Snipped her code and Alan's comments.] boB ___ Tutor maillist - Tutor@py

Re: [Tutor] Learning Regular Expressions

2016-05-24 Thread boB Stepp
On Mon, May 23, 2016 at 5:08 PM, Terry--gmail wrote: > Running Linux Mint > The YouTube Sentdex Video tutor I am following. > He is working in Python3.4 and I am running Python3.4.3 > > He's demonstrating some Regular Expressions which I wanted to test out. On > these test scripts, for future refe

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

2016-05-28 Thread boB Stepp
I am currently mulling over some information Alan passed along a while back on using the model-view-controller design pattern (Would 'architectural pattern' be a better choice of phrase?). I have been doing my usual online readings and there is enough variation in what I have read that I would lik

Re: [Tutor] Study Tips

2016-05-30 Thread boB Stepp
Hi and welcome to Tutor, Steve! I am one of the learners, and I can honestly say that you have found the right place to ask questions when you get stuck. Things on the list seem slow this weekend. In the US, where I am at, we are having Memorial Day weekend. I still have to chew over two meaty

Re: [Tutor] Learning Regular Expressions

2016-05-30 Thread boB Stepp
On Mon, May 30, 2016 at 12:13 PM, dirkjso...@gmail.com wrote: > Hi bob, > > I had used the wrong email address when I wrote to python tutor on this, and > evidently it > took a while for the monitors to let it go ahead and be entered in the list, > so I apologize > for the delay in my reply. That

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

2016-05-30 Thread boB Stepp
On Sun, May 29, 2016 at 9:10 AM, Alan Gauld via Tutor wrote: > On 29/05/16 05:33, boB Stepp wrote: >> My current understanding is that the model contains program logic and >> the data which the program logic manipulates. > > Correct, all the core entities which ma

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

2016-05-30 Thread boB Stepp
On Mon, May 30, 2016 at 11:30 AM, Alan Gauld via Tutor wrote: > On 29/05/16 05:33, boB Stepp wrote: >> 1) If I were to add code to filter user inputs, which file is the >> logical place to place such code? My current impression is that it >> should go in the controlle

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

2016-05-30 Thread boB Stepp
One other thing I meant to ask about: On Sun, May 29, 2016 at 9:10 AM, Alan Gauld via Tutor wrote: > The model responds, but how the view is notified varies. In some cases > the views register with models and the model automatically sends > notification messages to all registered views (by-passi

Re: [Tutor] Practice Exercises for Beginner ?

2016-06-02 Thread boB Stepp
On Thu, Jun 2, 2016 at 3:43 PM, Andrei Colta wrote: > Anyone can recommend practical work on learning python.. seems reading and > reading does not helping. The usual advice: Find one or more projects that interest you and start trying to accomplish them, learning more Python along the way as

[Tutor] Py 2.4.4: Inheriting from ftplib.FTP()

2016-06-16 Thread boB Stepp
I am extremely gradually trying to dip my big toe into the waters of writing classes. I have a little bit of extra time at work today, so I thought I would start writing a class to replace a bunch of shell FTP scripts I've used in various programs that would be flexible enough to be reused whereve

Re: [Tutor] Py 2.4.4: Inheriting from ftplib.FTP()

2016-06-17 Thread boB Stepp
On Thu, Jun 16, 2016 at 11:40 AM, Alan Gauld via Tutor wrote: > On 16/06/16 16:38, boB Stepp wrote: > >> class FTPFiles(FTP, object): >> """FTP files to Windows server location(s).""" > > OK, First comment. You describe this as an actio

Re: [Tutor] Py 2.4.4: Inheriting from ftplib.FTP()

2016-06-17 Thread boB Stepp
possible with what I am forced to in Python 2.4 at work where I have no choices as to Python version.). On Fri, Jun 17, 2016 at 10:31 AM, Steven D'Aprano wrote: > Some futher thoughts: > > On Thu, Jun 16, 2016 at 10:38:13AM -0500, boB Stepp wrote: >> class FTPFiles(FTP, object):

<    1   2   3   4   5   6   7   >