Re: Definition of "property"

2021-05-31 Thread Irv Kalb
> On May 30, 2021, at 10:15 AM, Jon Ribbens via Python-list > wrote: > > On 2021-05-30, Irv Kalb wrote: >> I understand what a "property" is, how it is used and the benefits, >> but apparently my explanation hasn't made the light bulb go on for m

Definition of "property"

2021-05-30 Thread Irv Kalb
I am doing some writing (for an upcoming book on OOP), and I'm a little stuck. I understand what a "property" is, how it is used and the benefits, but apparently my explanation hasn't made the light bulb go on for my editor. The editor is asking for a definition of property. I've looked at

[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2021-05-04 Thread Irv Kalb
Irv Kalb added the comment: This is a quick follow up to the original issue. I am now running Mac OS X 11.2.3 with IDLE 3.9.1 (and pygame 2.0.1). In this environment, the issue of opening files is completely fixed and works perfectly. Thank you very much (and a big thank you from my

Re: pygame font issue

2021-03-13 Thread Irv Kalb
You need to initialize the font system with this line before you attempt to load a font: pygame.font.init() Irv > On Mar 13, 2021, at 8:11 AM, MRAB wrote: > > On 2021-03-13 15:20, Quentin Bock wrote: >> Code that contains the problem: >> score_value = 0 >> font =

Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.

2021-01-27 Thread Irv Kalb
On Jan 26, 2021, at 5:28 PM, William Ray Wing via Python-list wrote: > > > >> On Jan 26, 2021, at 2:00 PM, C W wrote: >> >> Hello everyone, >> >> I'm a long time Matlab and R user working on data science. How do you >> troubleshooting/debugging in Python? >> > > Another approach is to

Re: Debugging technique

2020-10-03 Thread Irv Kalb
This probably is not for you. But PyCharm has a panel that shows a stack trace. I created a video about debugging using the PyCharm debugger. Here is a YouTube link: https://www.youtube.com/watch?v=cxAOSQQwDJ4 Irv > On Oct 2, 2020, at 11:51 PM,

[issue41413] IDLE: exit at input() prompt is not complete

2020-07-28 Thread Irv Kalb
Irv Kalb added the comment: I have tried the test that Terry outlined (from double clicking on the IDLE icon), and I can confirm that I get the exact same results. In the menu bar, I see just the Apple icon and "IDLE". The items in the IDLE menu work (About IDLE and P

[issue41413] At prompt for input(), pressing Command q kills IDLE

2020-07-27 Thread Irv Kalb
New submission from Irv Kalb : This is probably related to earlier problems with running IDLE on MacOS Catalina: Environment: MacOS Catalina: 10.15.5 Python: 3.7.3 IDLE: 3.7.3 Steps to reproduce: - Open IDLE, create a new file. (Can reopen this file again for subsequent tests.) - Code

[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-07-27 Thread Irv Kalb
Irv Kalb added the comment: Right. I'm struggling with this bug every day. Irv > On Jul 23, 2020, at 9:09 AM, Ned Deily wrote: > > > Ned Deily added the comment: > > Ramon, I am not sure why you closed this issue. Perhaps it may no longer be a > problem for yo

Re: Writing output of function to a csv file

2020-05-25 Thread Irv Kalb
> On May 25, 2020, at 11:25 AM, MRAB > wrote: > > On 2020-05-25 19:00, Ciarán Hudson wrote: >> Hi, >> In the code below, which is an exercise I'm doing in class inheritance, >> almost everything is working except outputting my results, which as the >>

[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-22 Thread Irv Kalb
Irv Kalb added the comment: Thanks Ned and Terry for your responses. Ned: I am currently teaching a course where my students and I are all using Python 3.7 and the current Pygame 1.9.6, so unfortunately, I cannot update to the newer development release of 2.0. I am also writing a book

[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-20 Thread Irv Kalb
Irv Kalb added the comment: Thanks for all the message about this issue. I have made a three-minute video that demonstrates what I am seeing. Here is a link (the video is marked as "unlisted" so only people with this link can see it): https://youtu.be/OIu-HCVVDn8 To answer your

[issue38946] IDLE on macOS 10.15 Catalina does not open double-clicked files if app already launched

2020-05-19 Thread Irv Kalb
Irv Kalb added the comment: If possible, I would like to raise the priority of this issue. I teach Python and I use IDLE every day. This bug makes using IDLE for teaching extremely difficult. Hopefully new information: I have just bought a new Mac, which is running Catalina (MacOS 10.15

Re: [Mostly OT] Feedback on Python homework using Canvas LMS

2020-03-16 Thread Irv Kalb
> On Mar 16, 2020, at 11:31 AM, Irv Kalb wrote: > > This is for anyone who teaches Python and uses the Canvas Learning Management > System (maybe a small group). > > I teach Python at two colleges in Silicon Valley in California. At both > schools we use Canvas. Overal

[Mostly OT] Feedback on Python homework using Canvas LMS

2020-03-16 Thread Irv Kalb
This is for anyone who teaches Python and uses the Canvas Learning Management System (maybe a small group). I teach Python at two colleges in Silicon Valley in California. At both schools we use Canvas. Overall, it works very well. I use it to post notes, sample programs, build tests, post

[issue39325] Original window focus when opening IDLE by double clicking Python file Mac

2020-01-13 Thread Irv Kalb
New submission from Irv Kalb : I have my Mac to open ".py" files with IDLE. If IDLE is not running, and I double click on a Python file, the Shell window opens, then the Python file I clicked on opens in front, but the Shell has keyboard focus. In order to edit or run the sour

Re: [Q] __init__ in class

2019-12-26 Thread Irv Kalb
> On Dec 26, 2019, at 3:11 AM, 황병희 wrote: > > in making class, why we should set "__init__"? so non-init class is > useless? actually i did fail to understand __init__'s meaning. what is > role of __init__ in class. > > sincerely, from python beginner. > > -- > ^고맙습니다 _地平天成_ 감사합니다_^))// > --

Re: How can i stop this Infinite While Loop - Python

2019-10-30 Thread Irv Kalb
> On Oct 30, 2019, at 4:55 AM, ferzan saglam wrote: > > I have tried many ways to stop the infinite loop but my program doesn't seem > to stop after 10 items! It keeps going...!) > > --- > total = 0 > while True:

join and split with empty delimiter

2019-07-17 Thread Irv Kalb
I have always thought that split and join are opposite functions. For example, you can use a comma as a delimiter: >>> myList = ['a', 'b', 'c', 'd', 'e'] >>> myString = ','.join(myList) >>> print(myString) a,b,c,d,e >>> myList = myString.split(',') >>> print(myList) ['a', 'b', 'c', 'd', 'e']

[issue37197] [Idle-dev] Feedback appreciated for two suggested new features

2019-06-07 Thread Irv Kalb
New submission from Irv Kalb : [I'm not sure of the proper protocol here, I hope sending a message this way is OK.] Hi, I am writing about the potential fix to the Search Dialog box problem in IDLE that I reported a while back. I can see that there is a flurry of activity on this bug. I

Re: Instance vs Class variable oddity

2019-05-17 Thread Irv Kalb
> On May 15, 2019, at 5:41 PM, Ben Finney wrote: > > Irv Kalb writes: > >> I just saw some code that confused me. The confusion has to do with >> class variables and instance variables. > > (Perhaps unrelated, but here's another confusion you may be suffering

Re: Instance vs Class variable oddity

2019-05-15 Thread Irv Kalb
> On May 15, 2019, at 11:02 AM, Rob Gaddi > wrote: > > On 5/15/19 10:52 AM, Irv Kalb wrote: >> I just saw some code that confused me. The confusion has to do with class >> variables and instance variables. In order to understand it better, I built >> this ver

Instance vs Class variable oddity

2019-05-15 Thread Irv Kalb
I just saw some code that confused me. The confusion has to do with class variables and instance variables. In order to understand it better, I built this very small example: class Test: x = 0 def __init__(self, id): self.id = id self.show() def show(self):

Re: How to convert a train running program from synchronous to asynchronous?

2019-04-27 Thread Irv Kalb
> On Apr 26, 2019, at 4:18 AM, Arup Rakshit wrote: > > I have modelled which starts running once drivers and stations are assigned > to it. Otherwise, it doesn’t run, really don’t care if passengers are boarded > or not at this moment. :) I think this program can help me to introduce to >

Re: How call method from a method in same class?

2019-04-01 Thread Irv Kalb
> On Apr 1, 2019, at 7:02 PM, Dave wrote: > > As classes get more complex, it is good to call a function to do some of the > processing, and make the code easier to follow. My question is how to do > that? I've attached some silly code to illustrate the point. The error is: > name

Re: exit 2 levels of if/else and execute common code

2019-02-11 Thread Irv Kalb
> On Feb 11, 2019, at 7:25 AM, Neal Becker wrote: > > I have code with structure: > ``` > if cond1: > [some code] > if cond2: #where cond2 depends on the above [some code] >[ more code] > > else: >[ do xxyy ] > else: > [ do the same xxyy as above ] > ``` > > So what's the best

Re: IDLE Default Working Directory

2018-11-16 Thread Irv Kalb
> On Nov 15, 2018, at 2:44 PM, eryk sun wrote: > > On 11/14/18, Irv Kalb wrote: >> >> When working with data files, I tell students to put their project (their >> main program and any other related files) in a folder. Then, in their calls >> to "op

Re: IDLE Default Working Directory

2018-11-14 Thread Irv Kalb
> On Nov 13, 2018, at 6:04 PM, Christman, Roger Graydon wrote: > > On 13 Nov 2018, at 09:51, Bev in TX wrote: > >> On Nov 12, 2018, at 5:50 PM, Terry Reedy wrote: >> >> For me, open (command-O) opens 'Documents'. I presume it should be easy >> enough to

Re: Instance variables question

2018-04-16 Thread Irv Kalb
> On Apr 16, 2018, at 9:48 AM, duncan smith <duncan@invalid.invalid> wrote: > > On 16/04/18 17:03, Irv Kalb wrote: >> I have been writing OOP code for many years in other languages and for the >> past few years in Python. I am writing new curriculum for a course on O

Instance variables question

2018-04-16 Thread Irv Kalb
I have been writing OOP code for many years in other languages and for the past few years in Python. I am writing new curriculum for a course on OOP in Python. In order to see how others are explaining OOP concepts, I have been reading as many books and watching as many videos as I can.

Re: Style Q: Instance variables defined outside of __init__

2018-03-20 Thread Irv Kalb
> On Mar 19, 2018, at 10:27 AM, Ned Batchelder <n...@nedbatchelder.com> wrote: > > On 3/19/18 1:04 PM, Irv Kalb wrote: >> I am building some classes for use in future curriculum. I am using PyCharm >> for my development. On the right hand edge of the PyCharm edit

Style Q: Instance variables defined outside of __init__

2018-03-19 Thread Irv Kalb
I am building some classes for use in future curriculum. I am using PyCharm for my development. On the right hand edge of the PyCharm editor window, you get some little bars indicating warnings or errors in your code. I like this feature and try to clean up as many of those as I can.

Re: urllib.request.urlopen fails with https - SOLVED

2018-03-16 Thread Irv Kalb
Thank you, thank you, thank you. That fixed it (at least on my computer, I'll see if I can do that at my school). Irv > On Mar 15, 2018, at 7:39 PM, Ned Deily <n...@python.org> wrote: > > On 2018-03-14 18:04, Irv Kalb wrote: >> File >> "/Library/Frameworks/P

Re: urllib.request.urlopen fails with https

2018-03-15 Thread Irv Kalb
On Mar 14, 2018, at 9:54 PM, Gregory Ewing wrote: > > Chris Angelico wrote: >> That means going back to the original problem: "how do we get a usable >> stock price API?". > > Does it have to be stock prices in particular? > Or just some simple piece of data that

urllib.request.urlopen fails with https (was: Re: Stock quote APi)

2018-03-14 Thread Irv Kalb
Thanks to Chris A and Roger C for their information. Very helpful and I am working on both of their suggestions. But now I've run into a new related problem. I still am trying to get stock information using Standard Library calls for now (although I understand that the requests module makes

Re: Stock quote API ?

2018-03-11 Thread Irv Kalb
> On Mar 10, 2018, at 9:26 PM, Chris Angelico <ros...@gmail.com> wrote: > > On Sun, Mar 11, 2018 at 4:18 PM, Irv Kalb <i...@furrypants.com> wrote: >> Hi, >> >> I teach courses on beginning Python (Python3). In one of my topics, I >> explain ho

Stock quote API ?

2018-03-10 Thread Irv Kalb
Hi, I teach courses on beginning Python (Python3). In one of my topics, I explain how we can write simple programs that reach out to the internet and download data (request/response). I show a number of examples using: urllib.request.urlopen( ) to get things like weather data, currency

Re: Python Inheritance Terminology

2018-01-07 Thread Irv Kalb
Thanks for the confirmation, and for the link. Irv > On Jan 5, 2018, at 4:32 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > > Irv Kalb <i...@furrypants.com> writes: > >> I'm doing some writing for an upcoming course on OOP using Python. > > We

Python Inheritance Terminology

2018-01-05 Thread Irv Kalb
I'm doing some writing for an upcoming course on OOP using Python. I have been doing OOP programming for many years in many different languages, and I want make sure that I'm using the appropriate terminology in Python. I'd like to know if there are "official" or even standard terms that are

Re: acircle.getCenter() to (x,y) coordinates in Python

2017-12-23 Thread Irv Kalb
> On Dec 23, 2017, at 11:44 AM, G Yu wrote: > > My program has two circles: one stationary circle, drawn at a random > location; and one moving circle, consistently drawn in the same place in the > graphics window. > > > > Currently, acircle.getCenter() outputs

Re: property decorator?

2017-12-21 Thread Irv Kalb
Thanks to Rob, Cameron, Ian, Chris and Kirill for the detailed explanations. Very helpful, Irv > On Dec 20, 2017, at 3:56 PM, Irv Kalb <i...@furrypants.com> wrote: > > I am trying to work through the concept of the @property decorator with > respect to object oriented p

property decorator?

2017-12-20 Thread Irv Kalb
I am trying to work through the concept of the @property decorator with respect to object oriented programming. I believe that I understand how the @property and @.setter work - and that they are used to turn what looks like direct access to instance variables into method calls in an object.

[issue31974] Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra

2017-11-10 Thread Irv Kalb
Irv Kalb <i...@furrypants.com> added the comment: Hi Ned, Thanks for your message. But I want to make sure I understand what you are saying here. I am using absolutely vanilla Python 3.6 from python.org <http://python.org/>, but have upgraded to version 8.5.18 if Active

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-15 Thread Irv Kalb
> On Oct 14, 2017, at 6:46 PM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > > Irv Kalb <i...@furrypants.com> writes: > >> Thank you! > > You're welcome. > > >>> Just a data point... It works here: >>> >>> $

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
Thank you! > On Oct 14, 2017, at 12:10 PM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > > Irv Kalb <i...@furrypants.com> writes: > > Lots of detail snipped. I hope it won't matter... > >> > (_ssl.c:749)> >> >> Huh??? >> >&g

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
> On Oct 13, 2017, at 3:27 PM, Irv Kalb <i...@furrypants.com> wrot > If I take the same program and just modify the print statement to add > parentheses, then try to run it in Python 3.6 (on a Mac): > > ... > import urllib > > # set the Yahoo finance url, set

Python 2 -> 3, urllib.urlOpen

2017-10-13 Thread Irv Kalb
One of the colleges where I teach has just moved from Python 2 to Python 3. I am in the process of converting my beginning Python class from Python 2 to Python 3. Everything has gone smoothly, until I just tried to convert some code that imports and uses urllib.urlOpen to fetch data through

Re: Introducing the "for" loop

2017-10-05 Thread Irv Kalb
.apress.com/us/book/9781484218686 <http://www.apress.com/us/book/9781484218686> They also have an eBook version available Amazon: https://www.amazon.com/Learn-Program-Python-Irv-Kalb/dp/148421868X/ref=sr_1_1?ie=UTF8=1507250994=8-1=kalb+python In retrospect, the only problem with the book is tha

Re: Easier way to do this?

2017-10-04 Thread Irv Kalb
I'm assuming from your posts that you are not a student. If that is the case, look at my solution below. > On Oct 4, 2017, at 9:42 AM, 20/20 Lab wrote: > > Looking for advice for what looks to me like clumsy code. > > I have a large csv (effectively garbage) dump. I

Re: Boolean Expressions

2017-09-26 Thread Irv Kalb
> > On Sep 26, 2017, at 3:23 PM, Cai Gengyang wrote: > > > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does

Re: Python... feeding an instance as an argument into a new instance.

2017-09-02 Thread Irv Kalb
> On Sep 2, 2017, at 3:34 PM, Chris Roberts wrote: > > Perhaps someone here could help me to get this into perspective. > Somehow when we start to feed an instance as the argument in a new instance. > my head explodes.. > in this case... > a = Foo() > b = Bar(a) > So...

Re: Python string replace the values

2017-09-01 Thread Irv Kalb
> On Sep 1, 2017, at 10:13 AM, Ganesh Pal wrote: > > In the fixed length string i.e "a",last 4 bits i.e "" should be > replaced by the user provided value ( the value is between 0001 + f f f f ) > . I intend to form final_string using a fixed_string and an user

Re: Teaching the "range" function in Python 3

2017-06-30 Thread Irv Kalb
> On Jun 29, 2017, at 2:21 PM, Chris Angelico <ros...@gmail.com> wrote: > > On Fri, Jun 30, 2017 at 6:57 AM, Irv Kalb <i...@furrypants.com> wrote: >> I am wondering if other teachers have run into this. Is this a real >> problem? If so, is there any other way

Teaching the "range" function in Python 3

2017-06-29 Thread Irv Kalb
I teach Python at two colleges in Silicon Valley. I currently teach an introductory course on Python and most of my students have no programming background whatsoever. Up until now, my colleges have been using Python 2. But now, one of the colleges has made the jump to Python 3. So I am

Re: Need help with getting Key, Value out of dicts in lists

2017-04-09 Thread Irv Kalb
was just hoping > to be more direct by matching the 'Value' of 'Key: Resource_group_id' and > pull back the 'Value' of 'Key: Name' and other tags as needed. > > Thanks, > > Kenton Brede > > > > > > On Sat, Apr 8, 2017 at 11:29 PM, Irv Kalb <i...@furry

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
' in thisDict: # if thisDict has a key called 'Billing' print ('Billing is', thisDict['Billing']) Hope this helps, Irv > On Apr 8, 2017, at 9:04 PM, Irv Kalb <i...@furrypants.com> wrote: > > What you want to do is tricky because your data structure is difficult to > de

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
> On Apr 8, 2017, at 5:55 PM, Kenton Brede wrote: > > This is an example of the data I'm working with. The key/value pairs may > come in any order. There are some keys like the 'Resource_group_id' key and > the 'Name' key which will always be present, but other lists may have

Re: Disallowing instantiation of super class

2017-02-24 Thread Irv Kalb
> On Feb 24, 2017, at 1:24 AM, Steve D'Aprano <steve+pyt...@pearwood.info> > wrote: > > On Fri, 24 Feb 2017 11:19 am, Irv Kalb wrote: > >> Hi, >> >> I have built a set of three classes: >> >> - A super class, let's call it: Base > [

Re: Disallowing instantiation of super class

2017-02-23 Thread Irv Kalb
> On Feb 23, 2017, at 4:40 PM, MRAB <pyt...@mrabarnett.plus.com> wrote: > > On 2017-02-24 00:19, Irv Kalb wrote: >> Hi, >> >> I have built a set of three classes: >> >> - A super class, let's call it: Base >> >> - A class that inhe

Re: Namedtuples problem

2017-02-23 Thread Irv Kalb
> On Feb 23, 2017, at 3:00 PM, Deborah Swanson > wrote: > > The weirdness is that > > group[0][4] > > gets the right answer, but > > group[[idx][records_idx[label]]], > where idx = 0 and records_idx[label]] = 4 If that's the

Disallowing instantiation of super class

2017-02-23 Thread Irv Kalb
Hi, I have built a set of three classes: - A super class, let's call it: Base - A class that inherits from Base, let's call that: ClassA - Another class that inherits from Base, let's call that: ClassB ClassA and ClassB have some code in their __init__ methods that set some instance

Overriding True and False ?

2017-01-29 Thread Irv Kalb
I teach intro to programming using Python. In my first assignment, students are asked to assign variables of different types and print out the values. One student (who really did not understand Booleans) turned in the following for his/her interpretation of Booleans (Python 2.7): True =

[issue27854] Installed 2.7: IDLE Help disabled because help.html is missing

2016-11-08 Thread Irv Kalb
Irv Kalb added the comment: On my Mac (with version 2.7.12), selecting Help -> IDLE Help brings up a window titled "IDLE Help", it has a pop down with "TOC" selected and many pages of text documentation. On my Windows system (also with version 2.7.12), selecting