Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global vs local variable
#9
(Jan-12-2018, 08:31 PM)Gribouillis Wrote:
(Jan-12-2018, 07:33 PM)mpd Wrote: you can have simple, extensible examples without using classes.
It may be true, but this is for expert programmers, and there is little benefit in not using classes.

I think you've lost track of the OP's goals:
Quote:I'm a teacher and I just began learning Python so I can show some tips to my students.

I'm not suggesting the OP build an extensible game framework without using classes. I am suggesting that, when writing small programs to "show tips to students", you can -- and probably should -- do it without classes. After all, if the students have not seen a computer program before (the OP wasn't clear about that but I'm guessing this is the case), they're going to have to learn what a variable is, what s function is, what a loop is, etc.

Why add classes to that out of the gate when you don't have to?

Quote:Well, I don't think classes are difficult to understand and to use.
Neither do I but when I was a CS teaching assistant and tutor I encountered a lot of people for whom classes were very difficult to wrap their heads around.
Reply


Messages In This Thread
Global vs local variable - by mquesnel - Jan-12-2018, 03:01 PM
RE: Global vs local variable - by mpd - Jan-12-2018, 03:19 PM
RE: Global vs local variable - by Gribouillis - Jan-12-2018, 04:15 PM
RE: Global vs local variable - by mpd - Jan-12-2018, 06:47 PM
RE: Global vs local variable - by Gribouillis - Jan-12-2018, 07:13 PM
RE: Global vs local variable - by mpd - Jan-12-2018, 07:33 PM
RE: Global vs local variable - by Gribouillis - Jan-12-2018, 08:31 PM
RE: Global vs local variable - by mpd - Jan-12-2018, 10:59 PM
RE: Global vs local variable - by Larz60+ - Jan-12-2018, 10:45 PM
RE: Global vs local variable - by Gribouillis - Jan-12-2018, 11:49 PM
RE: Global vs local variable - by mpd - Jan-13-2018, 12:21 AM
RE: Global vs local variable - by mquesnel - Jan-13-2018, 06:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  It's saying my global variable is a local variable Radical 5 1,259 Oct-02-2023, 12:57 AM
Last Post: deanhystad
  Delete all Excel named ranges (local and global scope) pfdjhfuys 2 1,885 Mar-24-2023, 01:32 PM
Last Post: pfdjhfuys
  Global variables or local accessible caslor 4 1,083 Jan-27-2023, 05:32 PM
Last Post: caslor
  How to use global value or local value sabuzaki 4 1,214 Jan-11-2023, 11:59 AM
Last Post: Gribouillis
  UnboundLocalError: local variable 'wmi' referenced before assignment ilknurg 2 1,970 Feb-10-2022, 07:36 PM
Last Post: deanhystad
  Global vs. Local Variables Davy_Jones_XIV 4 2,712 Jan-06-2021, 10:22 PM
Last Post: Davy_Jones_XIV
  Variable scope - "global x" didn't work... ptrivino 5 3,129 Dec-28-2020, 04:52 PM
Last Post: ptrivino
  Global - local variables Motorhomer14 11 4,366 Dec-17-2020, 06:40 PM
Last Post: Motorhomer14
  Spyder Quirk? global variable does not increment when function called in console rrace001 1 2,272 Sep-18-2020, 02:50 PM
Last Post: deanhystad
  from global space to local space Skaperen 4 2,384 Sep-08-2020, 04:59 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020