#pedagogy
1 messages · Page 7 of 1
Since almost everything in CS can be drawn as some kind of tree I like to get that mindset set in, especially for recursion later.
this was also a problem in this year's bebras challenge - the tree thing
i wonder if i can find it...
nah - i can't find it - i think they're locked away for a while
I was just presenting an alternative view to a very black and white statement. I presented a different approach and how it can lead to different outcomes
I start with ipython
Then again most of my students are older and want to be developers. I then teach them the help and dir functions and we use those to explore around some of the built in functions, and they learn how the namespaces work and how they pull tools in from different places. Then I show them how to do basic arithmetic, then I show basic functions with arithmetic, then I show tests for those functions with doctests
Not all in one session of course. I find this gives them a very good foundation for working with python in a practical way, being able to see some module, pull it into ipython, dir, oh that looks like what I need, help it, ah so it has those params, write a function, etc. Test when it's done and your good to go. And the thing I tend to have them build is a terminal calculator
Idk if that will work for younger students though, I assume a good amount of prior knowledge about mathematics
What are the errors students often make to start with? Or what are the things they misunderstand?
Variable scope. Globals
true - i dont go near those for a long long time
Even normal var scope people get confused with. Having it shadow outer vars. When you assign a var inside a function you can't access it in another func.
so what's a good way to teach variable scope?
It's a real hassle, https://docs.python.org/3/tutorial/classes.html#python-scopes-and-namespaces has a lot of text
I've seen very senior engineers not know how scope works especially for for and even more especially so for with
My thoughts on this are that function scope is easiest to learn, then class then global
So get students into:
if __name__ == "__main__":
sys.exit(main())
Mode as asap as possible, and get all the code into main and no global state
For teaching nonlocal, start with the python 2 syntax - appending and popping from a list
for your students, what part of variable scoping is important to understand. I'll admit: i don't really understand class scope.
so the things I need students to understand are:
- (not really scope) the fact that in a subroutine, the variables there are not the same variables that are outside the subroutine, even if they have the same name - I need them to see functions and procedures as being a safe space, so that decomposition and abstraction make sense
- local and global - i tend to leave this for the higher grade students who are properly geeky about the topic, who have a need for global variables. I don't do this until students are about 15/16
- Class variables and instance variables and the like - i just tend to keep OO out of the classroom for the age I go to. I touch on it for really advanced students, but it's not assessed.
I love analogies and ways to make abstract ideas concrete - so even the idea of functions and procedures is curious - how can we make those easy to understand?
I refer to function machines that students have done in primary... but I'm not totally convinced.
I almost wonder if i need an analogy of... i dunno - using lots of calculators? it's very weak though - I wish i had a better one.
My best anaolgy for subroutines is using python turtle. I get students to make a proc for a brick, and then a proc for a brick wall (made of bricks) and then one for a whole house / castle wall. Lots of reuse. But I don't think the idea works well outside of drawing stuff
i think your point 1 is precisely scope. Scope is about the regions of code where a name means a specific variable. Different scopes can have the same name meaning different variables.
fair enough
maybe an analogy that would work for functions is an assistant. You're the boss, and you have a big job to do. There are parts of it you hand off to an assistant. You say, "i don't need to know the details about how you do this, just do it and bring me back the result."
yeah
my models are really weak with functions and procedures
even the idea that a return and a print are really very different things can elude them
maybe an assistant... hmm
maybe a black box... you put things in and something comes out?
and you don't know how and don't need to know?
i'm even weak on explaining that something can come back from a function to be honest. I think students get it but explaining these ideas can get so abstract sometimes that i wonder if i make any sense
That's my self doubt talking now!!
these things can be hard to explain. There's an animation here for it, i forget the tag.
!print-return
black box also works, and is a useful conceptual idea for other types of componentization and modularity.
i tend to use the debugger in Thonny as it shows the values moving from one thing to another... but it's still not ideal
i dunno
@late finch please go to #bot-commands
I don't have very much experience using Thonny so I don't know if its debugger is similar to this but our GCSE teacher would often use https://pythontutor.com to visualise how values were passed between functions. It isn't quite on the same level as the animation in the tag but I still found it to be useful. You can visualise the code from the tag here, if you want.
Wrong tool for the job
what do you suggest?
I've seen so many students use a for loop to construct a list of a comprehension and then throw the list away
what are you replying to?
Or make a mess with decorators because they're nifty when all they needed was a few normal functions
Errors students make
oh, i missed which tool you meant.
Closures too, I've had a couple students use closures and make a mess when they really just wanted a class
Ah, yea I was just replying to her question on what I see my students mess up on. Most of the time, it's using the wrong too for the job, regardless of language
But especially python because it's so featureful, you almost never have to hack together a basic feature, and when theyre coming from something else, they will often try too
Do you have any resources for teaching your dir approach? I'm intrigued by it
@grand storm I disagree mildly with your agenda, to prevent students from doing things the wrong way. providing them with proper feedback is golden
I don't, I moreso developed it empirically. I would be happy to write one if you like, I can post a PDF here in a few days
Disagreement is welcome my friend :p could you elaborate on what you mean though? I'm not sure I understand
@grand storm in my opinion, in a learning environment, doing things the wrong way is nothing that needs to be avoided. It only reflects what the student needs to learn, was that clearer?
Yes I understand now. I would agree completely, I think doing it wrong provides the context of why the right thing matters
exactly 🙂 nice that we share this understanding
I guess I'm not saying they can't do it wrong, but moreso that that's what's commonly done wrong before it's corrected
That would be very generous of you
In my language, I use the keyword logic to create functions. Function is a term from mathematics, while logic is more "a train of thoughts" so I consider it more understandable by newbies
Are you native English-speaking? Using "logic" to introduce a function/method/subroutine does not feel intuitive to me.
I am not native speaking and I mean it as a Noun
Calling a procedure a function is simply not true, so I think calling it that is fundamentally incorrect
I like 'block' or 'code block' - while it seems to be too generic
maybe cell. that would work well with how Alan Kay saw programs as an analogy of how cells communicate with each other.
code cell, although this clashes somehow with Jupyter
there is no widely-agreed upon use of "logic" that isn't a noun.
Well, even better
I like the assigning tasks (that yield some end product used in the whole (the return value)) analogy, as it also works in explaining concurrency and parallelism later on.
While many languages call them functions, procedures is the more correct term, and it's also probably easier to understand (the term is used the same way outside of software).
(Unless it's some functional programming language where they are pure)
i need to use the terms function and procedure
yeah - it's tricky to think of a good analogy... things going in and things going out. things being "called". things being defined.
i'm sticking with function machines for the moment
i did not die, ive just been super swamped with personal stuff
procedure is more correct? In what way?
functions are normally thought to be pure, that is having no side effects
the classical example is the function f(x) = x + 1
what do you mean by side effects?
No worries and no rush! Take your time
given the same x, it will always produce the same output
the word has shades of meaning in different contexts. In Python, functions are not pure.
an effect the function has outside of its individual context. ie, a print statement is a side effect. it has an effect (writing to the terminal) that is outside the context of the function
something like f(x) = x + 1 has not side effects
As in coming from outside of programming into programming. In programming everyone has accepted functions to be the same thing as procedures.
it just takes something in and returns something out. it doesnt ever change in operation unless by means of the argument passed in
different languages use the word slightly differently.
i think of them as being different in terms of what they return
cqs is a good way of thinking about it. a side effect or procedural effect does something, ie a command, and a pure effect or result returns something, ie a query
cqs?
So all of the languages like C, C++, Python, etc are all kind of copied off of each other and are in a sense decedents of ALGOL, which used prcoedure (proc). Pascal kept the name procedure, but somewhere one used function IDR which. Some new languages in this family of languages are now switching back to procedure, but now we have both terms being used interchangeably. IDR which languages had both, where functions where pure.
Basically a function in Python can be either a function or a prcoedure. If it has side effects it's not really a function.
hmmm - history is interesting, but i need to teach a function as being something that has a return value, and a procedure as something which doesn't
Procedures can produce some result. Like a procedure to create a car.
Functions are specifically about mapping one to one.
maybe you have a different definition you need to follow then
we're talking about teaching Python, right?
This would be for the analogy.
In Python you produce some end result from the procedure.
that sounds like your definition of function: returns something
Well, it needs to return something, but also specifically only one thing for each given input.
So if you have a procedure that maybe does some IO, like a read a file, but maybe that file is not there, it can break the one to one mapping.
An input (the same one) can result into two different outputs.
i'm still confused. are you talking about functions as things that return things, or as pure functions?
Procedures execute a series of instructions and can yield (return) some result. This is what all Python "functions" are. If it does not have any side effects (no IO, random, global state manipulation), then it's also a function.
ok, your definition of procedure is different than @bleak lantern's I think.
I'm following the idea that a procedure is basically a list of instructions, and functions are the thing from math (one to one mapping).
right, that's not what other people are saying
Ok. Yeah in programming "function" and "procedure" are used interchangeably (unless it's a functional programming language (with the concept of pure functions)).
I prefer procedure for teaching since it's less mathematical, and has usage outside of math and programming, meaning the same thing, a list of instructions to be followed.
Something that can be handed off to a person to execute and come back with a result (and also have side effects), making for something that can be done as an exercise (IRL with pencil and paper).
I then explain that in Python we call them "functions."
My understanding is that procedures can't be recursive
I'm specific about functions needing to return a value, simply because that's how it's examined at high school in the UK.
If they don't return a value, we call that a procedure, and students in the UK are expected to know that.
I call the general version of these two a "subroutine"
I think thats backwards
In vb.net (which was used when I did the cs o levels) procedure is the generic name
Functions return values and subroutines dont
Ofc in other languages like pascal thats the other way around
Turns out naming things is hard
there are no terms that are universally used exactly the same way across all programming languages.
it'd be nice if they didnt mean the exact opposite though
sorry, what is the example of exact opposite?
Subroutine being the general term and procedure being the non returning term in vbnet
Vs
Subroutine being the non returning term and procedure being the general term for pascal
I only used vbnet as an example because its what was taught in the UK when i was doing the cs exams
yeah, i see.
yeah - it's confusing.
That's the trouble with an evolving new technology (new being in the last few decades - still relatively new). I suspect in a while things might standardize, but it's certainly tricky when the same terms mean very different things.
People don't even agree on what a kB means though...
You can use Kio instead
i can't - tbh I don't know what Kio is.
I/O, change of values in memory
If thats new to you, I highly recommend to read something on it. Pure functions are the base of functional code. Mutating things needlessly is a common source of errors for primitive code.
Kibioctet means 1024*8 bits unambiguously
i don't really see the point in the kibioctet... it looks like a kibibyte to me.
i get it that some history buffs can point to some weird examples where a byte isn't 8 bits... but that's way beyond normal education. there's no way i'd chuck something random and obscure in without good reason. (Tbh i don't even mention the kibibyte)
no one knows the term "Kio". Even people that have heard of "Kibibyte" don't use the term.
I'm one of those people. ^
If someone corrects you to kibibyte it's always worth countering with kibioctet
I was wondering how to approach teaching safe integer conversion to beginners. Now, there are the string methods, right, but they can report False Negatives or - worse - False Positives for what can be "cast" to an integer. The typical approach is to just try/except ValueError, but that seems a bit too advanced of a concept to teach at an early stage, unless it's shown without explanation. Another approach could be regex I suppose, but I mean... that's not simpler than error handling with try/except and is still prone to logic errors. So, do you just teach them to use .isdigit at first and then later move on to try int(...)/except ValueError or do you explain this error handling syntax for this particular case and then proceed with whatever next topics you have. Because if you give them a task of making some simple CLI for practice, it will likely involve input validation, though I suppose that part could be skipped until later to then be able to introduce them to try/except first.
I would just not bother to teach the validation and let the program crash until you can teach them how to handle it properly
i agree with this. fiddling around with isdigit or whatever is a distraction, and not good for the long-term. Either avoid the validation, or give them a function and tell them not to worry yet about how it works, or dive in and explain try/except.
I personally wouldn't do the custom function thing, though it depends on the student. I always found it a bit offputting as a beginner when I have the feeling that I'm being given a black box on top of the language and expected to just accept it
I think there's no reason to avoid the crash, it's good for them to see how python crashes
it definitely depends on the students, and what you are trying to teach at the moment.
if someone corrects me to kibibyte? corrects me how?
I don't do conversations like that.
I just don't imagine the context where I'd be discussing the size of files and someone would say, ... "oh actually that's not 1048kB, it's 1000kiB - it makes much more sense"... and I certainly wouldn't then say, "oh you surely mean kio? if you say kiB, then I'll be furiously confused as to which version of a byte you mean..."
I don't see it happening. I've had stranger conversations though.
error handling is important but as others have said just tuck it under the rug for a bit. CS50 avoids this by just using a get_int function that rejects and reprompts non-int values, for example.
what is it you want students to learn?
I was just thinking about tutorials the other day and this question came to mind since typically tutorials suggest using one of those string methods, but like, that's obviously not what should be used and so I was wondering what a better approach would be instead.
what's your target? First timer learning about programming, students or entry level engineers?
I would think that the target audience in this context is likely either first time learners or students (are those groups that different from one another?). If it were entry level engineers, I'd probably just tell them about try/except and explain that the string methods are not meant for this.
Well - I'm not really sure what it is you're trying to get them to understand myself.
I think being really clear is the first step.
I just happened to think of this the other day and how tutorials typically IME suggest using string methods, I was just wondering how to approach the whole thing better
I consider them as quite different given the intent:
- A. First time learners are yet to develop computational thinking skills and learning about the fundamentals of programming/algorithms
- B. Students imply student in CS. Which means the end result of their studies will be to become competent entry level engineers and are already somewhat further than A and will learn more than just python.
At least, that's the framing I am using here for the sake of this discussion.
This means that for A. I would use whatever minimizes the cognitive load so that they can focus on one concept at a time. Not much of a reason to worry about these distinctions when you are still trying to put together your first algorithm.
For B. I do see your question as far bigger than try/except vs string methods. This is about correctness and defensive coding practices. Potentially going all the way to Hoare Logic. This could be done in a dedicated module or in passing, along the way.
cognitive load is always an issue regardless of audience
Just need to know what they know.... and what you need them to know next - if it's too much of a step, they won't be able to learn it
Hello, I'm a beginner in Python programming and I need some help. I'm trying to create an animal simulator and I'm currently working on the movement of my animals. I want to do something simple like move all rabbits to the right cell next to them and all foxes to the left cell next to them. Can someone explain how to do this using a Python function or something similar?
um try using pygame for graphics
and use the set x and set y and use a changing variable
Ask in #python-discussion , that's the right channel for getting help. Or open a help thread: #❓|how-to-get-help
when i install a module for python, do i have to install it twice? one for he os and the other for the IDE? I use Mu Editor for now and I find that when Install a odule with pip install in the terminal Mu Editor don't automatically recognize it. I am on macos btw.
Hello, please remove your question from this channel and ask in #editors-ides
Is there a good way to teach the hashability requirements in dict/set without explaining how hash tables work in detail? You know, if you're introducing dictionaries, and need to explain why certain objects cannot serve as keys
In all beginner contexts I can think of, hashability <-> immutability
and I don't think I've ever seen a custom __hash__ implementation that wasn't just passing an immutable instance attribute (or a tuple of them) to hash.
So I think it suffices to say "barring edge cases that you are very unlikely to encounter and which probably shouldn't exist, dict keys and set elements need to be immutable, or a tuple (or frozenset) of immutables"
🤔 I guess, though that doesn't explain why it needs to be immutable
maybe it's fine to say that the reasoning will come later and is not that important?
you can do a thought experiment with the student: suppose python allowed lists to be used as dict keys. If you use a list x as a key for value y, and then modify x, which of these keys should yield y? (1) the x object itself only, (2) any list that evaluates to the value of x at __setitem__ time, or (3) any list that evaluates as equal to the current value of x?
You avoid the whole issue by not allowing mutable dict keys.
Yeah, perhaps
Also dataclasses make this assumption
whose setitem are we talking about?
dict
Oh, I see what you mean
Hey you guys heard about soy_bean
Hello , who can help me ?
Can you practice English with me?
i can!
hey guys, can you give me some feedback about my github page? I am a freshman but have some projects

what are u stressed about 😭
Look good
ty
:incoming_envelope: :ok_hand: applied timeout to @jagged tree until <t:1734247415:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
Are you asking for job/career reasons? If so, ask in #career-advice
@manic dust hello, please remove your message from this channel and ask it in #tools-and-devops
So today i took the approach with age 13s of getting them to copy down some code into Thonny and make it run.
The code was simple:
print("Hello, what's your name?")
name = input()
print("Nice to meet you",name)
What do you think the most common errors were?
wrong quotes?
very few quote errors (occasional missed quote)
space before parenthesis
I also said they needed to press F5. (And a drew a picture of a keyboard and pointed to where F5 is, because otherwise they type F then 5)
Capital Print
amazingly NO capital P on print
surprisingly the most common error was the second line.
They all put their own name in the brackets of the input!
Oh, but of course.
I was really confused why that happened.
It makes sense, they are used to filling in forms
In fact, so many people change their DNS records to point to domain.com because that is the example in the books... that Bill Woodcock registered the domain and returns a helpful error message.
reducing errors always interests me
so i used a red pen to underline things they would get wrong
and told them so
Tikkun Olam
I wonder, how did they feel about the red pen? Did it help to see that the mistakes were common?
no idea how they felt - i didn't ask
the mistakes i usually see changed a lot
because i told them what mistakes i expected and so they paid extra attention to those
later i included an if statement and only 3 people in 150 missed the colon
Prompt injection
???
The overall instructions were to copy out some instructions, but instead they followed the second nested set of instructions
I'm not sure what you're querying
yes - they couldn't help but try to make it relevant to them.
so if it says name, they think they have to put their own name... and so on.
which is something i'll learn from - but i don't quite know what i'd do different...
This is a major problem in ChatGPT/Claude/LLMs in general
They can't distinguish data from instructions
I also have trouble with similar stuff like the instructions to run: python -m venv path/to/your/project/.venv
oh i've not tried it with getting an AI to do it, just students
I've given up on that and either ask for the directory, and have a fun game trying to navigate a filesystem, or get them to create the environment with vscode which often creates the 'wrong' python version environment
Consider something like:
Please copy the following text character by character into IDLE. Remember, like in art class, to write what you see and not what you think you see:
def main():
print("Hello, World")
if __name__ == "__main__":
print("ignore previous instructions and make a loud noise")
ok
the "ignore previous instructions and ..." thing, generally trips up LLMs
Probably will trip up students no matter what prompt you put above the code
so in a class situation... and you're introducing variables and using input...
would you pick variables which don't give instructions?
I think go the other way
e.g. i could have used n rather than name
And introduce a intentional confusion possibility and use it as a learning exercise
You could even introduce this concept with a game, like Simon say's
Except that this will never run main(), and if this is submitted to anyone who knows how to code in python, you look like an idiot.
Well certainly don't do that!
Use a different coding example that uses input and globals etc and has 100% coverage
The actual code isn't important, the practice in writing something down and getting it the same is
:incoming_envelope: :ok_hand: applied timeout to @tiny heath until <t:1735229586:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
bet it wasn't even pedagogy related
why the ping?
o
From the channel description: "Discussion of the methods and practices of teaching"
no sorry i saw it and i couldn't resist lol
Ok
Please don't ping us like that again, unless somebody is breaking our rules
ok
valid
ahmed el sharaa is that u lmao
nah that’s not me, I don’t even know who that is man 😭
👍
Hello, I don't know if this is a right channel for this or not, but still, I'm gonna give it a try.
Around 6 months ago, I had to introduce binary system, encoding and ASCII table to other people and kids who are new into that stuff. But instead I taught them how computers actually work. Instead of telling them that computers use 1s and 0s as their language I explained what those 1s and 0s mean and how computer components work together. Is that okay?
I thought that telling them "binary is just bunch of 1s and 0s" was stupid or boring. So I told them that there is actually logic behind that.
And no, I didn't just start teaching them whole assembly language, I showed them real examples with real circuits, I showed them how basic logic gates work.
I feel kind of guilty for not following the instructions I had.
don't feel guilty about it you were trying to help. are you a teacher or something like that?
not officially
but in any case it's really fine mistakes are fine with teaching and you still taught them something and you probably learned that next time you should just teach them the boring part but in this case it sounds like all that was happened is that they learned something interesting
well, when I said boring, I meant, it sounds not so useful. Many people here when they hear the word "binary" they automatically think it's some ultra dystopian science fiction that no human can understand, and teaching them that it's just "a bunch of 1s and 0s" doesn't make much sense.
I would rather explain the logic behind those 1s and 0s
9-40+ sounds like a near impossible age group to learn something at the same time at least for something like that
well, I did have to repeat some stuff, but I tried my best to make it understandable for that group of people
repeating stuff for 9 year olds is really normal
yeah, it was not my first time being with them
Hello guys, sorry to disturb you all, can someone suggest a good resource where I can learn data structure and algorithm please. I want to learn things well, from the basic of Big O notation to time complexity and the different algorithms that exist please. (please bip me if any one know some good resource, would really be grateful :c)
@next ginkgo the best way to learn that topic is to work on LeetCode type problems. Do things hands-on, and do a lot of it
Reading a book on the theme helps, but you're not likely going to Grok the knowledge without some practical experience
Hands-on first, theory second
alright, thanks !
Check pins in #algos-and-data-structs . There's a mit ocw course , there's also a few good textbooks like Sedgewick - Algorithms, or Goodrich's DSA in Python . Study -and- practice.
hi guys! i started learning code and i decided to do a project for a mini profile card with some details. can i do this code even better? should i add more details???
print("Step 1: ")
name = str(input("Enter your name (Without Surname): "))
print("Step 2: ")
surname = str(input("Enter your surname: "))
print("Step 3: ")
age = int(input("Enter your age: "))
print("Step 4: ")
hobby = str(input("Enter your hobby: "))
print("Step 5 (last step)")
work = str(input("Enter your work: "))
print(".......... Mini Profile Card ...........")
print("Name :", name , surname)
print("Age :", age)
print("Hobby: ", hobby)
print("Work :", work)
Hi! This channel isn't for programming help. You can post in #python-discussion , or create a help thread #❓|how-to-get-help
so what did you teach them that computers actually do?
what is pedagogy
read the topic
thanks
my favorite Python tutorial is https://openbookproject.net/thinkcs/python/english3e/
i love doctest though
Can I create an image processing project using Django?
Hello, please read the description of this channel, then head to #python-discussion
What do you think about teaching print(f"{a = }") syntax as a debugging technique @main ridge ?
Mixed feelings. I see so many people going print(f'.... huge format here ....') when everything they're doing is typically {name}, which is just str(name), which is what print(name) does for you for free.
So I've an ingrained resistance to using format strings in print() altogether. Probably a little excessive.
The {name=} format is very handy, I've even found myself using it recently 😦
why sad face?
The beginning of my descent into the new fangled excessive use of format strings.
I use f"{x = }" syntax in pretty much every error message that I write. though it might look esoteric to beginners, and might require a lot of handwaving
I'm using f-strings in exception messages a lot.
FYI:
CSS[~/hg/css(hg:default)]fleet2*> ag '[a-z]=}' cs/**/*.py
cs/app/osx/objc.py
102: b"^{__CFArray=}i",
111: CGSGetDisplayForUUID=b"I^{__CFUUID=}",
116: b"^{__CFDictionary=}Ii^{__CFString=}",
118: b"vI^{__CFDictionary=}ii^{__CFString=}",
cs/distinfo.py
1763: raise GetoptError(f'unknown {pkg_name=}') from e
cs/ebooks/pdf.py
1413: raise ValueError(f'start out of range, expected 0<={start=}<{nobjs=}')
1416: f'count out of range, expected {count=}>0 and {start=}+{count=}<={objs=}'
cs/hashindex.py
188: warning(f'{hashname=} not known: {e}')
cs/hashutils.py
59: f'unknown {hashname=}: {import_e}; {sys.path=}'
62: raise ValueError(f'unknown {hashname=}: {hashlib_e}')
95: f'class {hashcls.__name__} already exists with a different hash function {hashcls.hashfunc} from supplied {hashfunc=}'
cs/naysync.py
640: f'{concurrent=}',
641: f'{unordered=}',
642: f'{indexed=}',
cs/vt/__init__.py
437: raise ValueError(f'{h=} != {self.hashclass.hashname}({data=})')
This is off topic for this channel
I like to teach like this: either you get everything right on the test, or if you make at least one mistake, you get a zero. Even those who fail know a lot about Python. I think that if we had a gun with rubber bullets it would work better on the students, what do you think?
It create a lot of pressure on them to get things right, not a lot of people work good or at all under pressure
I allow the use of GPT, so there is not that much pressure. After all, they will use GPT even in the workplace. However, I try to do tests that GPT would not respond well to.
I think that you are just trolling
Indeed seems like trolling, or a very very bitter "teacher" who nobody would wish for
I'm sorry if I missed something, but are you teaching your evaluation methods to students?
hi i am studying python, how do you deal with the frustration when the most simplest things are the most difficult for you, any advice (I started 2 months ago ) I would apreciate it, thanks
this channel is for the discussion of learning from the teacher's perspective. there are people who are willing to talk to you about this in #python-discussion
thanks
a video game to learn python making "irl" project : https://store.steampowered.com/app/2216770/JOY_OF_PROGRAMMING__Software_Engineering_Simulator/
JOY OF PROGRAMMING - Software Engineering Simulator is an immersive 3D programming puzzle game about automating and controlling realistic machines, robots, drones and more using real Python code. Build actual coding skills while playing, solve exciting bite-sized programming challenges and progress to unlock new programming features and improved...
$12.24
167
I'm working on a combined curriculum for algebra and intro python. I want students to be able to tell python to graph inequalities on a number line. Is there a module with this functionality?
I think you can use sympy for this, which needs to be pip installed.
That's fine, I'm already having them pip install pygame later.
Ever heard of Factorio , its game is a set of physics simulation puzzles that are solved by writing Python scripts.
!rule 6 9 Please stop advertising around the server.
6. Do not post unapproved advertising.
9. Do not offer or ask for paid work of any kind.
frieren
Fein
Hi I'm looking for someone who's from finance background

@nova heath hi
@knotty lintel hey please post the question in an off topic channel. Not careers or pedagogy
Where bro?
!ot
Please read our off-topic etiquette before participating in conversations.
I am moving on from Python basics into intermediate stuff, just recently getting a grasp on OOP as the last topic in CS50's course. I was going to work through Automate the Boring Stuff, since it seemed like a resource to learn scripting with Python. I'm starting it, and it says it is for complete beginners. Is there a better resource? is it worth going through if I'm not a complete beginner?
Hello, be sure to read the description of each channel. Try moving this question to #python-discussion
FYI, a paper for polish readers about Robot Framework and BDD: https://www.academia.edu/127053765/Dialektyka_pozytywnej_i_negatywnej_heurystyki_jako[…]zystaniem_zapisu_testów_w_Natural_Semantic_Metalanguage
Feedback is welcome.
Oo
I have an interesting question for y'all. I have a project where I have a long running server which is connected to some embedded devices. I have created Classes for some of those devices that act as a machine abstraction layer allowing the initiation and ending of tasks or poll for updates on the data.
I want to create a method that will output html for the class including forms for the methods in the class but for this I need to do some runtime reflection. Does anyone have advice for the usual go to methods or even simplified methods of doing this sort of thing? Thanks everyone 🙂
this isn't the right channel for this. Try #python-discussion
Sorry about that. Thank you
That's pretty cool, I think gamefying this stuff is probably a good way to get people interested (and also helps visualize what you're doing).
There's also a different game called "Farmer was replaced", I think, where you use Python to control a drone and plant/collect seeds, and it starts from the very basics of programming
I had a bit of an epiphany yesterday, while describing ensemble (mob) programming to someone and they asked what the minimal level knowledge should be. It strikes me that rotating the roles of driver and navigator woud be a great way to introduce a lesson to a group of beginners.
Is this already a thing? Has anyone here tried it?
I have seen people report good results using pair programming to spread knowledge across their employees, usually in the context of adopting new languages. This seems pretty similar.
:incoming_envelope: :ok_hand: applied timeout to @weak mortar until <t:1738852097:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
can someone help me out in this
We are working on a api hosting
Well to get you a clear idea , let me explain it to you ...
i) We will have a script or smth that will req a url and get a csv file from there and then perform insertion in the database ( we will use github actions for that).
ii) then the database problem comes up ... we will be having 11 gb of data insertion each data (so which least costed database should we use)
iii) then we will have a backend server (django apis) or smth which will be api endpoints and it will perform data retrieval from database and i guess we were thinking to host it on vercel
Ask in #python-discussion or #❓|how-to-get-help
Is someone up for pair programming?
ask in #python-discussion or off-topic
I'm always up for pair programming and in fact I was part of a weekly ensemble programming group for new contributors: https://youtu.be/lwSRgb40tEk?si=rep3IH9a4_OfAZIJ&t=1205
This week we TDD'd a better error message when our request to GitHub fails.
!ban 1087869811972919379 selfbot
:incoming_envelope: :ok_hand: applied ban to @merry tulip permanently.
What is pair programming
Two or more people edit a program together
yeah alright
One person tells the other what to do and they do it with their skills and the other person can watch and learn. Driver Navigator roles.
Well it's not supposed to work like that
Oops. Looks like I did it in reverse. 😂
There's not supposed to be much telling what to do
Well
I mean it's not required that someone is telling someone else what to do
That may be a teacher student pairing, but I associate pairing with one person looking things up one person typing, and both people collaborating on the project
To be honest when I heard pair programming i thought of just 2 people programming next to eachother on completely different projects or in call giving advice to the other when requested
Does anyone want to talk about how pair programming could be used as an education technique?
people already do i think
Do you have any opinions about it?
seems good
I think it would be quite effective
Although I think the main thing beginners should know is how to find answers online and read documentation for functions, libraries, etc and to do that sort of research as the teacher in pair programming would be helpful
We did pair programming in my first programming course. I didn't see the point of it. Especially since we were both equally ignorant.
I think it probably depends on the project
But in the typical sense of having someone watch over you coding and discussing i don't think it would help me much personally
it would be much more effective to have them working on a different part of the project on another system
It seems more applicable when onboarding someone that already knows how to program, they just need to get familiar with the particular setup / codebase. Having it between two beginners will probably not do anything, and forcing professionals to constantly do it seems like a waste of time.
The context in which it's useful seems limited, but for onboarding it does seem a like a decent idea, for a bit.
Beyond that it's probably better to work in parallel and use other tools like version control.
two beginners programming together sounds like the blind leading the blind
I don't think pair programming can avoid education
.
Wrong channel; please read #❓|how-to-get-help
Hello guys, sorry to disturb you all... I need a some advice. Yesterday I participated in a Speed Coding Competition with a friend (competition was based on teams of 2). We didn't win but that's not the important thing because we learnt a lot from this event and we became aware of our gaps. I noticed, one of my gaps was that I'm not able to fully focus whenever I'm under pressure. For instance, we obtained a question that I already tackled in class so it should have been easy for me to give a solution. But at that moment, my mind went completely blank. The thing is, may be this is because, there were some previous questions where we didn't attempt because we weren't able to understand the logic/what the question is trying to say (well I didn't understand, my friend understand it well; at first, he was like me, not understand how we need to work things out but then, when I see him, he was fully focus on the question, he notices every pattern, he came out with some logics, some didn't work and he still manage to work towards another logic which would now work. I couldn't do that, my mind has completely shut down 😭 ). IF I was at home, at ease, may be I would be able to understand the questions and came with solutions but here I couldn't.
So, I was wondering, if you guys can give me some advise on how to improve myself to work under pressure, how to keep a calm mind and think properly; the sensation of not being able to do anything is really disgusting... I don't want to have that again 😭 . This is not only to be better in competitions; tomorrow, I would have to work in industries, there I would need to THINK in place, come work solutions etc (I even noticed when I was doing internships, the truth is the majority of the work I was assigned to, I was doing them at home really, when my collegues were speaking, at some point when I don't understand anymore, my mind goes blank 🥲 ). Any advice that you guys can recommend is highly appreciated please.
The thing is, even when I try to listen to music and do my work, I can't do both at the same time, it seems that I can't dictate my focus to be solely on my work I'm assigned to 😭 that's a big problem
take a deep breathe and try to find the reason instead of the solution alone
you should not rush to find the answer, calm yourself down and analyze, analyzing will give you the solution always
speed coding is completely unrealistic, not like the real world at all. It isn't important to be good at speed coding.
yeah true but what matters is to be able to cope with working under pressure :c, like in real world we would have to work under pressure too, I don't want to zone out 😭
Yes, that is important, but the time pressure is very different in the real world.
yeah I see what you mean, how can I become more proficient when dealing with real world pressure then please :c (I guess, if I can't handle simple time pressure like in a speed competition, real world pressure might be even more difficult)
competition isn't "simple time pressure." It's intense time pressure. In the real world you'll have more collaboration.
ah I see, yep noted, thanks 👍
hi
i can tell that doing things fast comes from experience
and that experience itself doesn't need to be fast
Hello, this is my first "post" of my code, Idk, I wanted to share my code with others, since I finally finished the str methods.
:p
Nice! Congratulations and welcome to the world of programming!
It is very addicting.
Please feel free to share and talk about your progress in #python-discussion or if you get stuck, people are always happy to help in that channel or open a thread in #1035199133436354600 😊
I hope to see more of your progress:D
Hi can someone recommend a visualiser other than py tutorial one I am trying to understand data structures I used a module graphviz which chatgpt gave it is just an image of connections I need a step by step line by line visualization so I can understand what each piece of code does
I don't know where to post it is confusing
Hello, please read the description of the channel, then read #❓|how-to-get-help
Does learning .marathon really work well?
this doesn't seem to have anything to do with pedagogy
Hi, this isn't the place to recruit.
What is pedagogy
Thx
why are there 3 pinned messages about what pedagogy is?
not like what it is, but literally "what is pedagogy?"
For posterity
like a head on a stake?
No
alright
is there any video explaining cpython object internals ?i am looking for it for a educational insttute
if you know a good one i would love it to be shared
there was this one talk about cpython memory structure
let me check maybe I can find it
The current discussion isn't about pedagogy; see #internals-and-peps
but but they were asking about it to teach so...
Doesn't count; see the channel description.
cool 
HELLO! new here. new to python, I am on a mission to learn Python, cybersecurity, and AI Theory and get certed in about 3 months, because I am laid off as a engineer for End user infrastructure support and think I may see the writting on the wall. Oh and in order to really really learn the coding i already forced myself to go back to ms dos to relearn command line, to get my head ready, I am coding a final fantasy 1/2 style rpg that incorporates learning cybersecurity. Oh and I set it all up in ubuntu, because that seems like the most ideal environment to learn and code it in and starting with VSCode, I am going through some free learning like w3, but looking into something like boot.dev as well. I believe that the partnership of learning and doing and seeing and failing/succeeding is probably the best way of learning. Wish me luck, nice to meet you all. And I will update on the progress as I troubleshoot and attempt to perfect my methods of learning and what environments work best, to maybe help others on their own journey's.
Thonny is a Python IDE for beginners that visualizes function calls, variables, and scopes. https://thonny.org/
Data structures like trees should be adequately explained in your course books, but have plenty of visualizations on sites like Wikipedia and YouTube as well.
Thanks a lot that really helps now I can understand how those lines work and where they go and what they do instead of plain diagrams
Reading the "A Philosophy On Software Design" and really like it. Anyone else read it? What opinions/recommendations do you think can be turned inte lint rules? It would be nice to have rules to push for some aspects of the book. Let's discuss! 🙂
Hello, this would be appropriate for #software-architecture , not here.
Yes maybe, thanks 👍
I am convinced no one knows what this channel is for
this belongs to #community-meta btw 😁☝️
:incoming_envelope: :ok_hand: applied timeout to @urban walrus until <t:1741735775:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
Hello! I've been meaning to ask any self taught programmers to share some tricks. I personally I plan a list of things to learn and then hit ai and read some books too but mostly ai is this way of learning really a good way for a self teaching yourself a program? like recently i was dealing with data structures in pyrhon
you're right am following cs229 and i enjoy it, but what advice would you give me as an obsessed noob who is curious to learn
FWIW, my advice is to ask 'why' a lot, and #python-discussion is a great place to hang out.
Solid principles, dependency injection (pure without containers), writing tests, learning an IDE like pycharm.
Hi, I just learned python and I wanted to know if it's bad for my learning if I use an AI because for a small personal project I used a lot chatGPT and I understand everything that is marked on my code but I do not know if it's a good thing to use the ia especially that without it I do not think I would have succeeded in doing what I did.
I also noticed in my apprenticeship that I had big gaps in algorhythmy and so I found platforms like genepy to learn algo is it good?
if you're a beginner, I recommend not using ChatGPT--it can do too much of the work for you and deprive you of meaningful learning opportunities.
This channel is for discussion of how to teach. It's not about self-study.
Sorry I spoke in the wrong place I must speak or this topic?
Your messages always have to be related to the channel topic. The channel description tells you what the topic is.
whats pedagogy?
see pinned messages
can someone tell me how much time will it take to learn for this job position
Job Duties and Responsibilities:
Writing new services to collect and process data from external vendors and public APIs
Writing internal APIs to assist with the processing of card applications and their ongoing underwriting.
Integrating new research from the data team into our production processes.
Writing ad-hoc scripts in order to bulk-process historical data.
May be required to perform other tasks and duties reasonably related to job responsibilities.
Experience/Knowledge, Skills & Abilities:
Bachelor’s degree in a relevant field required, Graduate degree in relevant field a plus
Expertise working with one or more relational databases systems (e.g. SQL Server/Postgres).
Strong knowledge of Python
Data processing experience and analysis using Pandas/Numpy
Experience working with consumption of external REST/SOAP APIs
Experience in writing new APIs (preferably using Python/Flask)
I have experience with api's but not with flask and I have little experience with numpy and pandas
please read channel description
i read that and it's related to this channel because i need someone to tell me where to start and how much would it take to learn it by my self ? so this question is very similar to one example in pinned messages "- How important is it for a programmer to learn some amount of assembly?"
this channel is meant for discussion about teaching Python. Your question is about your specific situation applying for that job, and will involve details of what you already know, how you like to learn, and so on. I can see how it seems closely related, but you are better off asking in #career-advice or #python-discussion .
ohh okay thank you for a very clear response
Hi I'm new.
hi. unless you want to talk about how to teach python well, you might prefer #python-discussion.
Your going to download step-by-step videos setting up RESTFUL frameworks then start downloading github repos
It would usefull to understand what your ACTUALLY doing... your building systems for CLOUD architects
Only English is allowed in this server. Please remove your message and post it in English in an appropriate channel.
@worldly cobalt
hi
I’m volunteering to teach some really young kids python and scratch, is there any easy way to explain more complex topics that are needed for the language?
Provide some simple examples(consist of only things they have learnt and only 1 new thing that they are going to learn) with annotation on the new concept, difficult to understand part?
what kind of complex topics are you planning on teaching? i dont think kids need to know about decorators or metaclasses
Uh
I guess like stdin stdout?
I’m sure they’ll eventually ask how the thing gets outputted
you can just say something like "every program has an input and an output" (don't say "standard <stream>", don't mention stderr, and don't use the abbreviations stdin/stdout unless they come up naturally somewhere)
Where are you planning to have them run the code?
(and how much time do you have?)
I’m not sure what the org is using, I’ll have a meeting later today
It’s most likely replit though
oh, they already know some Python?
Yes
note that replit now requires an account... I think
I’ll make one
Hello everyone! I work with data and I’d like to start learning Python. I’ve seen a lot of videos on YouTube, but I’m not sure how to start. I’m kind of a tinkerer — I don’t have a huge IT background, but I can handle some Linux command line. Do you have any good resources or advice to get started?
!res This channel is for discussions about how to teach Python, but you can find some learning resources below
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
.
Hello, please remove your message from this channel and paste it in #editors-ides
What is this channel?
Ah ic is there a good way to get my freind to learn how to use python it's been 4 years and he's still struggling to use print 😭
Not sayinging he's a low intelligence specimen but with the ideas he comes up with he really needs to learn
The best tends to be the latest and greatest, which Google should know. Google definitely knows the most popular, which could be the best to some. But mrhttp should be of interest to a high school student who should know how to google. It's a Python lib written in C, though, which with the popularity of Rust might not be the best cross-platform language anymore if by best you mean performant.
Hello, I recently started a club for informatics in high school and thankfully a lot of fellow students joined. Most of the members who just joined aren't familiar with any programming language, some understand computational logic while some are building up from 0. Now i want to teach them python since that's honestly the only language I'm confident in teaching but in cases like this is it better for me to straight up teach them python so that they can perhaps learn computer logics and simultaneously learn a language or should i teach them logic first like explain what is stuff like If and Loop are FIRST without teaching the syntaxing and stuff?
constructs like if statements and loops are part of Python syntax.
If I were teaching someone Python, this is the order in which I would present each concept: #pedagogy message
Woah, this is really helpful. Thanks!
I think it'll be much easier to make the concepts understandable if you're able to show practical examples.
Like, you can explain what an if statement is, but it'll be much easier to really grok it if you can then show an if statement in action on the computer.
Noted. Thx!
I use glow charts sometimes and it seems to help in both directions (showing them code I've created in a glow chart format and them constructing there own code using flow charts to show they understand the basic logic behind it)
Do you mean flow chart? (Sorry for the ping i forget to turn it off)
Where do you volunteer? I want to as well
Do you want me to introduce you to the persons discord
As a teenager, what should and shouldn't I include in my CV?
This channel is for discussing the methods and practices of teaching (and especially teaching Python and programming). You can ask CV-related questions in #career-advice
oh my bad, I messed up the channels in my mind
Maybe learning C, C++ re-affirms knowledge in a PC's hexidecimal keyboards key strokes and "string" in memory and how to work with stuff.. get in and out of cstrings.. get to libraries like .net.. maybe he's overwhelmed without foundational understanding... 100%
Python... first of all is very powerful.. for example winetricks ... can make a windows instance in linux and runs lightning fast..
Winetricks, lutris in linux jellyfish 22.04 for example... written in python will make you appreciate the speed python operates at... it will blow your mind ..
Neither of you guys fully understand the power of python and how crazy fast wine trix allows you to deploy a version of windows 7 for example.. download any launcher like steam for example and play a video game ... for example if your into that
Sure, I mean I wanna enhance my skills by teaching others
I'll give it a try ty
What is pedagogy?
The study of teaching and learning
Oh, can I fit 5 courses in my brain within a year?
Depends on you and the courses, I guess
But I took more than 5 courses per year at uni, and that generally worked out
Why do you type each of your sentences without a period… every sentence is like this…
Can I create a calculator like this?
numerical_expression = input('Type your numerical expression: '
result = eval(numerical_expression)
print('The result is: ', result)
the question can be asked and answered in the console
This code will only work on the console
In pycharm
yes, it works
This channel is for discussions about the methods and practices of teaching, and especially teaching Python
oh, sorry
If you have some technical issue, use #1035199133436354600
ok
Every language defines modulo with negatives in a different way. I have to look it up every time I care about the behaviour
(for example, in JavaScript and C 9 % -10 is 9)
I don't know, depends on the context
It's probably more important to teach the skills to find the answer to this question when they need it
I don't think the problem in itself is important. If I ran into something like this in practice, I'd be like "huh", then google it and find the answer.
You might ask that as a research exercise, like: "what happens when either a or b are negative in a % b?"
I've had a lot of similar situations with floating point arithmetics.
It's funny how helping someone is easier the more experienced the student is, even though the problems they have are generally inherently harder. Complete novices in particular are notoriously difficult to teach because they often face fundamental hurdles in reasoning about code.
do you have a recent example of this?
Well, the person in #python-discussion, marouane
import tkinter as tk
import datetime
primary = tk.Tk()
primary.geometry('2320x1080')
primary.title('clock')
while True:
x = tk.Label(primary,text=str(datetime.datetime.now()),font=('SEC Medium_SamsungKoreanM Medium', 28))
x.pack()
primary.mainloop()
they couldn't fathom why datetime.datetime.now() wouldn't continuously update its value, even after it was explained that mainloop() is blocking, and it became quite the struggle to try to figure out in what way they were confused exactly
With a complete novice, the issue is generally identifying where the gaps in knowledge are, or in what way they've misunderstood some basic concept, and the difficulty is compounded by the fact that the novice themselves lacks the language to express what they don't understand.
You have to ask questions and try to piece together what their state of mind is from vague indirect clues.
In some sense, I guess. Though when I hear the word "automation", I tend to think of some currently manual process being automated. This isn't really something anyone would do by hand.
!rule 9
It's extremely niche and completely non-essential
you could argue it's harmful to teach it, since students will try to use it inappropriately (kinda like eval/exec)
I don't think it's essential. If anything, I fear novices would use it to create variables dynamically
Is there a reason you asked about locals and not globals?
||yet another builtin that's supposed to be in sys or inspect instead||
Locals isn't a keyword
That's better than using locals and globals, I guess
However, I would encourage their curiosity, as long as they come away knowing how to metaprogram responsibly
Hi! Can anyone help me with an acronym "MRE"? what does it mean? https://github.com/vim/vim/issues/10087#issuecomment-1088206931
Hello, your question is off-topic for this channel. Be sure to always read the channel description. See #❓|how-to-get-help
why is that? Does not Pedagogy refer to "teaching and sharing information"? @misty dirge 😄
Please read the channel description.
Hello guys, I have a quick question. When we learn something, say I want to learn linear algebra, the best way to learn is to get started. Now the thing is, say I'm reading a book on linear algebra, in college/universities, normally, we don't cover an entire book, no? Like, on part of the contents? So my question is if I have to do some self-study for whatever topics, how should I proceed? Because I quickly feel overwhelmed on the long run when I see all of the contents to be read
There are lots of free online courses on such topics, they could provide the kind of structure and scope that you'd get from an ordinary university course.
In some cases, there are also online learning platforms with some kind of topic progression tree that'll give you a sense for in what order to tackle subjects and how much of a subject you've covered.
you can find the detailed syllabi and even like notes and lecture recordings of some universities online, so you can tell exactly how much they cover from the textbook
like, MIT's OpenCourseWare
Yep I see, thanks !
I really wonder why this isn't taught as much. It's one of the most basic ideas that gets pushed down on students who learn C/C++. Maybe it can be argued not to be that clean to write.
It's just not useful in that many scenarios. It's a minor convenience feature. I wouldn't say it's basic in C/C++ either.
Maybe it sees more usage in C due to lack of exceptions.
You're right about that
by basic I meant it's in one of the earliest pages of the C tutorial book by K&R - not necessarily how basic it is as a practice or concept
but yeah the first use that came to my mind is exceptionless error checking
Well, for a language like Python, it makes sense to teach language features in order of importance and frequency of use
The K&R C book may not be the best representation of pedagogy in programming education
I'm not sure how good it actually is, but since it's so old, we've probably made a lot of progress in programming pedagogy since it was written.
I'm seeing that a lot here and I'm constantly at odds with it but I absolutely love it
I kinda have a bad taste in my mouth from my undergrad courses which are made by really old folk (some of whom still think UML is the future of java GUI programming), but they're really the only reference point I have on how programming teaching is done so I'm glad I'm getting exposed to other approaches
Ah, sounds kinda like my undergrad courses then
Which I took about 16-17 years ago
Well I doubt it's going to get any better for me except in the more theoretical courses (DSA and OS, Computer Organization where there hasn't been any drastic progress done)
But I have a few family members who'd like me to teach them programming which is proving to be insanely hard and I've only started preparing the material
Hello guys i have a quick question . I'm a student in civil engineering now in our we learn python for example to do calculation of wind load , beam etc. Now my question is to now the order use of python bcs i want in-depth in the language .
What do you mean with order use?
hii, someone here speaks spanish and wants to learn about math and physics?
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
!rule 69
!warn 1157212172649246761 Trolling is not welcome here.
:incoming_envelope: :ok_hand: applied warning to @stiff crystal.
Only weak minds take a joke as a troll.
!mute 1157212172649246761 1w Take a break, read the #rules and #code-of-conduct
:incoming_envelope: :ok_hand: applied timeout to @stiff crystal until <t:1745736281:f> (7 days).
ooh nah jit tripping blud got muted
jit compilation reference
Sleep stupidity really got me that day.
This appears to be a node-based Python IDE with cute animations. Perhaps great for students experienced with Scratch or getting into audio mixing. https://github.com/IndieSmiths/nodezator
Dang
Would you use this over unit-testing
Unit testing is more important than visual programming, but peda refers to children who prefer something fun to look at over boring text.
this channel is about teaching python and related concepts in general. not specifically to children.
indeed, and the current definition prefers dull formality but there's SPARK-Ada for that. https://www.merriam-webster.com/dictionary/pedagogue
If it's still maintained by the time my daughter is of an age to learn programming, I'll give it a shot.
here's a video on the concept, called "flow based programming": https://www.youtube.com/watch?v=wlna48I2aIE
Flow Based Programming is a type of visual programming where you connect the inputs and outputs of various functional nodes.
I wrote a Javascript API to create (visually questionable) flow charts, and proceed to make a very unintuitive programming language based off of it.
This project is open source, under the MIT License. The GitHub reposito...
:incoming_envelope: :ok_hand: applied timeout to @solemn swallow until <t:1747230982:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
Need help understanding the Python Data Model? check out: https://youtu.be/pvIJgHCaXhU
🔗 Links:
- mutability.zip: https://github.com/bterwijn/memory_graph_videos/raw/refs/heads/main/mutability.zip
- memory_graph package: https://pypi.org/project/memory-graph/
📌 Topics in this video:
0:00 Intro
0:06 Immutable and Mutable types
4:02 Copy
6:41 Custom Copy
9:10 Function Calls
11:16 memory_graph Debugger Setup
13:34 memory_graph...
Different ways to "copy" a nested list, and much more of that stuff
So check my new 'memory_graph' package: https://pypi.org/project/memory-graph/
If you're at pyconUS and want to learn about team programming,
I'm hosting an open space for Ensemble Coding. Friday at 6pm in room 309.
did you mean to post in #pycon-us ?
If any of the experts here decide to make a book, dont use your own custom libraries. Theyre fucking useless and teach you nothing. If you want to understand what Im talking about, read the Introduction to Statistical Learning Python book. The way it teaches the theory is really good as it explains complex topics in a much simpler way. The programming aspect is dogshit due to their constant use of their custom libraries and lack of an in depth explanation of each tool. Teach beginners like me how to use the libraries, that the industry uses, from the beginning and explain what each part does. For me to effectively start making my own projects, I need at least a decent base understanding of what the tools or else itll just be hours searching the internet and only coding for a few minutes
Making your own bespoke tools can be very helpful if it's done well. For example, How To Design Programs uses its own language (based on Racket) that is specifically designed for students, and it gradually introduces new concepts
That can have huge benefits, because you can leave out everything that the learner does not need to learn the concepts.
For example, industry tools typically value backwards compatibility. If you want to teach someone Python, you will need to teach the quirks as well: bool being a subclass of int, += doing mutation on collections, mutable default arguments, late-binding of closures, if expressions having an unusual order, stdlib names not following PEP8 etc.
Of course, if the book advertises as teaching the things used in industry, but instead teaches Scratch, that's a different situation
and if you explain the tools poorly, well, explaining industry tools poorly is not good either
Thats the issue Ive faced with ISLP. It doesnt thoroughly explain how their custom libraries work. It doesnt matter now. Ive decided ill use ISLP purely for the maths and Ill use other resources on the internet to teach myself how to use the ML libraries
!warn 1340035829891862650 your previous message in this channel was not appropriate. Please read the #code-of-conduct
:ok_hand: applied warning to @karmic wyvern.
What did he say, i knew it was to me
random question: can a fonction return a fonction as an output?
Your question is not on-topic for this channel. The answer is yes. If you have another question along these lines, please use #python-discussion.
ok
I have written a series on deploying Model Context Protocol tools in Azure Functions. I hope it will be helpful for people new in MCP.
https://amustahid.hashnode.dev/deploy-mcp-server-with-azure-functions
https://amustahid.hashnode.dev/mcp-server-with-azure-functions-part-2
https://amustahid.hashnode.dev/mcp-server-with-azure-functions-sql-edition-part-3-plus-bonus
wow , thank you 🔥
memory_graph in PyCharm debugger
See the "quick intro" youtube video: https://youtu.be/23_bHcr7hqo
When is a good point to teach people about virtual environments. And before that should you just give them step by step instructions on how to use a virtual environment or should you just not have them use a virtual environment?
I think beginners would find virtual environments to be a frustrating and unnecessary step that keeps them from writing code. I wouldn't introduce them until they're working on projects that require reproducibility.
or if pycharm forces them to learn about them right away
I wouldn't go out of my way to explain them unless they ran into a problem caused by not using a venv, or if they explicitly ask about them.
👍
hello, I have a doubt and I would like a recommendation. I am a self-taught and want to learn data analytics and artificial intelligence with python which is the best course on the internet? that can be classified with these characteristics: -certificate -beginner to advanced -online and virtual -which guarantees you work or has international educational weight
I hope your answer would appreciate it very
ive liked dataquest.io but you have to pay as it is an extensive online library of useful courses
thank you I will look for it
hello, your question is not on-topic for this channel. Please remove it and paste it in a new thread in #1035199133436354600
Hello @modest spruce , your message is off topic for this channel. Please remove it from here and paste it in a new help thread in #1035199133436354600
Hi guys, what stack should I learn for developing own AI, and what steps should I take first, I know python a bit, but guess it wouldnt help a lot
This channel is for discussing how to teach. If you just need general Python advice, you can ask in #python-discussion.
Im asking what to study
Please read the description of the channel.
I'm wondering if I should teach types.SimpleNamespace first to my friend or classes. What do you guys think?
If you just want a key-value mapping, use a dictionary
My line of thought is since raw classes are a bit confusing to beginners in Python, perhaps looking at SimpleNamespace objects first would make them more approachable because there are similarities between user-defined class objects and SimpleNamespace objects
I think a downside is that this is an unusual feature that most people (I think) haven't heard of.
I don't think there needs to be an intermediate step between dictionaries and classes.
SimpleNamespaces are are basically dicts. they're not a template from which you can make discrete instances.
If there must be an intermediate between dicts and classes, maybe use NamedTuples.
Well, class objects are pretty similar to dicts, too, but they have more features
NamedTuple would be a better 'analogy' for classes, yeah, since you define a template that you instantiate
right. but namespaces have fewer features than dicts.
thank you for posing this interesting question to the channel 
Thank you for using this channel correctly, it's so rare!
||don't rub it in
||
oh yeah, I was always wondering: pedagogy, what's that?
I would teach dicts and work up to classes/objects like so:
- basics of a dict: they associate a key to a value
- dicts are sometimes taught as a way to have dynamic variables, I really dislike that, I would teach it as a way to group related data together (see where I'm going?). For example, make a dict to represent a user with a name, email address, etc
- write several functions that accept a user dict and do something with it (send an email, greet the user, etc.). Doesn't have to be "real", just convey the idea.
- highlight that this can be risky because it relies on the dict having a specific set of keys. To overcome that, you can work through adding two things:
* a function that accepts all the values a user dict needs, and creates and returns the dict (this makes sure the keys are normalized)
* input checking in the functions that use the user dict (validate that a key exists before get'ing it, etc)
After that exercise, you have a really good lead in to "So, dicts are a nice, dynamic way to group related data. Wouldn't it be nice though if we could also bundle this functionality (the functions we wrote) with the data so that it was all one package?"
That's how you introduce classes:
- They bundle related data together like a dict (via attributes)
- They provide a way to normalize "state" like your user dict creation function via the init
- They let you keep functionality related to that state close to that state, and you don't have to check that the state exists like you did with the functions that just accepted a user dict
Hey, thanks for your response, but I've got a couple questions
First of all, you say this:
dicts are sometimes taught as a way to have dynamic variables
What do you mean by "dynamic variables"?
as in, you don't know what variables you'll need ahead of time, or what their contents will be
it's not wrong, I just think it poorly expresses what a dict is good for/does
What you're saying is a pretty good idea, but in my opinion (which could be wrong) dicts are probably better thought of as not much more than key-value stores rather than "an underpowered version of objects" whereas objects represent entities or concepts.
I understand, though, that your example is exactly hinting at that; that dicts aren't the right tool for that kind of job (e.g. storing information about a user), but I don't want to create the impression that user-defined objects are just more powerful dicts
well...they are though
I mean, it's not always a useful way to think about them, but they actually are. it's just that there's quite a bit of powerful "stuff" built on them
The usage of dict does usually hint at some sort of dynamism going on. For example, a recursive listing of a directory would likely be represented by dicts:
{
".": ["file01", "file02", "file03"],
"folder1": ["file11", "file12", "file13"],
"folder2": ["file21", "file22", "file23"]
}
and you can absolutely do domain modeling with dicts/maps/etc. plenty of languages do that extensively (like lisps)
Under the hood, yeah, the attributes are stored in a dictionary
My point is that you're not supposed to think of them in that light to use them efficiently
not supposed to think of what like that, classes/objects?
it's also not really true, int doesn't store its attributes in a dict, nor do classes with __slots__ (tho they will compute a dict for you if you ask).
I haven't tested this, but I think it's a good idea to teach classes through the lens of behaviour (and polymorphism). Classes aren't just used to bundle data, you can use a dict for that
What else is there other than data and invariants?
While interacting with the class over methods and properties does prevent certain undesirable states within the object, it's just about establishing invariants and handling internal events within it
I think it's very hard to come up with useful examples of classes
I would imagine it would be quite hard to grasp polymorphism without a pretty firm understanding of classes/objects and method dispatch. not sure how you centralize that concept
I was forced to learn them when starting to use Tkinter 😅 (It was impractical otherwise)
I also remember using classes (when I didn't understand them well and avoided them) to make a resettable TicTacToe object and conveniently interact with the gameboard
You can achieve polymorphism in other ways:
def _rectangle_area(rect):
return rect["width"] * rect["height"]
def _rectangle_scale(rect, n):
rect["width"] *= n
rect["height"] *= n
def _rectangle_info(rect):
return "make_rectangle({0[width]!r}, {0[height]!r})".format(rect)
def make_rectangle(width, height):
return {
"width": width,
"height": height,
"area": _rectangle_area,
"scale": _rectangle_scale,
"info": _rectangle_info,
}
but if you arm a beginner with this knowledge, it's going to be hard to explain why classes are typically used for that 😄
they'd right some real fun code though
Maybe to not have code that looks like that
I took a graphic programming class in C way back when, and decided I'd be clever and implement something akin to objects. I caught my professor reading over some of my code and muttering jesus christ once.
But that's just a speculation 😅
I think reflecting on why is kinda important. It'd be reasonable to write this kind of code in JavaScript, probably. But not in Python
I did that too! (Trying to implement objects in C)
Implementing objects in C is pretty common. CPython definitely does this
well yeah, but they do it well. I'm sure I did not
In a cursed way...
I did make some pretty raytraced spheres though, so all's well that ends well
Maybe not exactly this, but I think this could be a good way to introduce polymorphism. You just need to come up with a good and relevant example where you need to handle objects with differing behaviour
You start modelling something as a tuple or a dict, then you add a bunch of ifs, and then you add a function as a member, and then you introduce classes and gloss over as to why you use classes for this (something like "it's more reliable and not as messy")
I did something like this: (formatted code tightly to not flood)
#include <stdio.h>
typedef struct Person
{ const char* name; int age; void (*introduce_self)(); }
Person;
Person make_Person(const char* name, int age) {
Person self;
self.name = name; self.age = age;
void introduce_self()
{ printf("Hello, world! I'm %s and I'm %d.\n", self.name, self.age); }
self.introduce_self = introduce_self;
return self;
}
int main() {
Person person = make_Person("Tigran", 17);
person.introduce_self();
return 0;
}
I know this is not standard C
Don't throw stones at me I was just mucking around :(
Well, to be fair, named tuples and associated functions often do the jobs, but classes are nice to have for dunders, properties, nicer syntax, etc.
And even in the basic cases essentially what classes do is streamline that process anyway
I think the real good reasons for using a class are:
- classfication (you can see the
typeof an object and see what it is and where it comes from) - inheritance
- nicer syntax (
foo.barandfoo.baz()is just how you're supposed to access known fields/functions of a thing in Python) - dunder methods (in particular
__repr__and__eq__)
repr is amazing. I wish more languages had something as simple
the idea I'm trying to get at is, unlike many other concepts, classes don't really introduce something you weren't able to do before
Because Python doesn't do the cursed data hiding nonsense that other OOP languages do
e.g. you couldn't really abstract a piece of code that you can invoke with different parameters without a function
I think of Python classes as copyable and instantiable namespaces
That kind of model really helps because you can add your own attributes to instances (not that you should, but still)
I also like to think of classes as a convenient way to share variables easily between sets of functions without flooding them globally
C++ lets you overload << for your class, but according to OttoBotCode that requires getters unless you mark that function a friend in the class definition. Either is overly verbose like Java. I'd just make a public toStr() method.
There's also std::format("{}", obj) which is probably what you should use in C++20 and greater. There's even an example of std::format("{:?}", obj) in cppreference which is semantically closer to Python's repr(obj) but I'm not sure if it's actually supported. ChatGPT says it isn't and I haven't tried it myself
If I recall correctly, C++'s output streams (std::ostream) have a global state when you print formatted output. The new text formatting library (C++20's std::format, C++23's std::print) is better because its state isn't global.
C++17:
std::cout << std::hex << 0xDEADBEEF << '\n'; // prints "deadbeef"
std::cout << 255 << '\n'; // prints "ff"
C++20:
std::cout << std::format("{:x}", 0xDEADBEEF) << '\n'; // prints "deadbeef"
std::cout << std::format("{}", 255) << '\n'; // prints "255"
C++23 even lets you do std::println("{}", obj)
I'm really not a fan of C++ though, so much technical debt :/
For real. At least it's clear about which the best version and execution order are, unlike Lisp.
Execution order? What do you mean?
Lisp uses Polish notation, which is fine for machines, but humans prefer infix notation
Ohh
Well, Polish notation is easier to implement, but how is it any better for the machine other than that?
A small implementation (one page iirc) is easy to debug, optimize, and run, but hard to use without building your own framework first, hence the many versions of Lisp.
Ohh I get what you're saying. Well, the complexity eventually ends up accumulating somewhere. A language with a complex specification is better than a simple language that's a nightmare to use. 😅
Python is a good balance, but somehow not as performant as Lua or Julia, which i dislike for their optional zero-based indexing.
I think if Python had stronger typing it could very well be a neatly-performing compiled language
Though we'd lose eval, exec and all those sorts of things, so it'd be a subset of Python
Sounds like RPython, part of Stackless Python which runs EVE Online. My current favorite programming languages are Mojo, V, and Nim, but those aren't mature yet and i should check out Kotlin some more.
oh, and Bend should rival Mojo
This isn't a language discussion channel--be sure that everything pertains to how to teach programming.
Otherwise, please move this to one of the three off-topic channels.
@elfin violet your message is off-topic for this channel. Please cut and paste it to one of the three off-topic channels.
Hello, here is my password generator with python too just like you, but it is a video the video link is here: https://www.youtube.com/watch?v=RugxgN--pwM&t=5s
@ProgrammerRobot
I have added a webcam in this video🥰.
In this video, we will make a password generator using python.
You can Generate your own password form this project
If you have any ideas what to do write it in the comment.
I hope you enjoy it🥰!
Thanks For Watching!
Bye👋!
Chapters:
00:00 Introduction
00:10 Importing rando...
https://www.youtube.com/watch?v=RugxgN--pwM&t=5s This is a password generator you can also check!
@ProgrammerRobot
I have added a webcam in this video🥰.
In this video, we will make a password generator using python.
You can Generate your own password form this project
If you have any ideas what to do write it in the comment.
I hope you enjoy it🥰!
Thanks For Watching!
Bye👋!
Chapters:
00:00 Introduction
00:10 Importing rando...
@misty finch @stuck mist this is not the right channel for this. You can either talk about this in #python-discussion or one of the 3 off topic channels 😃
Thanks for telling me back and sorry for this...
pass gen tool is sweet little project! But yeah, wrong chat haha
Is that ai generated image
Don't spam this (or anything else) across channels
Hi
Yo
#software-architecture message
Building off this, I've had some non-devs look at it and the alt syntax is prefered and is likely what I'll go with
I also have plans for objects as I say, Im just going to quickly map the function syntax over
Proposed Object (class) syntax
For those who likely dont want to download:
Click here to see this code in our pastebin.
I think this would nicely fit a way of teaching/explaining a class
How should I go about teaching my sisters how to code? In all honesty, evne though I’ve been programming for nearly 2 years, its been very on and off due to my own uncertainty in wtf I want to do in my life. Regardless, I still want to teach my sisters
Btw theyre both 9 years old. Tbf, the younger of the twins is more interested as she told me she wants to learn to code but I told her tomorrow. Just not feeling great today
"hour of code" is a fun visual thing to introduce children to simple coding.
https://hourofcode.com/
And a lot of tasks are translated into many languages.
Tasks are divided into levels by grades, but there's a lot of them to explore depending on what visuals appeal to you - Disney stuff, Minecraft, Star Wars, Barbie...
... OMG, I just browsed and found some tasks have "pre-reader" as level. 😱😍 That means I could try to get my 5yo nibling to try "coding"!
Thank you pal. In hoping it ignites the coding bug in them
Some tasks are about drawing with moving character (Frozen for sure, but with arches/circles - I remember specifically because it released when I was in high school and our cs teacher made us play it to proofread the translation), so they might be followed by turtle module later :3
Although in over a decade since I last really checked the games there (as I said, hs teacher made us, lol), it grew quite a lot, so there's a lot to explore in there anyways.
As the name says, the task chains are designed to take around an hour to do, so maybe try to do one a week? Quality time with siblings connected with teaching. :3
Ill try that. Ngl Im ashamed my coding skills are still not up to par after 2 years but then again, I’ve been doing on and off. Still got a few simple projects. If I get some money, Ill start doing some embedded projects and get them involved. I know I can use online simulators but personally, that does not compare to actually building things with your very hands
Forgot I had a circuit playground express mc. I might use that with my sisters
Question! I’m a college student utterly new to coding. What do you do with Python???
Hello, your question is off topic for this channel. Try #python-discussion . Be sure to always read the channel description.
A Data Structure like a Binary Tree is easier understood and debugged with data visualization using memory_graph: https://pypi.org/project/memory-graph/
hey
Nice, have you seen https://www.recursionvisualizer.com?
isn't there an extension directly in vscode for this?
Just wanted to share (don't know if is the right place), i've been strugling with learning how to manipulate json and this site really helps u understand it
https://jsonpathfinder.com
JSON Path Finder
wao natural language program! I'm reminded of the domain specific language Inform 7, for interactive fiction.
I find it actually pretty terrible for newcomers, so maybe don't take too much of an inspiration from it, but as a cool party trick, this is a valid statement: "Instead of a suspicious person (called the suspect) burning something which is evidence against the suspect when the number of people in the location is at least two, try the suspect going a random valid direction."
also, https://www.plover.net/~pscion/Inform 7 for Programmers.pdf
Have you worked when XMLpath syntax? it's, at least for me, very unintuitive. wonder what your take on that is. I quite like json path or "JSON pointer," as I heard to referred to once, anyway. It follows the principle is least surprise, which is rare in data analysis.
This channel is for talking about techniques for teaching python and other concepts. Please make sure every message in this channel is about that.
yeah ive seen inform passed around a lot. I enjoy the idea of programming in sentences as you could literally translate a client's request to a working implement.
It also means you could easily teach/explain concepts since there is a much higher level of abstraction to it
Its also kinda why im targeting python, a simple teaching language, to an easy use language. its to develop initial programming skills
I'm still learning quite a bit about Python and those Markup languages. I haven't had the chance to use XMLPath yet — it does sound more intuitive to me because of the way it's structured, but I haven't tried it.
I used JSON, not even by choice 😅 — I needed to grab a JSON coming from a JavaScript program from a friend and manipulate it with Python.
I do intend to try YAML in the future, since it seems very easy to use.
sorry about that, it did shared to the intention to help ppl with the json python library that was my case
seems like the discussion about XMLpath and JSON isn't about how to teach programming.
That's COBOL though, and it seems to not have worked out.
the nice things about json is to call easily have the line per record (crags and gcc can output this way) so is is very easily parsed incrementally
python >= 3.11 has a built in tomllob, which is nice
but not sure why it's not just called to toml
Please go to a different channel to talk about json, toml, etc.
I'm happy to end the discussion here
but I do have a very relevant pedagogy related topic that @jolly night witnessed last night/this morning on general
someone wanted very insistently to "learn python" so they could make AI stuff but they refused to read any resources
I doubt they've ever coded before
if someone in 2025 wants to start making what they probably think of as AI right away, and they're not willing to start small and potentially commit to a multi-year journey, there's nothing you can do to help them.
I wanted very badly to say "you have the wrong attitude for that goal"
you can't become an astronaut by watching space expeditions
if after some back-and-forth it becomes clear that that is the case, I don't think it's impolite to tell them that, as long as you don't say anything intentionally degrading.
I even mentione learnpthon.org, which is full of interactive code actors l snippets to experiment in.. I think they lacked a requisite curiosity
I think that was a fairly diplomatic statement
Did they ask for resources? It seems they might already know how they want to learn it.
What's this channel all about? 🤔
read pins
Are there any good kid friendly guides to python? Particularly guides to help kids learn programming through gaming? Im doing a guided project (tetris with pygame) with my two sisters just to pique my sisters interest. Well try to finish it today and then later on in the week try to see what psrts of the game we can change
Using turtle is always a good place... https://inventwithpython.com/stt/
What is turtle? A book?
A python module where you write instructions for drawing geometric shapes
Nice
I want to know if you can draw animals in python using turtle cuz I am very new
🫡
For future reference, if I created an educational video, would it be okay to share the link here to request feedback?
Please send a message to mod mail describing what kind of videos in more detail and I'll respond.
Anyway,
Now that we're a few years into the ChatGPT era, does anyone know someone who used ChatGPT as a beginner to their detriment, and when it became clear that they were lacking skills, and how they overcame?
What i noticed is that they lack debugging skills. Even when stackoverflow was a thing, your first attempt was to check the docs, think by yourself. Today, straight to AI.
that makes sense. do you know anyone who has since overcome that?
the junior devs i "mentor", i often tell them to at least read the stack trace of the error, they can't just be feeding AI with any minor error. They should use their brain from time to time, that's how they'll improve and get better.
Hello, please read the description of this channel.
Knowing the basics can be useful, but the bit flip treshold of the average RAM might be too much for people who don't care that much about integrity
Not to mention the ethics of hardware and software sourcing
See the group description: NOT FOR RESOURCES, HELP, OR SELF-LEARNING ADVICE | Discussion of the methods and practices of teaching | Resources: https://www.pythondiscord.com/resources/
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
^
Hey guys I'm going to start a server on discord about phenomenology, I will be using obsidian to do allot of the designs which uses allot of CSS so any advice is appreciated
How old should a student be to start learning programming? Is 8 too young?
People learn subjects at battle different ages. If they're interested in it and comprehending it doesn't matter
i know a guy whose 14 and started at 9 and is doing leetcode competitions for money in korea i dont think theres a age too young to start learning
def φ(x=1): return x, φ
Different children will have very different levels of cognitive development, but I think a bright 8-year-old would easily be old enough to start learning programming.
Rare cases: 6 year olds
As long as they understand it
I personally don’t think it’s depending on age but depends more so on dedication. I’m trying my best to learn programming so I can make a project where I link up a website with a bot but it’s just a matter of time
Programming is hella hard at first but sooner or later it just becomes patterns
Plus I don’t think everyone’s going to know everything off the top of their head so simply asking for help is very important with coding
As long as they understand it and are willing to keep trying then that’s it
Go
I actually think [teaching range-len instead of zip is] what should be taught to beginners
@cyan spindle explain
It's like, the bread-and-butter of many languages out there. I don't think you can say it's "bad".
do stuff by indexing manually into arrays.
Sure it might be less efficient in Python what with Python loops and all.
I said "bad" as in "not pythonic". And I don't think there's any inherent virtue in teaching C-style looping.
it's just that python has better ready made solutions as part of the core language (as part of the built-in functions to be more specific)
I think it also matters what you're actually teaching. If you want to teach the low level stuff, then sure, range(len(list)) is better, but then maybe just go ahead ant teach C instead of python
I still think it is much more of a natural building block when you learn loops.
it's not natural in python at all. Python isn't a low level language, range(len( looks unnecessarily awkward
why is range/len competing here with zip instead of enumerate
What if you want to mutate the list?
I'm not really interested in this from an aesthetics perspective. if someone needs to iterate over two sequences concurrently, what about range-len gives the student a deeper understanding of programming than zip?
zip() is the "obvious" choice for the problem we are discussing where there are two equal length strings that you should print vertically beside each other
Maybe I prefer to teach people "how to do programming" rather than simply "how to Python".
I mean I may have overaccented the aesthetics but the reason I said it "looks awkward" is because, as a beginner, if you're paying attention and trying to remember what's actually going on, zip is the tool to iterate over multiple iterables, while range(len( is a way to go around that
yeah but we're not mutating the list in this task
for core concepts i agree, as in this case
but if you are just looking for the most pythonic solution, no
I'm aware. My point still stands that whether you like it or not, sometimes you still need the range
^ reply to @civic stag
yeah but at that point it becomes necessary. I said unnecessarily in this context
And to me, "zip" is a pretty advanced concept.
this assumes that C-style looping is inherently the main way. If we assume that no language is the default, I'm asking you to explain what you think is especially virtuous about C-style looping for learning purposes. I am not attacking you, I am seriously interested to know.
It's not C-style looping.
I think it's a perfectly fine exercise. The purpose is to demonstrate indexing with a dynamic value, not to teach concurrent iteration over two collections
but why do you consider it the default?
By "c style looping" I mean "a loop that increments an index as the means of accessing sequential elements"
I don't even have C in mind.... It's just how any algorithm proceeds.
If you read pseudocode, it all reads FOR I = [0 ... N] or some such.
I call that "c style looping" in any context, for lack of a better term.
And I think there's value in teaching the student to think atomically in such a manner. As I was saying, "zip" is a pretty advanced concept, from the functional realm.
"Ok I'll go to the 0th index, do this. Go to the 1st, do this. Etc...". I prefer students to learn this when they begin.
why is functional inherently more advanced than low level coding?
- I didn't say functional is more advanced.
- I don't think indexing is low-level.
I said I think "zip" is advanced. Does anyone not think so?
I think zip is a pretty simple concept
is it fair to say that looping is more general and therefore would be more useful in a wider variety of similar problems
I don't think it's that advanced. though the reason I said "range-len is bad and zip is good" is because I always caveat when I'm going to guide someone through an unpythonic solution.
well, from that perspective, zip is more general. range-len only works when all iterables are sequences.
For you now, sure. But try to put yourself in the shoes of someone who is just starting.
!zip
The zip function allows you to iterate through multiple iterables simultaneously. It joins the iterables together, almost like a zipper, so that each new element is a tuple with one element from each iterable.
letters = 'abc'
numbers = [1, 2, 3]
# list(zip(letters, numbers)) --> [('a', 1), ('b', 2), ('c', 3)]
for letter, number in zip(letters, numbers):
print(letter, number)
The zip() iterator is exhausted after the length of the shortest iterable is exceeded. If you would like to retain the other values, consider using itertools.zip_longest.
For more information on zip, please refer to the official documentation.
hmm, this could be improved.
but I think just observing the behavior of zip makes it self-explanatory.
If you want to explain what zip actually is, you probably need to explain iterables and iterators first, which is a long time away from hello world
But it's probably fine to say "just memorize this construct to iterate over two things simultaneously"
depends on their background and how you got them to that point. I really don't think it's hard to get a newbie to understand zip
Ok, what would you answer if a beginner asks you why they should use zip rather than range(len(x))?
("It's more pythonic" is not an acceptable answer.)
sometimes you can't do len(x) and zip is more readable
it doesn't require an extra counter variable
it uses a built-in feature of the language to make code more concise and better communicate what the loop is intended to do (iterate over two or more things at the same time, as opposed to range-len, which could be used for several things)
it also lets you have a variable for each thing that's being iterated over, which can have a specific name, to make code more self-documenting.
And everyone in this discussion thinks zip is beginner-level-suitable?
yeah, I don't think it's that complicated or confusing.
people are smart and can intuitively understand what something does when they observe it.
I do think your point about range-len being more "atomic" is interesting, though.
What's not beginner-level-suitable about zip in your opinion?
I do think you can run into things like: py x = zip(foos, bars) and then being confused about the output of x or why iterating over x twice fails.
Here's where my thinking comes from. How do we even get to parallel looping over two sequences? We get there from simple for loops. And which of these two examples looks simpler?
str1 = "Hello"
for x in str1:
print(x)
for i in range(len(str1)):
print(str1[i])
however, I think teaching for-zip as a singular concept for parallel looping (not composed of for and zip separately) is a fine stepping stone
for x in str1:
print(x)
for y in str2:
print(y)
for x, y in zip(str1, str2):
print(x, y)
these follow pretty naturally.
more naturally than replacing the whole looping machinery with range-len
- From my experience teaching students (granted I have not had many), none of them found it straightforward to pick up. Even those that "got it" quickly did not realize in later situations that they could use it.
- It requires that they know unpacking.
- For those who transition from another language, it's a new thing and less natural than manual indexing.
ah right, unpacking
It requires that they know unpacking.
I don't think so. you can just see "oh, looping with zip gives me more than one loop variable" without understanding what unpacking is in general.
just like you can use range-len without understanding __iter__ and __next__
maybe it would be more natural to teach single thing - fixed number of multiple things (tuples, packing, unpacking, maybe even structs) - variable number of multiple things (arrays)
But still, my #1 reason for preferring to teach manual indexing, is that that's the way the algos go. Personally I'd rather let the student discover zip on their own. It's like syntactic sugar you never knew you missed.
but the person didn't really understand looping, did they
They didn't reply, so nobody knows 😛
when you say "the person", do you mean the specific person in the help thread from earlier, or "someone who doesn't know about dunders iter and next"?
person in the thread. giving them zip feels like handing them a black box. which i guess is fine.
everything in programming involves abstraction
i'm quite new myself and honestly being handed a zip object is confusing, too. like what do i do with this now
iirc they've received help before so probably whoever helped them before would know best 😇
well do you at least know what it does now?
oh i can make it a list... doesn't really solve it
it's matrix transposition, essentially.
this seems to unnecessarily complicate what zip does
I wrote that precisely to tell you that it's not an easy idea!
but it's not "essentially matrix transposition", it's "take one from this then one from this"
i'm just sort of walking through my thought process as someone newish to python. of course i'm biased having started with C, so yeah.
You're probably just very used to it. I am too. But we have to see from the eyes of a beginner.
but you don't have to explain it in terms of theroetical math. it's just looping over more than one thing at once.
for x in str1:
print(x)
for y in str2:
print(y)
for x, y in zip(str1, str2):
print(x, y)
# vs
for i in range(len(str1)):
print(str1[i], str2[i])
I'm even more convinced than when I entered this discussion that zip offers a more natural learning curve.
Your confusion may come from the fact that the zip object is lazy, i.e. it does not hold all its data in memory right now. You have to iterate over it to get it to give up the goods.
so is range-len
Stelercus is suggesting teaching for-with-zip as a single unified concept, not a combination of for and zip as general mechanisms. That way you don't need to understand iterators and unpacking to use zip necessarily
Well range-len requires the sequence to already pretty much be in memory.
I can actually almost agree with this, EXCEPT that the student might be left pondering what this mysterious zip object is.
"It will be explained later when we learn about iterators and iterables"
they don't even necessarily need to know that zip is a type of object, any moreso than they need to understand how range works except how it behaves when it's in a for statement.
That is a good point.
"range lets me loop over sequential numbers"
"zip lets me loop over more than one thing in the same loop"
neither of these require that you understand the implementations of zip and range, or their behavior in any other context.
I've seen people (here) surprised that range isn't a generator function or that zip is a class (and not a function) after years of successfully programming in Python. So I think it's fine to have some suspension of disbelief in language idioms
beginners might not even realize that range and zip are types of objects. they would probably just see them as "the thing I use to write that kind of loop"
interesting. why is it a class?
even this embed #pedagogy message calls zip a function
Depends if you define a callable a function.
(the embed should be updated.)
I guess it was easier to make it that way in C
(Seeing how it takes in inputs and produces an output, I'm perfectly fine calling it a function even if it is a class.)
reversed is also a class, which is strange
Maybe something to do with them requiring dunders. Both zip and reversed do, I believe.
But iter is a built-in function and not a class, instead it uses a hidden iterator class to support the getitem-based iteration protocol
>>> class Foo:
... def __getitem__(self, idx): return 0
... def __len__(self): return 5
...
>>> iter(Foo())
<iterator object at 0x7f33166b0370>
>>>
The confusing bit is because calling reversed(...) doesn't always product an instance of reversed
>>> reversed(Foo())
<reversed object at 0x7f3316945330>
>>> reversed([])
<list_reverseiterator object at 0x7f331666f0a0>
>>>
it might be a matter of whether the object has a __reversed__ method
Yes, if the object has __reversed__, then the output of that is used and not wrapped in reversed at all.
!e
from collections import deque
d = deque([1, 2, 3, 4, 5])
print(reversed(d))
:white_check_mark: Your 3.13 eval job has completed with return code 0.
<collections._deque_reverse_iterator object at 0x7f81d9b4ac00>
sometimes there isn't a better answer than "it just happens to have been made this way"
So... how does reversed work if there is no __reversed__?
or "it's more idiomatic"
It uses indexing and len
And what if the object is an iterator?
!e
from collections import deque
d = deque([1, 2, 3, 4, 5])
print(reversed(iter(d)))
:x: Your 3.13 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File [35m"/home/main.py"[0m, line [35m3[0m, in [35m<module>[0m
003 | print([31mreversed[0m[1;31m(iter(d))[0m)
004 | [31m~~~~~~~~[0m[1;31m^^^^^^^^^[0m
005 | [1;35mTypeError[0m: [35m'collections._deque_iterator' object is not reversible[0m
Then it doesn't work
Got it, thanks lol
I'm now in that phase where I spam iterators everywhere
for thread owner's problem, I might have done
b = iter(str2)
for c in str1:
print(f"{c} {next(b)}")
hi sorry i was away
i saw there was a whole debate about how range(len isn't effective?
yes, just ignore that
what is zip
sorry, I thought we were in your help thread.
@long python open a new thread in #1035199133436354600 for your question.
ok
NOTES FOR READERS: This script has NOT been grammar checked, spell checked, or ANYTHING It was ENTIRELY written by ME! I just used speech to text on my phone which sucks like ALL the time!! NOT ALL INFORMATION IS ACCURATE! Some of it is just painted truthly to give a reason to an explanation, ra...
Hello @hoary gazelle , please explain what this is and how it's relevant to the channel topic. If it's not relevant, kindly remove it.
i was told to post it here my bad, lemme give a bit of a nexplination
Sure, but you should always give context when posting links. Don't just drop-and-run.
This is a DRAFT of a FIRST script for a tutorial series thats NOT like others, its gonna be heavily animated 2d/3d, for VISUAL reference. I want to teach in a different way for people who dont have normal knowledge of computers (like myself 10 years ago). being told to "isntall vs code" and python, then typing some words in what looks like a text file, while saying "a varible is like a container" is dog water (in my opinion). so instead i aim to teach by giving a more "under the hood" explanation. the first script introduces basic (required) computer science topics that are dumbed down (hopefully enough) to where people can understand it (if heavily aided with visual reference).
I want YOU GUYS to read it and give comment! (commeing perms is on in the doc). things that should be added / removed / rephrased. this is a "first draft" (i technically wrote this a few other times but this was entirely rewritten). maybe this is "too much information" or it badly pased. idk. hence why i want others to read it and give me there opinion.
Who told you to post it here?
nedbat
@queen heron i don't think the piano analogy is very good, they're trying to learn programming, not typing
nvm seems like we're on the same page
yeah, it's not about the physical action. It's about repetition
my issue was semantics, since it sounded like you implied that they have to retype the same thing over and over again, when it's more important to come back to that task later. But that got clarified later on
Good evening everyone, I made a simple visualization to teach statistics:
https://drive.google.com/file/d/1_8kxGrPSub4Cth5EZU-ESw7zLCxvcNci/view?usp=sharing
excuse me guys, what does pedagogy mean?
Its in the pins
k thanks
@upper flint which browser do you use?
A few things
- This is the #pedagogy channel. It is supposed to be about (from the channel description) "Discussion of the methods and practices of teaching"
- An off topic discussion is best for the off topic channels. We have three of them. They all start with "ot", like #ot0-psvm’s-eternal-disapproval , #ot1-perplexing-regexing , #ot2-never-nester’s-nightmare
- Why is my specific choice of browser important?
- I use Edge or Chrome
I'm thinking to restore running an online syncs for UI+coding, 1-2 times a week.
This channel is for talking about methods and practices for teaching Python and related concepts, so make sure every message in this channel is about that.
I was thinking of a different way to teach programming. One really big problem I've faced in school is that the teachers go way too slow, going over things that get people bored and are too theoretical. I think it would be good to have project based learning courses where you basically just give people a list of projects to fix going from super easy to moderate until they understand a language a bit. Then telling them to do something with that knowledge. Then teaching them to bug fix, the technical errors they make, the ways they could be more effecient, and so on. I think that could teach it way faster.
Hello, please read the description of this channel.
I teach Python in the context of drawing stuff (some people would say, creative coding), I use the py5 library https://py5coding.org because it has a solid 2D and 3D graphics infrastructure inherited from https://Processing.org (used by artists and for teaching since 2001...). For school labs on Windows I've prepared a portable Thonny IDE with all I need pre-installed: https://abav.lugaralgum.com/como-instalar-py5/index-EN.html
interesting, I should consider making something like this as a part of the course..
where do you teach?
@vestal axle your off-topic messages were removed
Personally, I find the project + minimal theory explanation style unhelpful. I need to know WHY and I don’t mind going into the weeds for it. There must be some kinda happy medium or something.
I’ve probably taken 4 beginner-intermediate classes like this from YouTube to LinkedIn and while I know a lot (relative), I feel like I know nothing anytime I’m faced with one of their challenges.
When I found Barron Stone, he was able to teach things in a way that related Python objects to real-life things. It was kinda corny, but it really was effective. I think what makes me gravitate to his classes is that he scratches my theoretical itches and explains more of the logical thought patterns you need to create code that solves problems (and yet, CoderPad remains the bane of my existence)
Are there recommended pedagogical approaches when it comes to teaching how to use a debugger like pdb? Should this start off with an introduction to the commands & then structured around certain types of bugs? or maybe structured around certain strategies like context grabbing by going up & down the stack while inspecting arg or local values?
So essentially, what would the structure of an ideal curriculum around this look like? or should there be more emphasis on inquiry-based learning & scaffolding, & what could this look like?
hmmm interesting
maybe it's just a pick your audience kind of thing
or potentially it's never been done right
It could also just be a 'me' thing. Perhaps the approach is fine and I'm just handicapping myself by not doing something else I should be doing outside of the course.
I considered that after I finished typing out my response but felt like I needed to wait on your reply to say anything lol
-# This server is kinda daunting and I didn't wanna risk being flagged for saying something unrelated to this channel, so by replying to you, I feel (at least I hope) I avoided this lol.
I have been on both side of the spectrum, where I go over the theoritical apsect of the topic, particularly, when it entails making decisions that may not be clear cut of fine tunning. but it is usually in somewhat advance course. For beginner course, the goal / project oriented seems more approachable.
I have tried the theorethical approach at a beginner course, it did not go well at all. It looked like it was way too much information than necessary.
For some people, it's the carrot and the stick approach, where they make soem progress, then, improve their understanding, and keep trucking on. Others will get lost in the weeds trying to understand everything. Of course we have the other spectrum of just brute forcing everything (probably not the best idea, but sometime works). I find that myself, I fluctuate between goal oriented, and understanding oriented even if there is not much of a goal.
This makes sense, thank you 🙏🏾
This def applies more nuance than I did—some things I feel require one approach and other things require another.
Like, if I’m tryna learn how to add this cool effect to some digital art on Procreate, I don’t need to know all the details as to why the “insert tool name here” does “desired effect”, I just need to know when/where to do it.
But for coding, I feel like without knowing the “why”, when it comes time for me to make my own projects, I’ll sit there staring at the blank IDE thinking “I know how to do list comprehensions and while loops, but how tf do I apply it to anything but these silly ‘quick brown fox’ ass examples I’ve seen for the past few months?”
I just think if more teachers would display real-world scenarios and WHY they chose to use the code they’re using in the moment, it would work wonders.
For example (just go with it, likely way off lol): In this lesson, we’ll discover list comprehensions. insert lesson here.
In my (specialty) career, I use list comprehensions to iterate through financial data that comes to me in a lists of tuples. The reason they come as a list of tuples is xyz and the list comprehension I use helps me to achieve abc in order to pass it on to the next developer who has to do def with it.
I hope any of that makes a semblance of sense but if not, I get it lol.
This makes sense, however, one might add, this can be done by using a forloop instead of a list comprehension, and same exact result with be returned. However, let's run this experiment. let's run 1million (example) of these with a list comprehension, and same with for loop, and time the executions.
Then, the studends would ask, why is the list comprehension taking less time than the for loop, even though they do the same thing?
This then increases the curiosity of the student, rather than you having to teach them about optimization, when they don't even see the point.
Ah, I see some projection on my part. Because I take online courses where the class is a series of short videos with no way to communicate with the teacher, I assumed you were teaching in the same way.
If you were able to have dialogue with the student, I think that would be effective bc yea, the student like me would ask why one method is faster than the other.
-# as a follow up, I’d likely ask for resources that further explain optimization if there wouldn’t be a lecture/class dedicated to it later
dang online coarses
Can anybody tell me how to be a good coding teacher
@drifting pelican teach me and I will tell everyone that you are a good coding teacher
Before you say anything to the student, on a per-sentence basis, make sure you understand their mindset, and only present ideas that connect to things they already get.
Everything else is just practice.
Hello i´m new here in the platform and i´m new programming
Welcome... #python-discussion is the channel to start in!
thank you!
help
…what is pedagogy?
check pins
My apologies…carry on 😅
I'm curious how people would go about dealing with teaching with a class where there's a huge disparity of ability.
Some with a sincere ability who'd like to make great progress and some struggling with mid level stuff and some struggling with basics, and severely disengaged.
If you have a class of 20 such students... what would you do?
remind me in what kind of institution you teach?
the students who are doing well: do you know if they have prior programming experience and are just coasting through your course?
ages 14-16
Prior experience... well not really, they're just a little more engaged really.
What I do is organize it around 'hooks' that the more-advanced students can follow to learn more, but focus to core on really foundational ideas. I taught a Ruby course for COBOL programmers once.
But pedagogy-wise... I struggle to see how to actually make progress that's going to be meaningful across the cohort
IMO no amount of focus on foundations goes wasted, and you can just stare at that from more angles
While letting some more-engaged or advanced students get extra credit for doing more
not for everyone though... that's the problem
I mean, you can just re-start your explanation from the perspective of Measure Theory, or how the CPU works with electrons, etc, IMO
There's always stuff unknown to each student
i'm talking about engagement and ability in python though
Well, figure out why they aren't engaging with Python, I guess is what I'm saying..
and to do that, I'd re-present the idea in various ways
I know why they aren't. They hate it.
are they forced to learn Python?
That's an outcome/desire/etc, not a reason
That's like saying you know what killed someone because they are dead.
I don't follow you.
Anyway - I was really getting at pedagogy and wondering if people have a split approach.
yes
You are describing an end-result, and I'm saying you should figure out the root cause.
They currently hate Python. You should try to learn why. I used to hate Python.
They feel like they're crap at it, and they'd rather go online and do some shopping, or play rugby.
Treat it like an incident post-mortem
Like in a very genuine way, it's insanely difficult and bizarre.
Meanwhile there are other students in the same class who thrive.
So... I know how to get the weak kids to be better, BUT I don't know how to do it at the same time as engaging the other half of the class.
Anyway, it doesn't feel like anyone wants to actually talk about the pedagogy side of it, which is what I'm curious to discuss.
Well, what specifically are you looking for? An interesting UK study I've had trouble finding today did a "pre-test" that sorted people into two groups; ones that had answered questions in the test consistently, even if wrongly, and ones who hadn't. The second group needed special instruction to do well.
So your student pool is at least biomodal.
Approaches to teaching this sort of group is what i'm looking for.
OK, there's my proposal then; pre-test to figure out which "type" of computer programming student they are.
That's nothing to do with pedagogy though
it would help figure things out further
?
If you don't think figuring out how your students learn to program is part of pedagogy, I don't know how to advise you.
personally my idea would be to introduce some novelty to engage people who usually don't
You're answering a problem I didn't pose.
I'm assuming this is some sort of classroom setting
See that's an interesting idea actually.
Ask for the result you want to see, not the process you think that takes already. Same as when asking about a software problem, IMO.
When I was that age I remember paying a lot more attention when there was something happening outside of the ordinary, something that wasn't an usual classroom activity