#pedagogy

1 messages · Page 3 of 1

wooden grove
#

@orchid rose That seems off-topic for this channel. And please get permission from the server admins before promoting within the server. Thanks.

subtle wagon
#

guys is there a command to make a survey in text channel?

clever goblet
#

hi guys , ı need help . how can ı accessing the coordinates of the bounding boxes ?

clever goblet
#

okey didnt know . ı am new in english .thanks have a good day

void shard
vast night
#

!pow

worldly dewBOT
#

Positional vs. Keyword arguments

Functions can take two different kinds of arguments. A positional argument is just the object itself. A keyword argument is a name assigned to an object.

Example

>>> print('Hello', 'world!', sep=', ')
Hello, world!

The first two strings 'Hello' and world!' are positional arguments.
The sep=', ' is a keyword argument.

Note
A keyword argument can be passed positionally in some cases.

def sum(a, b=1):
    return a + b

sum(1, b=5)
sum(1, 5) # same as above

Somtimes this is forced, in the case of the pow() function.

The reverse is also true:

>>> def foo(a, b):
...     print(a, b)
...
>>> foo(a=1, b=2)
1 2
>>> foo(b=1, a=2)
2 1

More info
Keyword only arguments
Positional only arguments
!tags param-arg (Parameters vs. Arguments)

main axle
#

I am new to leetcode. Do I just type my codes in the red circle? because no matter what I typed, even just copy and paste the answers from the answer section, I got "is not a valid value of type integer"

stone shore
glad radish
#

Hello, everyone! May I ask you why the first one doesn't work and the second does? The first's output should be 1, but it's 0.
def h2(k):
k += 1
def m2():
n = 0
h2(n)
print(n)
m2()

def g1(l):
l *= 2
def m1():
l = [1, 2]
g1(l)
print(l)
m1()

noble aurora
timber jungle
#

Hello everyone ! I want to teach python to someone who is a complete beginner to programming. Goal is to teach core programming concepts using python, rather than python itself. I haven't had great success so far, and I think my teaching methods aren't quite right. Can someone please give me some advice on that ?
My student is at the point where he knows about python syntax and features individually, but is having trouble putting them all together and converting ideas to code. I don't quite remember how I personally got over that step myself.

noble aurora
#

practice problems

timber jungle
# noble aurora practice problems

That's what we're currently doing. But I don't really know what problems are appropriate. What should I expect a complete beginner to be able to solve ? How long should I let them think for before giving them a hint ? How should I word my hints ? Right now, after they've been stuck for a while, I just write the solution step by step, making sure they understand what everything means and why everything is as it is. Is that a good method ? Could I be doing better ?
Also, I've been taking exercises from a website called pynative, do you have any better recommendations ?

noble aurora
#

How long should I let them think for before giving them a hint ? How should I word my hints ?
i think all the questions you've are very context dependent. your hints would be different based on what they're stuck on: if it's syntax they don't know, no amount of hinting will help. if they don't know a specific method, no hinting will help. i would try to stay away from providing code as much as possible.

Right now, after they've been stuck for a while, I just write the solution step by step, making sure they understand what everything means and why everything is as it is
in my experience trying to teach people, it's very easy for them to just believe they understand the solution, rather than actually understanding

Also, I've been taking exercises from a website called pynative, do you have any better recommendations ?
as for where to get practice problems, i like codingbat for beginner exercises and codewars for more intermediate ones

What should I expect a complete beginner to be able to solve
that would depend on what you've taught them :P

timber jungle
# noble aurora > How long should I let them think for before giving them a hint ? How should I...

I've taught them the syntax and features they need to solve the problems. That is, variable assignment and reassignment, arithmetic, booleans, ifs and elses, fors, whiles, creating and appending to lists, and various other things of that nature.

if they don't know a specific method, no hinting will help
Can you please elaborate on that a bit ?

in my experience trying to teach people, it's very easy for them to just believe they understand the solution, rather than actually understanding
So should I let them be stuck at it for a while longer ?

I don't really know how to teach the ability to translate ideas into code

noble aurora
#

Can you please elaborate on that a bit ?
by method i mean methods on objects. built-in functions would be included. if they just don't know how to use int to convert say, input to an int, then even if they have the right idea, they won't be able to write the code

So should I let them be stuck at it for a while longer ?
honestly, i haven't found a good solution for this. what i've settled on currently is to let them try and solve the problem in pseudocode as far as possible, then help them translate into python. this makes sure they are the one solving the problem

timber jungle
# noble aurora > Can you please elaborate on that a bit ? by method i mean methods on objects. ...

by method i mean methods on objects. built-in functions would be included. if they just don't know how to use int to convert say, input to an int, then even if they have the right idea, they won't be able to write the code
Ah, that they know, I made sure they had all the tools they need for a given problem

honestly, i haven't found a good solution for this. what i've settled on currently is to let them try and solve the problem in pseudocode as far as possible, then help them translate into python. this makes sure they are the one solving the problem
Hm I will try that, but I'm afraid the pseudocode will add another layer of complexity. Python itself is very close to pseudocode. Can I please have an example of pseudo code someone you taught gave you ?

noble aurora
#

it's more english than pseudocode, the idea is to have no barrier to actually solving the problem (as opposed to maybe not knowing python syntax)
for example, for "check if a number is prime" you might do

def is_prime(n):
  loop i from 2 to n
    if i divides n, return False
  return True
timber jungle
noble aurora
#

the student is concerned? maybe they should just learn faster lol i'm not sure 🤔 i should ask my person rn tbh lol

as for a serious answer, i'm a bit wary of putting a definite time on it, there's a lot of variability and background detail necessary that i don't know. if the person is relatively competent mathematically, something like this would probably be pretty easy

timber jungle
misty dirge
timber jungle
timber jungle
vestal bramble
#

i have a question

pine stratus
# timber jungle Hm ok, and in your opinion, how much time should a beginner put in before being ...

Learning has acceleration. The more you already know the faster you can learn, as long as that new information is somehow related you what you already know (which increases the more you learn). When I start something completely new, I know that it will be slow, and I focus on correctness, not speed. Even if that means that it takes me really long for each part. The speed will come later when my brain puts those slower thoughts into a fast path form. In the case of programming this is common patterns (it's also why learning a new way of doing things is a bit of bump, such as functional programming (but even those bumps go away when you have learned a few different patterns)). If you try learning a game like chess (or any game with simple rules, but emergent complexity (because there is no barrier to entry in terms of having to first memorize a ton of rules or language, etc)) you can notice this transition happening pretty rapidly in a very observable / noticeable way if you pay attention to it while it's happening. Further improvement often requires forcing oneself to not rely on the fast path, and do it slowly, but correctly again. This happens a lot in math and programming and it can feel frustrating to have to slow down again, but being aware that this process is happening may help with that.

#

TLDR: Learning anything new will always feel like trying to ram your head through a brick wall in the beginning. I have trained myself to enjoy the brick walls.

timber jungle
misty dirge
worldly dewBOT
#

:ok_hand: Added squiggle-enjoys-brick-walls to the names list.

void shard
#

is it me or after learning a few programming languages it is extremely easy to learn another
like 90% of the differences are surface syntax and conventions

#

the concepts are virtually the same

neon pasture
# void shard is it me or after learning a few programming languages it is extremely easy to l...

it depends on the language, but yes, a lot of things are the same. Though it's important to remember that the similarities are often only surface level. A good codebase in one language will be completely different from a codebase in another unless they are exceptionally similar. And with languages like prolog, haskell, even the surface similarities are harder to identify. Regardless, if you know one language well, learning more languages is generally easier.

silent walrus
#

Core concepts like conditionals, loops, functions ect transfers, what differences is stuff like best practices, what is easiest to work with, ect, ect ... (And ofc a few language specific concepts/details)

#

(and I now see I am way late to this conversation)

void shard
#

yeah 90% of the time is learning how to use libraries and how to write idiomatic code

elfin dagger
#

cat

subtle owl
astral iron
#

A variable can contain both a number and a string

The len() function can work with either a number or a string

Any number can be made into a string using the str() function

You can make an integer from any string using the int() function

The find() function can work with either a number or a string

The + operator can work either with two numbers or with two string variables

#

are there all true or no help if posible

noble aurora
#

is this a test question lol

misty dirge
steep juniper
midnight jacinth
#

best way to tutor? im thinkin of tutoring python once i finish my python classes

#

so far I show em my code, explain it step by step but also feel like its a little cheatsy

weak mortar
stone juniper
spring coral
#

Is discussing ways to teach yourself more efficiently allowed?

misty dirge
weak mortar
#

@runic sigilwhat wrong here

runic sigil
#

Please don't randomly ping helpers.

weak mortar
runic sigil
#

This is the wrong channel to ask programming questions in

weak mortar
obtuse wadi
astral iron
weak mortar
#

Methods and practices of teaching.

So should we throw students to the fire with a complicated problem set and tell them to use their research skills.

Or baby step and hand hold them through the entire process?

What qualities make a good programmer?

stone shore
#

So I start with numeric operators, just to show off math in Python (Jupyter notebook to be precise, very nice tool to show for teaching)

#

Then variables (ints, then strings), lists, dictionaries, if/elif/else, for

#

Then functions, maybe a bit of classes

#

Then I usually switch over to pandas, as I teach a data-focussed class normally

misty dirge
weak mortar
stone shore
#

And in other parts of the training they also write bits of flask applications and learn SQL and stuff, it's kind of a broad overview before they dive deeper into their specialisations

stone shore
#

Other trainers teach them about patterns and such

misty dirge
#

patterns?

#

like, the C++/OOP design patterns?

stone shore
#

Yeah, a lot of companies are still looking for java devs. And the main trainers have extensive java experience, so that's also a selling points still, that those principles get taught too

#

And they can be generally helpful to think about design of programs

#

Although on the data side I haven't found too much of a use for them yet

misty dirge
#

I would probably just lose my composure and hide somewhere.

stone shore
weak mortar
stone shore
#

Since I work with my students in Jupyter notebook, most everything is single lines of code or at least very short snippets

#

That makes it extremely easy to debug for me, but also easy to teach how to approach an error, because usually we just right then have written the code that is throwing an exception

#

Reading those is such a useful skill to have

#

Mostly to have people actually start reading them, intently, because nowadays the errors are more and more descriptive and can even offer up the solution

weak mortar
# stone shore All the way up at the top I think

I agree. A good example, is a user on this server posted some code in the general channel asking why the number he wanted was not being output.

#python-discussion message

`I did some debugging and found he created a function: the parameter being a dictionary of values, but in the function he created a script that made a new dictionary and made the values of the parameter into keys of the new dictionary.

Effectively, the values of input was read and output as keys instead, for the new dictionary. More mix up occurred in the function which made the output even more messy. Which resulted in an unwanted print out.`

In practice, there are large amounts of code to review in a production environment.

But is it efficient to use Jupyter notebooks for all programming?

#

In the above case, no error was thrown. Only the output was unexpected.

stone shore
#

There is no real development of any significant code base

#

So I guess deep debugging like that isn't a thing, as none of them are training to be a Python developer

weak mortar
noble aurora
#

i think most of the time python is taught as part of a CS degree

stone shore
#

The ones that'll use it in their future jobs will do so in a data related position

#

So Data engineer, analyst, scientist, that kind of thing. They most likely won't ever develop serious software with it. Plus they are trainees, most of their training is going to be on the job, specifically for that job

#

We only give them a broad kickstart to get them in the door 🙂

sharp zinc
#

Hey. "Python Crash Course" by Eric Matthes is a good pick to revise Python? It's been a year I did something in Python and would like to rehearse it.

misty dirge
worldly needle
#

where to start learning python? what sources can i use? ._.

granite delta
#

you can follow that

worldly needle
#

thank you

misty dirge
earnest condor
#

can anyone recommend me a major python project idea for college

subtle owl
#

Hi! This channel is about the methods and practices of teaching.
If you need specific help, I will refer you to #❓|how-to-get-help

mint lily
obsidian island
#

not relevant

desert ingot
#

Not Python specific but a general coding question around the concept of multiple inheritances and superclasses. For example a language liek C++ has multiple inheritances, is it possible to have a superclass that contains multiple classes within itself? And if so, why not use a superclass like that and use a multiple class inheritance? I saw one example such as input and outputfiles (using a diamond hierarchy) but what other examples could you provide that would help my understanding for the purpose Multiple inheritances serve?

misty dirge
weak mortar
#

can anyone help me with using pandas I have a couple of questions?

misty dirge
rain plume
#

Disregarding whether long-form videos are a good teaching material (probably not), are there any good multi-hour learn-python videos, or can they be discounted as a category without exception?
I know FreeCodeCamp's 4.5 hour video is terrible after watching roughly 30 minutes of various sections, and I dread the idea of reviewing the countless others.

vale current
#

would, say, lectures be fine?

#

Harvard's cs50p course has a series of lectures, of which a lot are upwards of an hour long

#

I think a course format is pretty alright, as you get hands on work alongside the lecture

#

although trying to cram the whole language in a single video might be hard to pull off, and I'm personally not a fan of marathon sessions like that

rain plume
#

I may have forgotten about university productions, as I was thinking of the python in a single video videos that youtube is so full of nowadays

rain plume
#

and an entire video, albeit unlisted and one of the shortest at about 12 minutes, on style? these guys might be the exception

misty dirge
#

can you copy and paste the actual text? no one is going to want to read this.

steep juniper
#

Keep in mind this channel is for the discussion of the methods and practices of teaching and not a project showcase.

weak mortar
#

Hiii

sleek lagoon
#

hey

#

where i can see all the projects ?

lyric hinge
weak mortar
#

not sure if this is related to the channel topic (if not, feel free to ping me and tell me to remove) but what kind of techniques did you guys pick up to teach other students (techniques as in from perhaps lecturers or professors you had in the past) and what did you avoid?

ancient stone
#

I recently did a survey of python textbooks (specifically for analytics) for a course I'm teaching this semester. I found "Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and the Cloud" by Deitel & Deitel to be pretty good with great lecture resources. I have some quibbles around the supplied questions / project assignments, but I can make those up myself.

Any one else have a favorited textbook for teaching Python?

misty dirge
#

@ancient stone what are the objectives of the course? And what's the full course title?

#

Learning python, computer science, and data science basics is a lot for one course. Throwing big data and cloud computing in there sounds overly ambitious.

ancient stone
#

I am using it in an intro to analytical programming course - specifically the first ~10 chapters + some content pulled out of McKinny's book around pandas

#

Basically structuring the course to be foundations of python/oop, and data wrangling with pandas (organizing/cleaning data, ETL at a high level, etc.)

#

No modelling or anything like that. I went through several, several books and was unimpressed at the content / quality of the book & instructor resources. Just mainly curious what others find useful 🙂

sudden estuary
#

is there liek a suggested roadmap that i can use as inspiration

stone shore
sudden estuary
#

yep

#

i have a rough idea of what to do but im not sure what i should do to introduce them into more advanced topics like OOP (they are all beginners)

stone shore
#

What is the goal? Train them to be app developers, web developers, data engineers, something else?

sudden estuary
#

well you see its a bit of everything

#

i want them to get there feet wet in every domain to see what it's like and find there interests

#

then later on they can deep dive on there own

stone shore
#

Ah ok, then I would start with the basics: operators, variables, lists, dictionaries, functions, built in methods and functions (think str, int, split, isdigit, that kinda thing), how to find and read docs

sudden estuary
#

yea we already progressed

#

we only had a 2 hour session and they understand variables lists functions some builtin methods different varaible types

#

im having them work as a team to create tic tac toe

stone shore
#

Then you can branch to classes and OOP, pandas for example for data, perhaps flask for webdev/API, could also do four forms of data gathering: reading files, APIs, databases, and webscraping

sudden estuary
#

and they are almost done (with some guidance ofcourse)

#

hm ok

#

also where can i get some good exercises

#

i think leetcode is a bit of a reach

stone shore
#

I mean, I'm biased, I teach a data oriented course, so most of material is data based

stone shore
sudden estuary
#

kinda its very technical and all that

#

but i really want something thats practical so that they can see a purpose and understand there work better

stone shore
#

Try having them load data, clean it, visualise it
For a webpage make a simple Todo list app?

sudden estuary
#

hm was planning on using customtkinter do you suggest a UI library i can use? maybe pycone?

stone shore
#

I currently don't have any of my materials on Github yet, otherwise I could share it. Have to get on that

stone shore
sudden estuary
#

ah your too kind

#

tkinter is outdated and i think pyqt is too technical customtkinter is a modern version of tkinter

noble aurora
#

codingbat, codewars

sudden estuary
#

ok thanks for the tips ima see what i can do so far they are absolutely loving it

sudden estuary
#

haha we just finished tic tac toe they where absolutely amazed

wide shell
#

I teach a course on Python OOP at two local universities. In order to make the material enjoyable and understandable, I use the pygame extension and explain OOP using "widgets" in windows to build games. I start with simple widgets like buttons, text entry boxes, text display boxes, etc., then build up small GUI games.

I have built a library of these GUI widgets that is available on my GitHub for free: https://github.com/IrvKalb/pygwidgets

Then I turned my course material into a book that is published by No Starch Press: https://nostarch.com/object-oriented-python

(Also available on Amazon)

GitHub

A collection of user interface widgets in Python for use in programs using Pygame. - GitHub - IrvKalb/pygwidgets: A collection of user interface widgets in Python for use in programs using Pygame.

pine stratus
austere tundra
#

can someone tell me what is wrong in this and thedifference

heady dove
#

Which channel should I ask for help on some VBS code?

ocean mirage
#

I want to automate checking process of google sheet if specific column updated then run colab notebook is there anyone knows how can I do this?

stone shore
#

@austere tundra @heady dove @ocean mirage Hi all, this is a channel for discussion on how to teach, for python related help try the specific help channels or the help forum #❓|how-to-get-help

stone shore
sleek ginkgo
#

can anyone help me in VARIATIONAL AUTO ENCODER. please ?

stone shore
weak mortar
#

meh. Andragogy seems the more appropriate title for this channel vice Pedagogy.

vale current
#

isn't that specifically adult education

#

pedagogy is more general

misty dirge
#

The meaning of the word's constituent parts in the source language doesn't decide it's meaning in English. "Pedagogy" can and does refer to the practice of teaching in general

weak mortar
#

I just love when they drop a stack of code first ask questions later 😂

#

love? in the air?

#

really guys really 😂

weak mortar
#

Hi everyone. I just started solving problems on leetcode and i can't solve any of it without looking at the solution, and even when i see it, i barely understand it and need like hour or three to repeat that code without watching. Is that okay to learn like that, or i should learn some more theory before, so at least, i can have some idea about how to solve the problem when see it?

misty dirge
grand junco
indigo cove
#

Hello people! Can someone help with the script? It has a class class WM_OT_popUp(Operator): it should display a list of collections. I am trying to define this list when declaring the col_list variable: EnumProperty(
name="Collections",
items=lambda self, context: self.refresh_collections(context),
)
I tried in this way [(c, c, "") for c in [c.name for c in bpy.data.collections]], but in the first case the function is not called, and in the second return [(c.name, c.name, "") for c in bpy.data.collections.values()]
AttributeError: '_RestrictData' object has no attribute 'collections'

In general, can someone explain how to define a list and each time the button is clicked, update the list of collections so that it remains relevant for selection.
Here is the actual problem area:
class WM_OT_popUp(Operator):
...
col_list: EnumProperty(
name="Collections",
items=lambda self, context: self.refresh_collections(context),
)
def execute(self, context):
...
return{'FINISHED'}
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
def refresh_collections(self, context):
return [(c, c, "") for c in[c.name for c in bpy.data.collections]]

stone shore
stone shore
#

!ot try the off topic channels for off topic posts

worldly dewBOT
tropic depot
robust bane
#

@tropic depot I've deleted your message since your post does not have anything to do with this channel's topic

granite citrus
#

Uhm, I'm a little bit 13 years old and am currently teaching python to two 13 year-olds; one of them is a boy and he is not too much of problem, the only problem is that it's hard for him to switch from Pascal, but I also am teaching a girl, she recently decided to try programming, and I recommended Python since I think it's the easiest to start from, because if she were to learn Pascal syntax it would be pain I think, so for now I gave her the "Automate the boring stuff with python" book and am not sure how is it gonna go, because I had a problem when teaching her chess where she was like "wow, this is quite complicated, why would I need that?" and even if I explain why she needs that she forgets it in like 2 days; I am also not sure about the practice, because you can't learn to code without practice. Now I'm even thinking of telling her to stop learning programming lol

vale current
#

I wouldn't tell her to stop

#

additionally, asking questions shows that, at the very least, she has some degree of interest in the topic

#

as for retaining information, a lot of that is done through doing actual projects

#

hands on practice, that kind of thing

#

I believe ATBS has practice questions at the bottom of every chapter, you could have her her do those and go over it

weak mortar
vale current
weak mortar
granite citrus
granite citrus
olive pike
#

Im working on an Ai/ML project, that obviously uses Python. I am making a website where this AI/ML will be used. Should I do the backend with nodejs or would it be a better option to use Django for the backend??

misty dirge
#

this channel is for talking about teaching techniques, so please make sure all your messages are about that.

radiant cipher
misty dirge
winter spear
#

How do I teach a coworker who has a cs degree from 2 years ago but has lost all ability to program. When we peer-program, it ends up with me verbatim telling him what to do like I'm talking to Siri or Alexa and his mind shuts off. If I try to give him a small task he's completely lost

radiant cipher
misty dirge
winter spear
misty dirge
shy cosmos
cobalt wind
#

of course

vast night
#

!assert

#

!d assert

worldly dewBOT
#

7.3. The assert statement

Assert statements are a convenient way to insert debugging assertions into a program:


assert_stmt ::=  "assert" expression ["," expression]
``` The simple form, `assert expression`, is equivalent to

```py
if __debug__:
    if not expression: raise AssertionError
```...
spring solar
#

does someone knows how to add existing data base in visual studio

loud valve
#

I'd try to gauge skill level with some tasks like fizz buzz or some of the early cs50 exercises

#

but tbh if it's that bad it sounds like an issue for management seeing as the cost/benefit ratio of you teaching him is unlikely to be worth it

eternal crater
#

Hi guys, I'm a multi-language begginer/intermidiate developer. Lately I haven't done many programming projects but the things that I can do without stopping is interpreted programming languages, I find it really fun. I am trying to get some young and old developer to contribute on a project that I am making wich consists on making a programming language together and everyone helps eachother. Even tho I know some will ruin it I wanted to try. Any tips on how to get the people and start a community? DM if interested.

timber jungle
# eternal crater Hi guys, I'm a multi-language begginer/intermidiate developer. Lately I haven't ...

There is a discord server for programming language enthusiasts, as well as a subreddit
https://www.reddit.com/r/ProgrammingLanguages/
In the "related online communities" tab there is a link to the programming languages discord server

Also I might take a look at your project myself since I'm interested in programming languages ! You can dm me if you'd like to talk about it

#

I've been trying to come up with projects to work on with the beginner I'm teaching python to. Ideally it should be something :

  • That has an appealing end result, something you can interact with in a fun way or that looks cool
  • Satisfying at every step of the creation of it, you'd be able to see the project come together gradually at a decently fast pace : add a few lines of code, launch, see more cool stuff happen, repeat
  • Expandable upon : my student should be able to easily tweak the code, add features, change values while I'm away
  • Not too hard : should be relatively easy to implement without complicated algorithms or data structures

Something like a little game or cool visual effects

Any suggestions ? I'd appreciate them very much !

stone juniper
timber jungle
stone juniper
#

i also like games with 2D boards to teach how to separate the backend representation of state from what is displayed to the user

worthy basin
#

heyyy guyss

#

I got the assignments due and dont know how to do this assignment

#

can anyone help me

queen heron
bronze hawk
#

meow

sudden estuary
#

do you guys makeup ur own questions or is there a site that i can use to snag some questions for my students

timber jungle
worldly timber
#

can somebody help me with python code?

#

give me a GUI which allows me:

  1. select photos (multiple)
  2. select excel file
  3. input selected photos in dedicated cells A8, D8, A10, D10, A12, D12 so they fit the cell size (it will be default).
  4. in case of selecting more then 6 photos, copy the sheet and continue inputting photos to mentioned dedicated cells.
#

how can I d this?

stone juniper
quartz solar
#

Can someone suggest websites or videos, how to build my own python projects to practice python?

stone shore
worldly dewBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

rough ruin
#

Hey @sick current

#

can someone teach?

#

I have a few questions about learning python.

stone juniper
tardy mango
#

I am reaching out to you because I am in desperate need of help. I have been struggling with version conflicts between packages for a while now, and it has become increasingly frustrating. I spend hours trying to find the right version of a package, only to have another package not work properly.
I am looking for "THE SOLUTION" to this problem. I need to be able to use an tool that has the latest version from September 2022 and another tool that has its latest version from 2023. Even after finally being able to install both packages without errors, when I try to import a class, it often leads to conflicts with other packages.
My question for you is, what is the solution to this problem? Are there any tools that can check if multiple packages work together? How can I finally put an end to this issue that seems so basic but has become such a hassle?
I would be grateful for any help or advice you can provide.

loud charm
#

do u use virtual environments?

tardy mango
#

if delete my main python folder and reinstall, and reinstall each packages venv its not obligatory no ?

#

i testing with venv, i tell you

#

yeah problem, u fixed, but i dont understand how take packages i want without conflict version in the future

#

@loud charm thanks :DDD, i always have "AttributeError: module 'spleeter' has no attribute 'Separator'" on my flask website, but gg you fix a conflict package

loud charm
loud charm
loud charm
#

np !

tardy mango
#

my other problem, your have idea :

in .py
from spleeter.separator import Separator

separator = spleeter.Separator('spleeter:2stems')
separator.separate_to_file('audio_file.mp3', 'output')

and web site show me : AttributeError: module 'spleeter' has no attribute 'Separator'

#

@loud charm if you have time, else dont worry

loud charm
#

im afraid i dont know the spleeter library sorry

tardy mango
#

haha dont worry thanks also ❤️

loud charm
#

okei np ❤️ducky_ghost

naive cloak
#

Hey can anyone tell me whether we can use if sattement for input or not

#

??

steep juniper
clever gorge
#

Hello everyone! if you want to level-up your problem solving skills and become good in Data Structures & Algorithms, then you have my DSA channel where you can find Video Editorials of Coding problems and important topics of Data Structures, Algorithms.

Do Subscribe to the channel!

https://youtu.be/4ZTa9yHU22E

Learn about Linked List Data Structure and win your technical interviews.

Question link: https://leetcode.com/problems/lru-cache/

Like, Subscribe and Share!

#dsa #linkedlist #coding

▶ Play video
misty dirge
glacial iron
#

Hi everybody. Can anyone help me? I'm doing a project for a school based on a type of survey, and I want questions on a specific subject to appear when a button is clicked. Doing it on tkinter

stone juniper
#

@viral panther@buoyant ledge@glacial iron
this channel is for discussion about how to teach computer science, but you can find out how to open your own help thread in #❓|how-to-get-help

granite sundial
sudden estuary
#

the only valid thing posted so far

misty dirge
#

Given the frequency of off-topic messages and programming questions in this channel, we have renamed it to #pedagogy. Kindly do not respond to any prior messages in this channel that are not specifically about teaching and programming education. Please direct any comments about this change to #community-meta, and not this channel.

misty dirge
#

I guess to kick things back off: one of my instructors has a policy of only posting the slides for a lecture after the lecture has taken place. I assume this is to encourage people to attend the lectures, but I wish they were available in advance so that I could look over them ahead of time and write on them on my tablet. What do other people think about this tradeoff?

silent goblet
shy cosmos
silent goblet
#

hmm well, you can always send out an "errata"

#

and on the other hand, advanced students can point out mistakes and typos before the lecture even begins

shy cosmos
#

Also, it gives them more time if they don't need to make the slides available in advance. I did once give a lecture where I made a final edit to the slides about five seconds before starting the talk.

jolly night
#

When I did PyCon talks, I would publish the slides ahead of time and put a short-link to them in the footer of the slides so that people could get them during the talk if they wanted.

silent goblet
#

as a person with questionable vision, I do appreciate that 🙂

pine quartz
#

What I've seen some of my lecturers do (though not necessarily CS ones) is to have two copies of the slides released. One set before the lecture with the slides but not answers and whatnot (leaving the slides blank). During the lecture they'd write stuff on the slides. Afterwards they'd make the final version available with answers.

noble aurora
subtle owl
coarse quest
#

I think the worse thing is when lecturer doesn't give the slides and doesn't allow people to take photos of the slides during presentation... Had one like that.

coarse quest
subtle owl
coarse quest
#

I dropped out because of burnout and my mental health declining so much I basically couldn't do anything. There are more reasons to what you're saying. From reading stuff on social media, it seems situation like mine is really common with undiagnosed neurodivergent folks

subtle owl
#

I never said that's the only reason either 😉

winter spear
void shard
#

matplotlib?

misty dirge
# void shard matplotlib?

please do not respond to messages that are not about pedagogy. please use @viscid mural if you have a question about this.

deft cargo
#

@pure heron How would you approach the concept of "variable"? Would it be the first thing ever to introduce after "Hello, World" and data types, or immediately upfront then data types then "Hello, World"?

#

Same with "good coding practice". Do we just let people code, or we immediately introduce good practices as we go along the course?

pure heron
pure heron
# deft cargo Same with "good coding practice". Do we just let people code, or we immediately ...

I think it depends on the practice. For things like camel case vs snake case or tabs vs spaces for indent, I teach them the recommended way right from the start, and mention that it could also be done the other way but that it would be unusual. For things like sorting imports or using Black or adding type annotations to functions, all of that can wait for a long time after they get started. Basically, I try to introduce the Right Way when I'm introducing a concept, I guess

deft cargo
#

And of course we whip up some intentionally bad code to show what not to do?

pure heron
#

Possibly. Depends on the thing. I do a "is this a valid variable name", for instance, and I include a camel case name, and point out that it's valid but not preferred

deft cargo
#

I see. Thanks for your input geek

lapis grail
#

oof

wooden grove
#

It's based on the classic book Structure and Interpretation of Computer Programs, but uses Python instead of scheme.

#

It builds up an understanding of the evaluation, execution, and data models of python in an almost axiomatic way.

#

Its intended audience is computer science undergraduates who've already done a bit of programming.

noble aurora
#

i kinda like it. given that i'm the target audience, it seems that do pretty well 🤔.

#

there definitely is some level of mathematical/intellectual maturity required, i.e. it's quite rigorous. the embedded things where you can step through code are very nice

#

i think the rigor is a good idea. as long as the reader has the math knowledge needed they get a much better understanding of programming, especially the designing larger programs part

kind root
#

Hi guys, next year (winter 2024), I will be teaching scientific programming which is an introduction to programming to first year college students. These kids are in general science program. I'm already looking for material.

Is Jupyter Notebook a good platform to teach basic programming without the hassle to install software on every laptop?

misty dirge
# kind root Hi guys, next year (winter 2024), I will be teaching *scientific programming* wh...

Notebooks are a double-edged sword. They're nice for beginners because they can see the result of what they're doing as they go along, which if nothing else makes the experience more satisfying. But people who program for the first time in a notebook often begin to think of them as the default way of writing code, which can establish habits that run contrary to code maintainability, reproducibility, or modularity.

#

(Notebook users are also more likely to post their code or error messages as screenshots, which is really annoying, because you can't copy the text out of them.)

noble aurora
#

if you need an online editor, replit is probably the best. they even have easy "share link" things to check code if you need it

kind root
misty dirge
kind root
misty dirge
kind root
misty dirge
silent goblet
#

Though it does need installation

weak mortar
kind root
kind root
vale current
#

thonny? It ships with python bundled as well, so you wouldn't need to install it.

kind root
misty dirge
kind root
misty dirge
#

@vale current does Thonny have a package manager a la pycharm?

#

it's probably just as well that you use replit, though.

kind root
#

Mixed with Jupyter Notebook for notes.

misty dirge
kind root
misty dirge
kind root
misty dirge
kind root
misty dirge
#

Another issue is that to get the visualization effect from notebooks, you have to expose whatever you want to visualize to the global scope. Which is antithetical to modular programming.

kind root
misty dirge
#

That's fine, I guess

wooden grove
#

@loud valve Just realised, this channel is a good place to ask about the thing you were asking about yesterday. Just in case you didn't know it was here.

wooden grove
sudden estuary
#

thinking of doing code clash for my students might be fun what do u guys think?

kind dome
#

How old are they

misty dirge
sudden estuary
#

they first started by knowing nothing about not only python but computers

misty dirge
sudden estuary
#

its just a normal course

misty dirge
#

at what kind of institution? for who?

sudden estuary
#

institution

misty dirge
#

yes, what kind?

sudden estuary
#

im doing a course on the basics of python programming

misty dirge
#

is it a high school course? a course you teach on the weekend to people who sign up for it? what?

sudden estuary
#

i teach 2 times a week total of 4 hours anyone older than 16 can sign up

#

but all my students are like 40+

#

double my age

misty dirge
#

the people who sign up for your course, what do you think their motives for doing so are?

sudden estuary
#

some want to become web devs, some engineers and rest just personal work

misty dirge
sudden estuary
#

ok so basically we where playing code clash in this server ( i also didnt hear of it till yesterday) and essentially we try to solve problems 1. as fast as we can 2. as short as possible and it was amusing

#

but i just want my students to try and solve the problems as fast as they can

#

they dont have much confidence i tried to make my own questions they are getting somewhere

#

but they just dont try and im not sure why so i want to try and make it fun

sudden estuary
#

the issue for me is that they tell me the answer

#

but get confused when i tell them to write it

#

and i really try to pin point the problem

#

but i honestly dont know what the issue is apart from them being fairly new

#

i walked them through multiple times on how to 1. analyze a question 2. how to come up with a solution 3. how to debug 4. how to solve errors

#

i spent atleast 3/10 lessons on those 4 points (each lesson is 2 hours)

silent lagoon
#

I'm not sure if this is the correct channel to ask, but I recently got accepted into a college for Computer Science. Theres a section in the course that says you can waiver the introduction to programming of a specific language if you already have extensive knowledge in that language (an exam). Does anyone know what that exam usually consists of? Like is it really language specific in the case for python, OOP, functions, imports etc or is this more like conceptually?

shy cosmos
#

The only way to be sure is to ask the college if they have a description of the exam. You should email the department and ask for copies of the old exams. (In most circumstances they will gladly provide these on request.)

misty dirge
silent lagoon
#

The section about the waiver references C++, Python and JavaScript as introduction classes you can waiver with the exam

silent lagoon
misty dirge
silent lagoon
#

Yes the first requirement can be waived, it says by getting an 80% or higher on the exam will allow you to opt out of the introduction class in that specific language

shy cosmos
#

My guess is that this course covers programming basics like loops and conditionals. These can be learned equally well in any mainstream language.

silent lagoon
#

Most likely something like that, I was only a bit concerned because it says on the site that, "The exam consists of programming tasks that will usually take several hours"

upper flint
#

Hi your message has been removed for being off topic and not relevant

misty dirge
#

Check the channel description

golden stump
#

Does anyone have experience of using the PRIMM methodology? I used it a while ago but now i'm less sure about it. Interested to hear experiences.

misty dirge
golden stump
#

I guess no one has then!

misty dirge
golden stump
#

I had a phone call with Sue (highlighted there) about 3 or 4 years ago when she was developing it all and it was interesting to discuss her findings and research aims.

#

i'll look up POGIL - I haven't heard of this.

#

I'm always fascinated by approaches to teaching programming. I think it is a very difficult one to get right

misty dirge
#

@golden stump it was basically just group worksheets

golden stump
#

hmmm - primm is a teaching methodology

#

one of the principles is that typing in a heap of code is not part of the learning process

#

but making predictions about existing code does help the learning process

noble aurora
#

could you explain what PRIMM is about? i've never heard of it

golden stump
#

it's short for... predict, run, investigate, modify, make

#

so you wouldn't do all these stages in a single lesson

#

but you'd start of a topic with some prediction

#

and it requires that students look at some code and predict what it will do

#

and find out after RUNNING whether they're right

#

investigate gives some chance for trying things out in order to understand what the code does

#

my big bugbear with it is that students can't be bothered to do the prediction bit

sage jasper
#

how do you deal with impatient students that practically spam iterate different things to try

misty dirge
#

of those two, Python Crash Course is already on our list of recommended books. (link in the channel description.)

lyric hinge
#

what is the purpose of teaching beginners how to use type hints?

#

is it obvious what exactly it means, or are people just blindly copy and pasting the code?

misty dirge
# lyric hinge what is the purpose of teaching beginners how to use type hints?

I like for beginners to type hint their functions, because I emphasize thinking of each variable/argument/etc in terms of what it represents, and what it is. Which is its type. I see a lot of beginners who will write long winded explanations of what their functions are intended to do at some nebulous level, but they can't articulate what the inputs and outputs are.

What is it about type hints that you think is especially prone to blind copying and pasting? I'm not quite seeing the connection between the first and second parts of your message.

lyric hinge
misty dirge
lyric hinge
#

beginners will not always know other languages

misty dirge
#

I think they're self-explanatory for built in types, if you know what types and functions are.

#

I know. That's why I said "programming beginners".

lyric hinge
#

i see, i will have to learn more about pedagogy tomorrow it's an interesting topic

misty dirge
#

Tomorrow, you will have to decide if python is a good language to use for learning algorithms and data structures.

#

@stone juniper knows what I'm talking about. We're so good at pedagogy.

misty dirge
#

You know sorting algorithms, hash tables, Dijkstras, etc?

lyric hinge
#

a little

#

i’m not good at anything math or algorithm related honestly lol

#

@misty dirge what did you mean?

misty dirge
# lyric hinge <@253696366952316929> what did you mean?

sorry, I was asleep. computer science students always take a course on algorithms and data structures, and some of the data structures (and by extension, the algorithms that use them) are nearly hardware-level abstractions. so something we've debated in this channel is if Python is a good language learning how those algos/data structs work.

#

For example, when we talk about how long sorting algorithms take to execute, we assume that the amount of time it takes to access or overwrite any index of the array is the same. Which means that you're already abstracting the RAM.

noble aurora
#

by RAM you mean random access machine?

misty dirge
#

random access memory

noble aurora
#

most time complexity calculations assume a random access machine where the memory is just an array

misty dirge
#

I see. yes, memory as one big array is what I had in mind.

wary snow
#

This subject is always something that's interested me because ever since I started taking classes on computer science the professors/teachers almost always weren't the best at coming across to their students

#

I also hate how professors dont even obey variable naming rules most of the time

misty dirge
wary snow
#

Python mainly. Professors tend to ignore snake case rules all the time and constantly use one letter variables

misty dirge
wary snow
#

Yeah but from my experience professors normally use one letter variables for most situations which is where the problem occurs

#

I've also never had a teacher who uses type hints

misty dirge
#

I'd rather have a teacher not use type hints than have them use type hints, but mislead students into thinking they do more than they actually do.

noble aurora
#

naming conventions are pretty mild on the spectrum as far as teaching errors go

#

more egregious would be like, range(len(...)) loops as default or something

wary snow
#

Yeah I do agree it's just something that's very easy to notice

#

Also I kind of disagree. Not really for small programs because they're not really needed but for larger programs where you're dealing with multiple different data types they do help

#

Especially if you have an IDE that requires type hints to give you suggestions

misty dirge
wary snow
#

Eww

void rain
#

would python crash course 2nd edition (I think its a 2019 print) still be mostly up to date for starting out with python?

misty dirge
#

interestingly, 3.6 was the most recent version that I think does significantly impact beginner code, because of fstrings.

shy cosmos
#

For a beginner it should be fine.

#

The projects at the end of the book may be a little out of date, since they require some external packages. But it looks like the basic Python language features described in the book haven't changed.

full holly
#

what books are you thinking of using? @void rain

#

Ok thanks, i’ll take a look at that one as well!

tawdry sundial
#

I have a friend whose trying to throw himself in programming properly. He has decent knowledge of bash, python, C++, and Java, but he's not really above a novice level programmer in any of those languages.
He's been thinking of going into leetcode to teach himself, but I've heard mixed results on it. Are there any alternatives he should shoot for? He does much better when he's given guided instructions and then given a "solve it yourself" problems

lyric hinge
#

i think it's a good tool for practicing but i wouldn't say it would teach you more python

royal geode
#

Trying to figure out the right vocabulary to use when explaining some Python stuff.
In f(x,y,z=None), I believe that the term used everywhere for x, y, and z are "arguments", at least at the callsite. But if you look at a good amount of Python docs, for the definition site of functions a lot of docs mention parameters.

Has there ever been a big debate/decision on this?

stone shore
#
def func(parameter1, parameter2):
    return parameter1 * parameter2

argument1 = 5
argument2 = 8
result = func(argument1, argument2)
pine stratus
golden stump
royal geode
#

Thanks for the help (a bit ashamed or shows up so prominently in the Python guide!)

ornate wave
#

Hello, i am an engineer in coputer science and i have been teaching kids to code, they lately suggested (kinda forced me) to do AI related exercices but they dont seem as excited as before about it.

#

I come to asl of it is the right thing to do or should i just oppose the idea and stick with normal matrix calculus etc.

misty dirge
ornate wave
#

I teach as a side hustle.

#

I mean i show the the theory and make them do the application like linear regession and stuff like that.

misty dirge
#

at one time, I was planning to do a data science workshop on this server, and my plan was to go over tabular data manipulation, and basic statistical models that you can pull off the shelf of scikit-learn.

tidal orchid
misty dirge
ornate wave
#

Do you organise courses here ?

misty dirge
#

Nope. We curate a resources page and have a help system.

ornate wave
#

Thanks for the information, have a great day.

misty dirge
#

I don't know that I said anything particularly insightful.

ornate wave
ancient stone
#

Any tips for creating python exams for students to take in class? I’ve always done like take home projects or similar and I’m worried about creating a test that students can actually complete in 2ish hours

misty dirge
ancient stone
#

It’s an intro to python course with some data analytics thrown in. Think data types, structures, functions, conditionals… pandas.

misty dirge
#

I don't have any ideas about how to examine people for pandas tbh.

#

maybe you could give bad pandas code with loops, and ask what pandas methods they would use to rewrite the code without loops.

ancient stone
#

I know it probably sounds stupid but I didn’t even consider like set questions haha. I should mix some of those in.

misty dirge
ancient stone
misty dirge
ancient stone
#

Oh they will have computers haha. Just the exam has to be in class, 2 hours to complete

#

Sorry if I have the wrong impression

misty dirge
#

ah. I didn't take any CS exams on computer until covid started.

ancient stone
#

The thing is with past take home projects… some students finish them in 1-2 hours and weaker students finish them in 10-12 hours. Not exactly ideal to find a balance between the two

misty dirge
#

what do you know about the 1-2 hour students as compared to the 10-12 hour ones? do you think they had prior experience with python, or programming more generally?

ancient stone
ancient stone
stone shore
spice aspen
#

@misty dirge I'm so sorry I'm new to Discord. Thanks

misty dirge
spice aspen
#

@misty dirge Thank you

brazen plover
#

Where do you think the line should be drawn between correctness and practicality?
For example, to say reference counted GCs will have a problem dealing with cyclic references is correct. To say that python suffers from it since it uses the same model is not. And going into the details of it all is maybe unnecessary? How would you present this information?

tidal orchid
#
  • is it the main subject of the discussion, or merely a tangent?
  • how likely it is that the learner will use that knowledge or learn more in depth about that topic later?

if it's a tangent about something that they'll never touch, I would probably not be too fixated on correctness
if it is actually relevant to a project they are working on, you might want to avoid overloading with details, but keep the boundary between "how things actually work" and "imagine it like this" clear enough to avoid causing more issues

#

(there are also some other factors you may need to consider like overall programming experience/knowledge but I'm not gonna go overly detailed on all possible factors)

brazen plover
#

Say if you were just teaching how memory management works in python, then?

brazen plover
#

like should you aim for 100% correctness, or perhaps are some things better left as black boxes...

tidal orchid
#

I'm not particularly knowledgeable about memory management myself, but it does sounds like you might want to at least mention on a high-level view how python works around that issue (note: I have no idea myself)

sick current
#

@deft cargo did you want to talk to me here?

deft cargo
#

@sick current Courtesy ping

I'm planning to (again) write a series of blog post trying to teach Python, as probably numerous of high-visibility people in the community have (idk, I'm spitballing). Thing is, I don't know whether I'm qualified enough to be teaching people. I know (some of) the good practices, I'm fairly confident about my ability to explain things, and I have written projects (though everything is half-arsed completed) so I know my way around some tooling and DevOps. The kicker is that I'm not from CSE (Com Sci & Eng), I don't have deep knowledge into Python nor any topic. I picked up Python and Google as I go, getting feedback from mainly PyDis and self-teaching bits and bobs that I need.

sick current
#

so a technical review that looks at the programming details

#

you can add on reviewers for the written parts as well

#

you can also have reviews for the scope, like a tutorial about how to use venv is great, but without meantioning virtualenv pipenv poetry and conda and why they differ are giving people the wrong information even though it is techincally correct

deft cargo
#

Understood. I have also written an introduction as a way to combat writer's block. I'll export through Hugo later, can I have your glance at it then?

sick current
#

you dont have to feel like your not competent to teach @deft cargo you can offset that by having others help you to review

sick current
deft cargo
#

I'll keep discussions public then, my pitfalls can be of help to others

deft cargo
#

@sick current I'm back from the depths of reality

#

Do you take ngrok links? I'm behind a VPN of course, and everything is just raw Hugo

misty dirge
#

It sounds like whatever is being discussed currently depends on context that only PyTH's Alt and eivl know about. If the conversation is about methods and practices for teaching, try framing the discussion in a way that anyone can jump into.

deft cargo
#

@misty dirge Ye, it was 03:43 local time and I thought eivl was still at his computer, hence the ngrok

#

I'm trying to figure out how to host the bugger on GH just so I don't have to rely on ngrok and a VPN to make sure ngrok doesn't leak my IP

misty dirge
#

If this is just discussion between you and eivl about a project you're doing, but you don't talk about methods and practices for teaching, it doesn't matter if the project itself has to do with teaching. This is a discussion channel, not a planning channel.

deft cargo
#

Aight

rich verge
#

answer to somebody's question to add no's divisible by 3 and 5 in a given range by user and get their sum:

#

m=int(input("enter the starting number:"))
n=int(input("enter the ending number:"))
o=n+1
l1=[]
for i in range(m,o):
if i%3 == 0 or i%5 == 0:
l1.append(i)
lsum=(sum(l1))
print(lsum)

halcyon mauve
misty dirge
#

This channel is for talking about methods and practices for teaching.

cloud rover
#

Got it

rain radish
#

Hi there, looking to help teach 13/14 yr olds programming. What are some recommendations you all would give for do/don'ts and some ideas on how to best keep their attention?

hybrid summit
#

Then also, give them access to the PowerPoints and documents you teach them with, as long as they don’t contain the answers

#

Bc some of them may find it easier to read it themselves if they don’t understand

#

Hope that helps a bit

dusty slate
#

Is pomodoro technique useful for programmers?

limpid timber
#

it depends on the person and how they work imo, but I'd say give it a couple of tries and see if it fits you
I don't personally use it, but I know a few people who do and they find it helpful

static lily
#

Some people like doing bigger breaks, some don't

#

Some are working machines and don't need rest)))

white stream
calm mural
#

I'm currently wanting to write an introductory book/tutorial on Python for beginners. I am a bit stuck on the order in which I want to explain topics. The main problem I have is that explaining a topic fully requires the understanding of some other topic, which sometimes requires the understanding of the initial topic, like a cyclic reference.

I am currently thinking of the following order of the first few chapters:
chapter 1: basic data types (ints, floats, booleans), and item assignment
chapter 2: strings and string manipulation, also covering input and print more in-depth.
chapter 3: if statement and while loop
chapter 4: Custom functions
chapter 4: data structures (lists, tuples, sets, dict)
chapter 5: for-loops (how to use use them with sets, lists, dicts etc., maybe also covering zip and unpacking)

Any opinions or suggestions? (hope this is the right channel for this)

upper flint
#

I think data structures a bit earlier? And for loops after if statements and while loops

calm mural
#

I also want to focus a bit more on common pitfalls, like in automate the boring stuff they explain item assignment as a labeled box with a value in it, which could result in some common errors where multiple variables refer to the same list f.e.

calm mural
upper flint
#

Then maybe a chapter all about iterators?

calm mural
#

Inbetween while loop and for loop?

upper flint
#

Instead of just for loops, extend it to all iterators

oak breach
#

hmm maybe custom functions after data structures and for loops; and does string manipulation need to be that early?

calm mural
#

Yeah It's a bit early :/ So rn I'm thinking

1. basic data types (ints, floats, booleans, **strings**)
2. if statement, while loop
3. data structures (lists, tuples, sets, dicts)
4. string manipulation
5. for loop
6. custom functions

Something like this

#

I'm not sure if strings should be a separate chapter, there is just a lot of methods to discuss making me think I should

oak breach
#

i like this sequence

#

might want to add error handling after this

noble aurora
#

honestly I don't think string manip needs a chapter

vale current
calm mural
#

Yeah exactly, that is why i just want to explain some iterables, to be able to show how a for loop can be used, and maybe dive in further into the book

calm mural
upper flint
elfin nacelle
#

i think it makes sense to just do loops twice. part of the issue is that you're trying to fit concepts that are not python specific into how python does them

#

which i think is kind of a disservice. makes it more difficult to generalize (again imo)

calm mural
#

Yeah, for loops in python are just a completely different beast than other for loops

calm mural
#

So what about item assignment. In "automate the boring stuff" the writer explains variables as labeled boxes that you put your values in. This analogy works well for all immutable types, but when the reader has to understand item assignment for mutables like lists, this analogy would be confusing. Should I explain item assignment more clearly early on, or keep the more vague, but easier to understand box analogy, and later on adjust this view on item assignment?

misty dirge
#

variables as "boxes" was never a good metaphor. not even for immutables.

#
a = b = 3

is 3 now in two boxes?

noble aurora
#

I prefer the names and values explanation given by nedbat

elfin nacelle
#

yeah, i think approaching it as names or even pointers may be more sensible

noble aurora
calm mural
misty dirge
#

I wouldn't use the word "pointers" so they aren't tricked into thinking that they understand pointers in C. the visual that I like is variables as names written on sticky notes that are put on the objects.

elfin nacelle
#

fair enough. i do recall seeing some drawings with arrows showing the correspondence in the nedbat video, and i think that's pretty good

pine stratus
#

Perhaps, "references?" Variables are references to values (variable name -> value). Pointers are references too, but a pointer variable is actually a reference to a reference (variable name -> pointer (which is a value too) -> value).

#

(Mapping name to value)

sharp echo
#

hello

calm mural
#

You guys think this is a good visualization/example for variable assignment?

neon pasture
noble aurora
#

i would prefer straight lines, but yeah it looks ok

neon pasture
#

though I am not sure how you would visualise a list in this format

noble aurora
#

pythontutor does it pretty well. i assume you would just have an oval with a list looking thing inside

calm mural
#

It's just a rough proof of concept, I can make it prettier if I feel like the example is clear at least.

desert patio
#

there's refcount and deallocation info missing in the explanation of figure 2.2.d but i think it should be fine for now

calm mural
golden stump
#

i do not like it, because it makes it look like num2 and num3 are pointing at the same actual thing

noble aurora
#

they are

golden stump
#

but if you increment num2, it won't increment num3

#

so they can't be pointing at the same thing

#

it's more complex than that

misty dirge
#

is this about pedagogy?

golden stump
noble aurora
#

sorry stelercus >w<

golden stump
misty dirge
golden stump
#

so does this mean if i do...

num1 = 10
num2 = 10
num3 = num2

Will they all be pointing at the same object, or will num1 be pointing at a different "10" object?
If this is so, I'll have to change how I explain this. 😢

noble aurora
#

it depends. in cpython they num1 and num2 will be pointing to the same thing, but num3 and num2 are definitely pointing to the same thing

golden stump
#

is there a way to tell?

noble aurora
#

yes, id

misty dirge
# golden stump so does this mean if i do... ```py num1 = 10 num2 = 10 num3 = num2 ``` Will the...

for variables that refer to instances of immutable types (like ints), the fact that the variables happen to refer to the same object can't have any runtime effect, except for using the is keyword. so there's no reason to ever check.

for variables that refer to instances of mutable types, it does matter. so it's better to only worry about that kind of thing in the context of mutable types.

#

cpython has an optimization where all integers between I think -5 and 256 (the actual range doesn't matter in this conversation) are pre-allocated when the interpreter starts, so any equivalent integer variables in that range will share the same object. But that is not part of the language spec.

golden stump
#

the more i know, the more i don't know!

desert patio
grand vault
#

how does one explain the concept of vectorisation neatly?

my TLDR explanation is "vectorisation is basically the process of converting an algorithm/operation from operating on a single value at a time to operating on a set of values (i.e. vector, hence the name) at one time."

what if the other party says "but at the end of the day, you still need to iterate over each element in the vector to do said operation, how is that any faster?"

i am not sure how to answer that without going into SIMD and CPU caches which imo might introduce more confusion.

(context is trying to explain why my numpy aglo is faster in this thread https://discord.com/channels/267624335836053506/1087698863831400499)

misty dirge
#

what if the other party says "but at the end of the day, you still need to iterate over each element in the vector to do said operation, how is that any faster?"
If they want to learn more about how the computer works closer to the bare metal, they're certainly welcome to. But I think most students are content to know that "the operation is performed at a lower level".

grand vault
#

right, that's good to know 👍 thanks

#

heh imagine shilling julia in python discord 😛

but in all seriousness, imo that just shows the student how to do it but not what it actually is

noble aurora
#

i think it's sufficient to say something like "the cpu can optimize this by doing a bunch of iterations at once"

modest prism
#

Hello! I would like to start learning programming, but I'm not sure where to start. I know that I should choose a lx programming, I chose Python, and I would really appreciate if you guys could give me some advices/sources so I can start, bc for me is really difficult to learn something with a lot of information and I think it would be easier if it is possible to save some time.
Thx! 🙂

grizzled wadi
grizzled wadi
# modest prism thank you!

Well, it was a starting point, but not a good one for me - after reading this for two hours I feel like I'll never ever be able to learn coding...

misty dirge
#

@modest prism @grizzled wadi this channel isn't for general python advice. it's for discussing teaching techniques.

dull gulch
#

resources on how to teach python? more specifically, how to introduce a person on programming using python

misty dirge
dull gulch
#

and as the time progress, I'll be introducing her to more niche things so he can choose a specialization area.

fervent yoke
pallid forge
#

I have just started learning Python myself. Learning the fundamentals via a 6h Python course from ‘Programming With Mosh’

#

Clever Programmer has a
12h course, lots of program building to go with it

olive oyster
# dull gulch resources on how to teach python? more specifically, how to introduce a person o...

If you're teaching a total beginner to programming,
I'd recommend starting out from the very basics of it - which boils down to critical thinking and problem solving. trying to come up with a plan/pseudo-code before programming.

as in, being "lazy" and not copy pasting 10 lines of code over and over.

as for the metarials - I'd say a bit of "solving" problems, with turtle¹; then sliding back to variable assignments, data types and functions.

¹not the programming part, simply making the psuedo-code for it.

A quick example,

Given a map and a turtle, which can only do 2 actions - Turn_Left, and Move_Forward

The turtle wants to eat the apple somewhere on the map (given a map with a set place for the apple) - get turtle to apple.

What instructions would you give it?

Now, some people, would just say to turn left 3 times, whenever they would want to go right ‐

Show them that they can simplify it, defining an alias for a set instructions;
Calling (new) function/instruction "turn right", that is just 3 left turns.
Then, it'd be much easier to "code"/give instruction(s) to the turtle.
(in other words - working smarter, not harder)

misty dirge
#

Please make sure that all your messages are about the methods and practices of teaching, or in response to a message that is.

noble aurora
#

if I may shift it on topic, what examples would you use to teach recursion? I know fib and factorial, but what are some other ones you might use?

weak mortar
#

bastard

misty dirge
#

!mute 993918565063348324 "1 day" Please stay on-topic, don't argue with moderators, and don't call people bastards.

worldly dewBOT
#

:incoming_envelope: :ok_hand: applied timeout to @weak mortar until <t:1680649821:f> (1 day).

noble aurora
#

yeah I think mergesort is good, though reportedly some people find quicksort easier to learn

misty dirge
noble aurora
#

linked lists! my prof used those

#

maybe they are useful after all

misty dirge
#

you're saying that linked lists aren't useful?

noble aurora
#

it was mostly facetious. I think linked lists aren't as useful relative to how often they're taught

pine stratus
#

Search algorithms (on graphs). Solving the river crossing puzzle with it.

misty dirge
#

they're a great way to learn OOP, and you can compare their asymptotics to contiguous-memory arrays.

noble aurora
pine stratus
#

A river crossing puzzle is a type of puzzle in which the object is to carry items from one river bank to another, usually in the fewest trips. The difficulty of the puzzle may arise from restrictions on which or how many items can be transported at the same time, or which or how many items may be safely left together. The setting may vary cosm...

noble aurora
#

oh with the farmer and the animals

tired forge
#

Fibonacci may be overused, but it does mean the teacher can demonstrate the O(2^n) implementation that takes eons to compute the 100th number. When I was shown it I remember being impressed how writing such a simple function the wrong way made it almost useless.

pine stratus
#

I believe that making the backtracking have meaning in a not so abstract way helps a lot. Backtracking in a graph where each edge is an action has concrete meaning as "undo my move."

#

Getting a feel for going back out of the nested calls.

#

Graphs are also easily visualized.

weak mortar
#

by the grace of allah i shall bypass this mute

noble aurora
#

what about n-queens? i think backtracking is nice in general for learning recursion, but the issue is they're much more involved compared to fib or factorial

misty dirge
weak mortar
pine stratus
#

Also it may be motivating to see how programming might solve a real world problem, even if it's a trivial version.

#

This also leads nicely into robotics / it's easier to see how that could work.

#

It is possible to make a physical version with robots moving back and forth over a little river drawn on cardboard.

noble aurora
#

back in 6th grade we had the TI/lego somethings, which were fun little lego cars you could program. we had a big map with stuff to pick up and drop places or push things, etc

oak breach
elfin nacelle
#

solving a maze via backtracking too

calm mural
# weak mortar you should include lists

Only read this now. I show how assignment works in the first chapter. Then in the chapter on lists I can use the same visualization, to make it clear how this is relevant for lists as well. The whole reason I choose this visualization over "item in a box" is because of mutables like lists ^^

worthy totem
pallid forge
worthy totem
pallid forge
thick lark
#

I'm more than nob, gting to @modest urchin si far. Want to buold a api OS on Apache server, to usit on a tutorsbot"is copy rigth".🤣🤣🤣

#

Help

misty dirge
thick lark
#

Ok

misty dirge
#

I'm a seasoned developer new to Python, and I came into it thinking it might be a great language for beginners. Two weeks a lot of code in, and I have to say, the way arrays and OOP work in Python are so radically different than most other languages that I would hesitate to recommend it as a learning tool. New, budding developers would absolutely handicap themselves using this as an intro to those basic concepts. In my opinion.
@calm haven keep in mind that python lists are not arrays, and they're not trying to be arrays.

noble aurora
#

but python lists basically implement the same interface as arrays in say, C, so i'm curious to see what you mean by "so radically different"

misty dirge
#

I've met people who think that pointers are a fundamental for all programmers, and that people who don't start with a language that has them are also "handicapping" themselves. do you agree with that proposition?

calm haven
# misty dirge > I'm a seasoned developer new to Python, and I came into it thinking it might b...

That's a very fair statement, actually. But it also reinforces my point, too. Any suitable learning tool should have a reasonably standard implementation of arrays (definition, handling, etc.) So while I can make use of Python and find it useful for particular tasks, I don't see recommending it to beginners. I'm really surprised by to be saying this, as I've heard Python touted as great for beginners VERY often over the years.

civic marsh
#

I think it's also worth noting that "OOP" is a concept and there's no centralized standard implementation, so different languages will implement it differently

calm haven
misty dirge
calm haven
#

I'm not debating the pros and cons of Python lists and it's basic OOP. I'm just saying that I've found them so radically different from other languages that I would now hesitate to recommend Python as a beginner's learning tool.

noble aurora
#

a beginner isn't going to be comparing two languages though. why does that matter? (besides, many languages have dynamic arrays, or vectors, like python's lists. JS's ven calls them arrays!)

misty dirge
#

But if you're taking the position that a pedagogically valuable programming language needs to provide arrays with a specific interface, what is it about that array interface that is so pedagogically valuable?

calm haven
#

Because what a beginner learns on cements their understanding of the fundamentals. Or in Python's case, their MISunderstanding of the fundamentals. 🤣

misty dirge
calm haven
#

Array handling should be somewhat similar to C. In Python, you can't do this: bufferArray = [10][2]

misty dirge
noble aurora
pine stratus
# misty dirge I've met people who think that pointers are a fundamental for all programmers, a...

I don't think the starting language matters (the language itself, stuff like being able to just make a new file and go like in Python matters a lot) (except for an extreme case like an esoteric language (as long as it's a reasonable language that is used a decent amount)), but a beginner should probably have a language like C (or another with pointers) under their belt at some point. The mental model of how the computer works on a lower level can save a lot of trouble later (without having to ever really dive into the details later, just being aware is enough).

calm haven
#

So, maybe the way express my thinking is....

  1. I'm not being critical of Python
  2. Any language for beginners ought to implement arrays and a basic OOP/classes somewhat similar to C/C++
  3. Ergo, I could not recommend Python as a beginners learning tool
  4. I'm shocked to be saying this because for 10 years now I've heard about what a great learning tool Python is.
misty dirge
calm haven
#

YES,

#

Sorry eat and run, but I have to step away for a bit.... It's OK if you guys don't agree with me, you're still awesome!

#

...and I will still be using python for some cross-platform utilities.

misty dirge
#

Or at least I do 😛

calm haven
#

Right on!

misty dirge
pine stratus
#

Unfortunately, the alternative (for C++), Rust, adds a bunch of extra stuff that is probably not great for beginners.

misty dirge
#

Like what?

pine stratus
#

The enforcement of strict ownership rules.

#

But I have heard that some like it as a beginning language, so IDK, hard to say. Probably does not matter as in my previous response.

noble aurora
#

i think rust would be better than c++ if you're going to start with one of them. better the compiler tells you you're wrong than discovering that your code doesn't work for some reason

pine stratus
#

What I do know is that C and C++ make it difficult to get to the part you actually care about, programming (first you need to learn about what a compiler is, Makefile, etc, etc). And doing interesting things with libraries.

pine stratus
calm haven
#

I wonder if I should take a hard look at Rust before committing a host of small projects to Python.

pine stratus
#

If you want C++, Rust.

calm haven
#

I don't want C

#

Or C++

pine stratus
# calm haven Or C++

Hmm, it looks like you want OOP, garbage collection, and arrays. I recommend C# (better Java IMO).

calm haven
#

Oh, do TONS of work in C, C++ and C#

#

I need to create some quick, handy, cross-platform utilities. So I thought Python would be a good fit.

#

Actually, I'm looking at PERL right now.

pine stratus
calm haven
#

I haven't worked in PERL since the early 2000's, but used to be quite good with it.

#

No, these utilities must do a lot of file IO and systems and API integrations, in little bits. Both on Linux and Windows. I NEED arrays, some reasonably solid implementation of them, and a basic OOP that doesn't require passing a self reference everywhere and has overloading would be GREAT.

pine stratus
misty dirge
#

I am now permanently of the opinion that a pedagogically valuable programming language needs to have literal syntax for some kind of hash table, and no amount of argumentation could ever convince me otherwise.

pine stratus
misty dirge
calm haven
#

Yes, I need arrays. I often read in things line by line from various, proprietary file formats. Read 3 lines, analyze, then read the next x line based on that. Read in lines 1, 3, 8, 15, 24 and check those. Quite often I build small tables in memory using arrays to direct the flow of function calls and their location.

#

I could go on and on

pine stratus
#

Built in types should usually have some literal associated with them, because you can, because it's built in.

#

(Otherwise it should not be built in, standard library maybe)

calm haven
#

Python seems like a fine, fast tool. I am just shocked it doesn't have arrays. I'm and old school guy and I guess to me, and I know this isn't a popular opinion, but if a language doesn't have arrays, does it even qualify as a programming language?

misty dirge
pine stratus
calm haven
misty dirge
calm haven
#

But the output is unpredictable from application to application. Sometimes that works just Iike I expect, then sometimes is doesn't work at all like I expect.

pine stratus
#

Java IDK probably not 😦

calm haven
misty dirge
pine stratus
#
var students = new Dictionary<int, StudentName>()
        {
            { 111, new StudentName { FirstName="Sachin", LastName="Karnik", ID=211 } },
            { 112, new StudentName { FirstName="Dina", LastName="Salimzianova", ID=317 } },
            { 113, new StudentName { FirstName="Andy", LastName="Ruth", ID=198 } }
        };
#

C# lets you basically make literals for anything, it has way more fancy features than Java (including stuff for speed, like structs and pointers!).

calm haven
#

C# is a pretty powerful language. I've done tons of work with it for years now. I'm a big fan.

#

Those .NET collections can get you in trouble if performance is key, but with many C# projects, performance is often NOT key and man, they sure are handy to use.

pine stratus
calm haven
#

Yeah, it's VERY cool. They've really done well with C#.

#

I'm just finishing up a major project that has to collect and manage 1000's of measurements a in fractions of a second in C#. It worked out very well. Now, I used all primitive types, so no collections. But that code is FAST.

#

Here's a python question: What's your go-to for popping a string out of list element and losing the [' and '] so get just you, know... your actual data?

misty dirge
pine stratus
noble aurora
#

or regex, or slicing or...

calm haven
#

I know there are many options just wondering what the common, defacto, what most people do for it.

#

Example:
names = ["Johnny", "Rotten"]
print ( names[1] )
I want it to print "Rotten" NOT "['Rotten']"

misty dirge
#

that's what would happen.

#

!e

names = ["Johnny", "Rotten"]
print(names[1])
worldly dewBOT
#

@misty dirge :white_check_mark: Your 3.11 eval job has completed with return code 0.

Rotten
calm haven
#

Maybe I typed that wrong.

misty dirge
#

did you mean to write names[1:]?

calm haven
#

Bad example, sorry.

#

I'm reading 10 lines from a file into a list. When I set a variable (buffer = "") and type buffer = fileLines[3] it returns the contents of fileLines[3] with the brackets and single quote.

#

So there are few ways to pull it without those, I was trying to get a sense for the "common Python" way most would do for that.

misty dirge
#

then we're only talking about strings here that happen to look like python lists. not python lists.

#

if you have strings that look like "['Rotten']", and you know with certainty that every such string will have a [' at the front and a '] in the back, you can do the_string[2:-2] to slice them off.

calm haven
#

So that's the kind of goto way. Makes sense.

pine stratus
#

Or if you prefer: ```py

s = "['Rotten']"
print(s.lstrip("['").rstrip("']"))
Rotten

calm haven
#

I wish it didn't load in with those in the first place. That would be nice.

#

They aren't in the file. Python adds them.

misty dirge
noble aurora
#

well you need the other way also, ]

misty dirge
pine stratus
#

Strip alone would only work for symmetric surroundings.

noble aurora
#

idts. it can take differing amounts from each side. i don't think they're equivalent, but i can't think of a counterexample

pine stratus
misty dirge
#
In [1]: "['hello']".strip("[']")
Out[1]: 'hello'

In [2]: "['hello']]".strip("[']")
Out[2]: 'hello'
calm haven
#

Well, some settings I'm reading in actually do have the brackets and I need to keep them because they're meaningful. But when I load in string from a file into a list, every element on the list is padded with "['" and "']".

misty dirge
# pine stratus Oh, nice.

I think the semantics of strip aren't very obvious. which I suppose is part of why removeprefix and removesuffix were added.

calm haven
#

The [2:-2] takes care of it. The replace could get me into trouble.

noble aurora
calm haven
#

Yeah, let me genericize this routine.... brb.

#

Can I just pop the code in here?

#

20 lines with space

misty dirge
calm haven
#

I posted a thread there.

#

Sorry I didn't know how to post a link here.

shy cosmos
# calm haven Yes, I've done this one a few times already.

I find your argument fascinating because I have worked on Python code written by someone who thought as you do. Everywhere you looked, he preallocated things: Lists were filled with None and dictionaries initialized with placeholder values nearly every time. It made perfect sense for someone like him who had spent his life working in C. But he was making his life harder. Python's lists are dynamic arrays (as in https://en.wikipedia.org/wiki/Dynamic_array) and can be resized in O(1) amortized time. If you never resize a dynamic array, then it's effectively a fixed-length array (as in C) with some tiny extra overhead at creation time. That's how he used them. He had to run some of his logic twice, once to figure out how large the list would be and again to actually fill the list. After all, you have to do that before you allocate your array! But he could have just relied on Python's extra functionality. His code would have been simpler and easier to write.

calm haven
#

Yeah. That makes sense. The first app I wrote in Python (week before last) used arrays extensively, but they were all fixed size. The data was known ahead of time. Everything worked great and it was only a little painful to figure it all out. I then started in on putting pieces of code together to assemble into larger utilities I need for work. Often the data is NOT known and needs to be dynamic. It seems like I keep hitting road blocks and have to walk around the block to get next door with Python to get things done in a reasonable way. It's like "Arrays are list, and they're TOTALLY dynamic!" OK, so I start at it in that way get slapped constantly with with either a "bad load" of the data where the array doesn't turn out like I need it to OR "index out of range" errors. Or like Stelercus pointed out, "faking" a 2D array causes problems with string data that I have to manage with some pretty unmaintainable looking work-around code. This past week has been terribly frustrating with Python for me.

#

So I guess at this point it is starting to feel like Python is something you could have a some fun with, but not something I feel good about putting into production releases.

shy cosmos
#

Good Python style is often quite different from good C style. So, for example, in idiomatic Python it's very hard to get list index out-of-range errors. You generally use constructions like for x in l or, if you need the index (e.g., for mutating the list), for i, x in enumerate(l). But if you're coming for another language, you have to learn idioms like that. My early Python code used for i in range(len(l)), which made sense to me since I was coming from C, but it's not as nice a pattern.

#

If there's a specific thing you find difficult to do, you could post it and see what others think. There may be an easier way to do it.

calm haven
#

But it's not ALL bad. I don't mean to sound like I'm dumping on Python. Things I loved so far: The TK implementation was GREAT. The built-in SQLite, totally awesome! The ease and speed of getting a concept up and running has been mostly good.

#

"for i in range(len(l))," I've written TONS of these. That might be part of my problem here.

misty dirge
#

Are you saying that those strings that were formatted like lists were supposed to be nested lists?

misty dirge
shy cosmos
calm haven
#

I'm saying that I just needed a simple 2D array to work with.

shy cosmos
#

Can you post a snippet?

misty dirge
#

There are no 2d arrays. As I have said repeatedly, lists are not arrays. There are nested lists.

calm haven
shy cosmos
#

Actually, one thing that you might find helpful to realize is: Everything in Python is a pointer. Under the hood, in the CPython implementation, every Python object has C type PyObject *.

calm haven
#

@misty dirge You were very helpful, thanks again for your time earlier.

pine stratus
long narwhal
#

If you actually want 2D arrays, check out numpy arrays, i.e.

import numpy as np
buffer_array = np.empty((10,2))
pine stratus
#

Making an array of pointers to arrays in C is terribly inefficient and more error prone due to having to handle more allocation / deallocation.

calm haven
#

Oh, I wouldn't load up a bunch of actual pointers in an array.

misty dirge
pine stratus
calm haven
#

I often have to make widely varied software and interfaces work together, so I build small tables in memory to map out the flow of data and functions rapidly. Stuff like that.

shy cosmos
#

What do you use these tables for?

calm haven
#

For instance, determine things about the filtering/conversion/etc to apply to inbound data and which other function, API or external file/program to route it to.

#

I have MULTUPLE connected pieces of hardware and their associated APIs and interfaces to contend with. Plus a STACK of legacy code with some pretty screwed up file formats to IO with.

shy cosmos
#

It sounds to me like you're treating the inputs more-or-less as strings of bytes, and you need these tables to track how each input should be processed.

#

A more Pythonic way to handle that would be to wrap the file handle (or network socket, etc.) in some kind of object that understands how to process data from that type of input.

calm haven
shy cosmos
#

Depending on how the input is structured, it might be a simple generator function, or a complicated generator function, or some kind of class instance.

calm haven
#

My hands get tied often from dealing with legacy code NOBODY wants to touch. "Like, I don't know what shit does, but it works and I'M not gonna be the one to change that!" LOL

shy cosmos
#

Yeah, I feel you. Better not to touch it.

#

But you can wrap it in something that works better.

calm haven
#

Plus our equipment runs is thousands of locations all over the globe, so that adds some limits and caution to what we do as well.

calm haven
shy cosmos
#

My basic principle when working with untrusted input is to establish sanity first. You turn the input into something you believe in, usually something structured which has been sanity checked somehow. At that point you have a much easier job.

#

In Python that amounts to having some kind of function or class instance that parses the data and returns something nicer than raw bytes or a raw string.

calm haven
#

It usually more of a filtering, conversion and routing concern. Validation is usually built into things upstream of a lot of the code I sling.

misty dirge
shy cosmos
#

True, we've gotten pretty far from pedagogy now.

calm haven
#

What is pedagogy? What does that mean?

#

Is pedigree that base word?

shy cosmos
#

How to teach.

misty dirge
calm haven
#

OH.... yeah, we're WAY off! LOL

misty dirge
slim anvil
#

pedagogy??

misty dirge
weak mortar
#

hi

grand apex
#

hello...what is th best site to study for microsoft intrnational python certificate for college students ...who knows

misty dirge
grand apex
#

oh sorry..thanks

fallow terrace
#

Hello. I read a post a while ago, and I'm curious what y'all think of it: https://viralinstruction.com/posts/defense/ (particularly, the pedagogical discussion about how to teach classes. the rest isn't particularly relevant to the discussion here.)

Notably, the post somewhat advocates for the idea:

Show locked doors before you show a key
In other words, it suggests that, when teaching classes, we should wait until learners see the point, by having seen a program grow out of control in ways that classes can help with. In doing so, they can really understand that yes, they may unlock some previously impossible behaviors, but mostly, they're a way to do the same things you can do already—just far more elegantly, and with language support.

This idea resonated somewhat with me, because when I was introduced to classes, I never really got the point. Dogs and cats, cars and vehicles, whatever it may be, it didn't seem particularly useful. It was only when I got to a point where I was actually modeling many of these complex structures that I really saw the importance, and started using them in meaningful ways.

And I suppose this is a more general concept, as well. In my Java CS class at school, the teacher didn't introduce arrays until pretty late into the course, although they're a fairly integral part of programming. Up until then, students were forced to use variables named x1, x2, x3, or something to a similar effect. Thus, when they were introduced, it was really easy to see why they were used; you could do the same things that you'd been doing by hand (granted, you can do some more as well), but with language features that made it very convenient and usable.

So overall, I'm just curious what you all think of that style of teaching. On the one hand, you have what i described above, but on the other, everyone moves at different paces, and sometimes it's useful to just jump right in and learn all of the basics. Thoughts?

native hearth
#

I think its also important, perhaps even more so, to show where classes shouldnt be used
I dont have code examples on hand but we've all seen pointless class filled code that reads more like java than it does python
Classes arent the end game of python programming, showing bad examples and also refactoring/deconstructing them to use dicts/tuples/whatever collection and functions was more helpful to me at least when I was in uni

#

Could have sworn that theres a Hettinger talk on this but i cant find it, might be mixing it up with another talk

misty dirge
#

@fallow terrace I think contrived OOP examples ("Cat and Dog inherit from Animal") stem from courses that are oriented towards teaching languages (especially when that language is Java) rather than programming.

#

I was the TA for an NLP course where all the assignments had to be in Python, but none of the prerequisites taught Python. But all the assignments could be completed using only functions, lists, and dicts.

native hearth
#

In my msc we had a class to introduce python to non cs peeps, it didnt cover classes or OOP stuff because the end exam and all the python needed for subsequent modules were feasible with top level functions and the builtin collections as well, it was fun

fallow terrace
#

but anyway, my point really wasn't the classes, although i know i and the article focused on them. it was more the general philosophy, where you introduce language features as they become needed, rather than all beforehand.

#

otoh, that's really hard for self-learners. in a classroom environment, you have a teacher who you can always talk to and who knows what you know.

#

when outside of such environments, you have to figure out how to pace your own learning, which is difficult

native hearth
#

In general, introducing something only when its necessary is good practice but imho its just one half of it
Right after showing when something is necessary to solve a problem you should show when the same thing is unnecessary/undesirable for x problem, it rounds off the learning experience

#

I can imagine java students, after learning to use arrays to avoid v1, v2, ... to go off the other end and always use arrays even though you might only need the one or two variables

loud ridge
misty dirge
#

Just use pip and venv.

golden stump
sharp sparrow
#

If it’s “introduction to programming”, causing the very least setup they need to do before typing in their first program is important. If it’s “Python for someone who knows at least one other programming language”, starting with a bit of tooling hassle that makes experimentation easier my be worth it.

noble aurora
golden stump
noble aurora
# golden stump Not quite sure I follow your point.

the idea is that sometimes if you just present solutions, the motivation for the solution isn't quite clear. but if you present the problem before the solution, then it becomes simple to explain why the solution is necessary

golden stump
#

Sometimes, sure

#

But not always. There are times when you just need to learn a heap of fundamentals.

noble aurora
#

motivating why you might want to have numeric data types or store a string seems odd, but you probably could still do it

golden stump
#

You could, but it's fundamentally flawed.

noble aurora
golden stump
#

Well, you don't spend time justifying why you're teaching everything you teach.

golden stump
#

No one tells a toddler why you learn the colors, or why you learn to walk, or why you learn to count or why you learn the alphabet.

#

These are fundamental tools

#

You learn the fundamentals as a knowledge toolset and then you learn how to apply it.

noble aurora
golden stump
#

Yes it is.

noble aurora
#

why?

#

your reasoning thus far is just "you don't do it"

golden stump
#

Have you tried to have a discussion with a small child about why they should learn different colors?

noble aurora
#

that's a non-sequitur. we're talking about people learning programming. while they could be small children, they're probably more developed than learning about colors

golden stump
#

we're talking about pedagogy

noble aurora
#

it could be as simple as 1 sentence. "we also want to store text data; we can't do it with an int, so we have a type called str". though i did cheat with a semicolon

noble aurora
golden stump
#

right - ok so do you get into what an int is, and what memory is and the size of allocating memory before explaining the different data types?

noble aurora
golden stump
#

exactly - it's not necessary

#

it's not necessary to say why you need to store numeric data.

but you were maintaining you should explain the WHY first.

noble aurora
#

but that's not what dawn was suggesting. the proposal wasn't to explain all the low level fundamentals, but just to explain the motivation for why you might do something

golden stump
#

the motivation for doing something is the WHY

noble aurora
# golden stump the motivation for doing something is the WHY

no, i didn't say

it's not necessary to say why you need to store numeric data.
i was saying that i would not
get into what an int is, and what memory is and the size of allocating memory before explaining the different data types?
i would explain the motivation, even if it's just a single sentence

golden stump
#

You did say that it's not necessary to say why you need to store numeric data.

noble aurora
#

ah. i see why you were confused. i said

that's not necessary to say why you need to store numeric data
but "that" here is referring to the previous sentence in that message, which is that it isn't necessary to explain the low level details

golden stump
#

Honestly, this feels like riddles. I'm not really here to argue. I just think some knowledge is pre-requisite and needs to be explained without the "why".

noble aurora
#

but you still haven't explained why you think it's "fundamentally wrong"

golden stump
#

Because you can spend half your time going into depth in a topic when it provides no additional benefit for the learner.

noble aurora
#

that's an issue with how you implement it, not with the process itself. you can point out many similar failures in any method of teaching

#

but you wouldn't explain low level memory details to someone that doesn't know what an int is. you would simply say "we want to store numbers, so we have int"

golden stump
#

i wouldn't even do that personally

#

but everyone has their own approaches

noble aurora
#

sure. i would say it's probably a waste of time in many cases. but that doesn't make it "fundamentally flawed"

golden stump
#

fundamentally flawed

noble aurora
#

sure. other than just saying something along the lines of "you wouldn't do it", you haven't presented any reasoning

golden stump
#

yes i have

noble aurora
#

Because you can spend half your time going into depth in a topic when it provides no additional benefit for the learner.
this? this could be equally applied even if you didn't give motivation beforehand. it's not specific to this method. it's a symptom of a bad teacher, not a bad process

golden stump
#

it doesn't need to be specific... it's fundamental

#

When you're teaching a complex topic, you have to start with some things that the student already knows, and hook off those.

You can't keep creating more and more hooks and trying to link them all together at the start.

If you do that then you get issues with overloading students.

#

In short, "cognitive load theory"

#

It's quite simplistic to say, after the fact, that in retrospect things would have been easier to understand if this, and that, and the other had been mentioned, but that's forgetting that you only understand the link because you've actually joined all this stuff up in your head yourself after consolidation of the previous learning.

#

It isn't a symptom of a bad teacher if they fail to give you reasons to learn.

It's a symptom of a bad teacher if they don't understand how learning works and then use that knowledge to help you learn.

#

@noble aurora What topics do you teach?

noble aurora
#

wdym

golden stump
#

Which topics / courses / units are you a teacher of?

noble aurora
#

python

noble aurora
golden stump
#

Reducing cognitive load is critical.

The more you waffle about "why", the more you increase cognitive load.

noble aurora
#

but the original problem is that for some complex topics, the "why" is not immediately evident. if you're going to fix that problem, you're going to have to present the "why" one way or another

golden stump
#

or just don't bother

#

be assured there's a reason for it

#

this is like the typical argument a student makes for not learning stuff

#

why do we learn scales in music? Kind of hard to say until you're good at them!

#

why are you so worried about presenting the why?

noble aurora
#

because it solves the problem of being confused about why you're learning something

golden stump
#

i give up

noble aurora
#

didn't you just say that was an issue?

native hearth
#

Why wouldnt you explain the reasons for teaching something fundamental? Sounds silly

native hearth
#

Why should I learn them

#

"because I said so" isnt valid, youre not dealing with toddlers

golden stump
golden stump
native hearth
#

Contextualizing a concept increases cognitive load? Says who?

noble aurora
#

any thinking increases cognitive load

golden stump
#

Says a plethora of research on teaching and learning.

native hearth
#

May as well teach and learn nothing then

golden stump
#

you honestly think it's better to teach and learn nothing rather than teach and learn in a sensible way?

native hearth
#

Teaching a concept in a vacuum sounds much harder than explaining where it fits in programming, where you'd use it, what problems it solves, etc before getting into the nitty gritty, dont you?

noble aurora
golden stump
noble aurora
#

you said:

be assured there's a reason for it

golden stump
#

that's very simplistic

#

I feel like you're arguing for the sake of arguing rather than discussing sound pedagogical approaches.

#

And just because things "sound like" common sense, doesn't mean they are.

noble aurora
#

not to argue for the sake of arguing, but, isn't "sound like common sense" the definition of common sense

golden stump
#

Just because a thing seems like common sense doesn't mean it's actually correct

noble aurora
# golden stump that's very simplistic

can you give an example of what you might do in that situation, then? if you don't explain why you might want to learn something, and someone asks why they should learn it

native hearth
#

Smh theres an echo in here

golden stump
#

I already have, but no one actually listens

#

What's your experience of teaching? How many years and at what level?

native hearth
#

Its only polite to mention your experience and education before demanding someone else's

#

Not that any of this is relevant

#

We might not be teachers but we sure were students and my most hated teachers were the ones who couldnt tell me why im learning X or Y

golden stump
#

Well it is, because we're talking pedagogical practice and I'm happy to discuss things, but people are saying "I reckon this, and I reckon that", but none of it matches what teachers are trained to do.

native hearth
#

Are you a teacher?

golden stump
#

Yes

noble aurora
#

what is a teacher trained to do when a student asks why they are learning something?

native hearth
#

And your response to why should a student learn a concept is? Because you said so?

golden stump
noble aurora
native hearth
#

Im trying to guess at your thoughts because you wont express them lmao

golden stump
#

I will but you won't actually read them - you just jump to your own.

#

You just like to pretend to know.

noble aurora
#

i can only find that you said:

be assured there's a reason for it

native hearth
#

Why are you doing this lol, you havent explained, youre just avoiding the questions

golden stump
native hearth
#

You have an example from this channel on python classes

noble aurora
golden stump
#

But ordinarily, you don't let the student lead the learning.

native hearth
#

The student is hardly leading, theyre asking why youre teaching what youre teaching, very reasonable

golden stump
#

Right, so back to the issue. Cognitive load.

#

You can hold only a certain amount in your head at a time.

native hearth
#

How does cognitive load factor into this, you have to teach classes at some point in python, the question is do you explain them in a vacuum without contextualizing them or do you show where they are useful, what problem they solve?

noble aurora
native hearth
#

Is that a fact?

golden stump
#

So the aim in a learning episode is to get across a specific set of knowledge. And the more you overload students with extraneous information, the less likely they will understand it.

native hearth
#

Examples of their use and what problem they solve is extraneous information? In what world!

golden stump
#

In this world.

native hearth
#

Are you being serious right now

golden stump
#

Yes.

#

It's not that it's wrong in all circumstances, but it can make it harder for students to learn if they have too many things in short term memory.

#

So you focus on some specific pieces of knowledge that you then need to work to move from short term to long term memory.

#

Context could sometimes be valid knowledge, but it often is a massive distraction.

#

It's one of those education myths that giving context to everything helps.

#

You can typically hold about 4 to 7 ideas in your head in short term memory. So you have to be sure that the thing you want to cover in half an hour isn't shoved out by some stuff which doesn't actually help.

#

One of the reasons that tools like DuoLingo work is because they give you 4 to 7 pieces of info at a time and then they focus on getting those into long term memory.

#

What they don't do is spend time trying to explain the context first. The context comes later.

native hearth
#

Duolingo isnt exactly an example of successful education lol

golden stump
#

Based on what measure?

native hearth
#

Besides, the context mentioned in the original article doesnt come from "short term memories", whatever that means

golden stump
#

(and even if it isn't, how does that change the argument?)

golden stump
#

All learning starts off in short term memory. If I tell you a load of facts now, you're going to forget a chunk in an hour, and a bigger chunk in a day

#

See Ebbinghaus

native hearth
#

The concepts built upon arent random lists of facts passed to students

#

Theyre concepts themselves that are reviewed and practiced

golden stump
#

I know

#

Well, knowledge, yes.

#

It's not about them being random, it's about the fact you forget stuff. You just do. Having a solid framework to build things on DOES help. But putting extraneous context can seriously muddy the problem.

#

The musical scales thing is a case in point. Do most students have a clear understanding of why they're learning them?

native hearth
#

The context here is already learned concepts tho, why is that extraneous, its stuff they already should be familiar with

golden stump
#

I think they probably have an idea that it's to do with dexterity or even finger aim, which has some truth. But the link between that and a harmonic understanding of music? Probably not until they've progressed quite a lot further.

#

No it isn't, the context is concepts that are abstract that aren't already understood.

#

So, I have explained my angle on it.

#

Please go ahead and explain yours.