pvcraven / arcade_book

36 stars 37 forks source link

Update how variables are handled in Python? #18

Open peterdcasey opened 1 year ago

peterdcasey commented 1 year ago

I would volunteer to help update the text to correctly describe how variables are handled in Python. In the text the idea of variables as containers holding values is incorrect. This approach completely falls apart when mutable types are used, particularly when passed to functions. Students moving on from this text (using the "containers" concept) have difficulty shifting their thinking to the "pointers to objects" idea. Mutable vs. immutable types should also be introduced.

I am recently retired from teaching programming for 40 years.

Thank you, Peter

pvcraven commented 1 year ago

Pointers are introduced in 16.4, and a bit with arrays as well: https://learn.arcade.academy/en/latest/chapters/16_classes/classes.html#using-objects-in-functions

For an intro course, I think some introduction to pointers is necessary, but I'm not sure I'm on-board with huge changes to overly complicate intro material. What exactly did you have in mind? I try to hit CS1 material here, but not worry much about CS2.

Immutable vs. mutable should be added somewhere, I'd agree with that.

peterdcasey commented 1 year ago

Paul, my motivation for contacting you is how great I like the idea of motivating beginners with graphics programming. My big concern is how important I think it is to teach Python variable concepts correctly from the beginning. Programming in C is correctly taught with the idea of “container” variables and then pointers to “containers.” Python only has reference variables. Asking students to imagine containers and then trying to switch to only references is not only confusing but making the change for many students is difficult and wastes time. This distinction becomes critical the moment mutable objects, lists for example, are used with functions.

Check out this link at the Real Python site. It is a nice example of how references may be taught in a clear and simple fashion. https://realpython.com/python-variables/#variable-assignment

It is only a suggestion but I think your online book with the graphics emphasis, would be improved by correcting the text about variables.

Thank you for replying to my initial query, Peter

+------------------------+ | Peter Casey – Bend OR | +------------------------+

From: Paul V Craven @.> Reply-To: pvcraven/arcade_book @.> Date: Saturday, December 17, 2022 at 2:47 PM To: pvcraven/arcade_book @.> Cc: Peter & Donna Casey @.>, Author @.***> Subject: Re: [pvcraven/arcade_book] Update how variables are handled in Python? (Issue #18)

WARNING: This email originated from outside of Central Oregon Community College. DO NOT CLICK ANY LINKS OR OPEN ATTACHMENTS unless you recognize the sender and know the contents are safe.

Pointers are introduced in 16.4, and a bit with arrays as well: https://learn.arcade.academy/en/latest/chapters/16_classes/classes.html#using-objects-in-functionshttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flearn.arcade.academy%2fen%2flatest%2fchapters%2f16_classes%2fclasses.html%23using-objects-in-functions&c=E,1,VJUeS9Gl10WmTACDRF6khqluNkQ9w8MX8Fs0CS8agsEaMkQ2IPQVdezxtlPbq4NV3xi_yJAyuf9oZCyWFLDOwHXXhGWv5WyN_mrqx41nCLTF27q_yMNS3w,,&typo=1

For an intro course, I think some introduction to pointers is necessary, but I'm not sure I'm on-board with huge changes to overly complicate intro material. What exactly did you have in mind? I try to hit CS1 material here, but not worry much about CS2.

Immutable vs. mutable should be added somewhere, I'd agree with that.

— Reply to this email directly, view it on GitHubhttps://github.com/pvcraven/arcade_book/issues/18#issuecomment-1356491888, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6X5AGPC5WV4BRI4QL4SVDWNY7JVANCNFSM6AAAAAAS66E7XU. You are receiving this because you authored the thread.Message ID: @.***>


This email was scanned by Bitdefender