#pedagogy

1 messages · Page 11 of 1

neon pasture
#

Smalltalk was one of the first major OOP languages and is built entirely around protocols

silent goblet
#

JavaScript actually uses protocols as well, to some extent.

  1. iterator/iterable protocol
  2. toJSON
  3. toString
green warren
#

C++ concepts and type traits also let you do this (at compile time).

pure heron
#

Template functions in C++ in general are duck typed.

violet ore
#

does someone know anything to learn the basics of python because im a new one in the coding world?

buoyant tinsel
silent goblet
#

@buoyant tinsel that's... not the right channel 🙂

buoyant tinsel
#

Wtf.. sorry, fucking hate my mobile

#

Channel completion messes up

#

I'm so sorry, esoteric python is the last place to learn the basics shame

white bough
#

That would be a good sketch comedy, a young person trying to learn python by only reading #esoteric-python 😄

wintry pilot
buoyant tinsel
#

Sometimes on my mobile I get micro lag, causing me to click on random buttons etc, sometimes I almost end up sending PMs to complete strangers because of it

weak mortar
#

to be fair, i did read normal python resources too. but if you want to learn the complicated parts, #esoteric-python is the best channel.

vale grail
#

High everyone

#

Is anyone here interested in getting involved on working on a project

#

Preferably of you can use django

jolly night
molten abyss
#

If this channel is about teaching, then how do I learn about windows command prompt and directories and all of that for beginners

stone juniper
stable tartan
#

im making a menu driven program for shop management using python-mysql i have created a function for new account creation but i want the program to show data of existing user like login thing or something how to make that ?

stable tartan
#

thanks

fiery lynx
#

Is this the right channel to ask for a list of known 4 year colleges/universities that teach CS using Python instead of Java/C++?

wooden crown
#

Anyone know about web servers

stone juniper
wooden crown
#

Ok

fiery lynx
stone juniper
#

it's for discussion about how to teach CS

fiery lynx
#

Soo... not what to teach in CS? Just how?

buoyant tinsel
#

Both

buoyant tinsel
buoyant tinsel
#

I'm starting to think the channel name needs a change

misty dirge
#

Soo... not what to teach in CS? Just how?
This raises an interesting discussion topic

#

Topic: My theory of computation course discussed finite automata, push-down automata (PDAs), and turing machines. I think the course would have been a lot more pointed if PDAs were omitted entirely. Did anyone else take a course that was specifically about theory of computation? What did you think?

#

It also wasn't clear after taking the course how quantum computers would impact computation theory. I came away thinking that they were just high-performance computers that use physics shit.

#

and I the "does P == NP?" question was poorly explained. I didn't like that course 😠

calm roost
# stone juniper it's for discussion about how to teach CS

How to teach CS or how to teach Python?
Somewhat related but not quite the same.
I think there is a Python focus since this is a Python server. In a sense, CS topics come in from time to time, but there is a growth of teaching python without teaching underlying fundamentals.

Now I believe everyone has their opinion on the need for fundamentals, but the market is just reacting to the need for programmers

calm roost
misty dirge
#

@echo iron that question is off-topic for this channel. Refer to the resources page on our website (link in a recent post on #announcements)

stone juniper
misty dirge
# stone juniper I did, what's wrong with PDAs? Wdym by pointed?

finite automata and regular languages are relevant to regular expressions. And then Turing machines are the underpinning of what is computable. I don't really think PDAs are that important except to convey that there are models of computation more powerful than finite automata, but not the best known model.

barren hound
#

hey im new to python i was wondering do i have to have a UI to make the app work can i just make a shortcut that uses that specific script?

neon pasture
#

aren't quite a few parsers PDAs?

stone juniper
#

yeah

neon pasture
stone juniper
neon pasture
#

regular expressions for tokens, PDA for an AST, and a turing machine for the actual evaluation is the flow the course we have takes

misty dirge
#

Though lakmatiol's point about PDAs is news to me. So I guess this just speaks to the failure of that course.

stone juniper
#

that sounds like more of a curriculum/professor problem (my professor for this was great), although i think it's very easy to make very theoretical work seem unmotivated

neon pasture
#

to be fair, formal turing machines are mostly useless, you can just use a real programming language instead, whereas knowing FA/PDA is practically usable for parsing, since that's what most grammars describe

stone juniper
#

probably worth mentioning that i was a math student, so totally happy learning about something with no apparent use

orchid thistle
#

the question of what can be done with quantum computers is complicated

young kraken
#

I was thinking...
It's better to teach creating UI by Python UI Frameworks or teach basics of web dev and connecting to Python?

#

Hmm...
This second approach requires more knowledge

pure heron
#

It does, though it's also more useful in the real world.

misty dirge
#

Please check the channel description before participating in a channel for the first time. Thanks!

misty dirge
#

Topic: What are ways to teach difficult concepts that are fun for students? What's an example of a difficult concept, and a fun lesson/example that teaches it?

#

bonus if you can think of an example that isn't some aspect of OOP.

upper shale
#

rename channel to oop discussion when

tidal orchid
#

I suppose that data design & ""advanced"" usage of dictionaries+lists / json through the usage of REST APIs? (specially more complex APIs, returning not just a single dictionary, but rather alternating between lists and dictionaries at least two times or so)
trying to wrap your head around heavily nested data structures is always a ~~not-so-~~good time for beginners

buoyant tinsel
buoyant tinsel
#

Well, let's say it: android app

#

Mobile app with python

#

That's hard

#

It shouldn't be hard though

#

So that's where a good portion of the focus should go, imo

#

Also has nothing to do with OOP specifically, just incidentally

rich mural
#

Writing a Discord bot might be a fun way to learn about asyncio.

tidal orchid
#

eh... not really imo
the library just hides it all under the hood, you don't even have to start it yourself via asyncio.run() or alike - that's like saying that using Flask is a good way to learn about threading.
You only notice it when it makes a difference, but in that case it would be better to just ignore the discord part and focus on what is making a difference for you to need to use async stuff yourself

rich mural
tidal orchid
#

well... I learned about it scraping data from multiple URLs at the same time (with explicit permission from the website owner), in which I had to use aiohttp + asyncio.gather(), but that is a bit of an unusual project

rich mural
#

I don't think starting asyncio is a very important aspect of asyncio, also.

#

Though I guess you don't generally need to use asyncio in a very complex way, unless your bot does asynchronous I/O in itself, like calling APIs or something.

midnight breach
#

Are questions about PEP8 welcome here?

ripe folio
#

I am not sure what other practical application I might be looking for though

tidal orchid
ripe folio
#

It's still a pretty good practice to learn about blocking the event loop, using await and async def as well as the occasional task you'll most likely run into.

#

Although I do somewhat agree with you, many libraries hide too much of the event loop.

tidal orchid
buoyant tinsel
#

I'm repeatedly baffled by complete newbies who want to start learning python by building a discord bot

#

I have no idea where they got that idea, but at least it's a good drive to get into all sorts of programming concepts

#

Building a mobile app would be even more useful for most people.. something like a sports tracker

#

But I guess we 'oldbies' need to put a lot more effort into making that much more approachable

cosmic aspen
buoyant tinsel
#

I don't want to believe it's the same mess as last time I tried, I'm hopeful there has been some developments to make it easier now

calm roost
buoyant tinsel
#

But qt isn't exactly beginner friendly, from what I've seen

#

Dunno

cosmic aspen
#

Text user interfaces or TUI best bet for beginners

#

It may lack the polish of a GUI or a web app but you can do alot with a text only interface with file handling and even perhaps database access.

calm roost
#

If text is fine then argparse probably works

cosmic aspen
#

I learned to program first with text interfaces and pixel based GUI in the late 80s and early 90s with GWBasic, QBasic, Pascal, C, C++. It was fun and quite approachable for beginners

#

Many a complicated sprite based games have been coded in basic

#

Some even use peek and poke to do memory location read and write and bload and bsave for loading and saving to whole chunks of memory locations

#

The computers back then were slow so it was necessary to resort to such tricks

#

Also did inline asm in C and Pascal lol

#

I think Pygane is a good entry for this generation or ursina

#

Game programming is inherently motivating especially for kids

unique oak
#

well, I actually used threading because async wasn’t super a thing then, but same idea, kinda

misty dirge
waxen fox
#

idk that was just the first thing to come to mind haha

#

hm for concurrency, since it's the illusion that multiple things are running at the same time when in reality it's one by one.. something interactive could be like giving say two cookies, and asking people to find the most efficient way to finish both

most people can't eat it at the exact same time, but one bite from each will be a lot more efficient than finishing one and starting the next one

#

And feel free to correct me if my idea of concurrency is wrong

ripe folio
#

Hmm, that's not quite how I would paint up event loops in Python.

#

Chewing and swallowing represents the I/O. This gets faster if multiple people are eating because when one is chewing the rest can take a bite.

#

Threads is if everybody gets 1 second to bite, chew, and swallow the cookie with a timer - passing the cookie around as necessary. When your 1 second stops you can't keep chewing or finish taking the bite. Although that's not really a perfect model

buoyant tinsel
#

You can either focus on one task, finish and then finish the other

ripe folio
buoyant tinsel
#

Or you can switch between the two like with ADHD

#

That would be threading

ripe folio
#

Hmm.. sure yeah

buoyant tinsel
#

If you get another person to help with one task, you get multiprocessibg

#

But it also shows that you can't throw many more people at those tasks to speed them up and actually ar

#

are wasting time handing paper and pencil around

#

async in python would be like 'finish a sentence or calculation, then switch'

#

Instead of 'switch every 5 seconds, exactly'

ripe folio
buoyant tinsel
pure heron
ripe folio
#

In that light, yes the end of a sentence is a nice place to cooperatively switch - but not how I think about async. In an async program you wouldn't yield at the end of a sentence because I don't see that as any form of waiting

pure heron
#

Sure, the analogy isn't perfect.

noble aurora
pure fog
#

that's concurrency, even though you're not really "doing" two things at once

#

although washing hands + talking to coworkers can be parallelized, in that you can literally do both at once

#

but the others you can't really do simultaneously, you can just "schedule" them by switching among them

#

i guess you can check reddit and talk to your coworkers, but that's rude 🙂

upper shale
buoyant tinsel
pure heron
#

"nine women can't have a baby in a month" is a humorous way to point out that tasks aren't infinitely parallelizable.

buoyant tinsel
#

Oh, right

#

Now that makes sense. I was wondering what women and a baby have to do with passing papers and pencils and homework

fleet pulsar
cosmic aspen
misty dirge
#

In my opinion, f-strings are the only approach to string formatting that should be presented to beginners. I think this is a circumstance where presenting them with options is too confusing (why is there more than one way to do it? ||is this actually perl?||) for how early in ones education the question arises. What do you think?

#

(and not that anyone is going to argue in favor of it, but chained string concatenations with + are code gore. I saw someone yesterday whos instructor was making them do it like that and now I'm upset about it all over again.)

tidal orchid
#

I generally think that it is better to present all reasonable options, but stick to using one - in part since they might encounter others later and be confused over it.
It's not like format() is much more complex, and they may have to resort to searching for format()'s mini-syntax when working with f-strings anyway

silent goblet
#

I would prefer teaching .format because

  • It can do everything f-strings can ||(ok, except =)||
  • It builds on already existing concepts: strings and method calls. No new syntax needed
#

Maybe you could even teach how to built your own simplified version of format (not when teaching it, but some time in the future).

misty dirge
tidal orchid
#

string concatenation should be taught, but definitely shouldn't be used for formatting
% formatting and anything referencing it can burn for all I care for though

misty dirge
#

it's the only way you can do string formatting for bytes 😛

silent goblet
#

some people disagree that f-strings are best practice

misty dirge
#

I challenge them to a duel ⚔️

#

what is their argument for that, anyway?

silent goblet
#

I personally think that f-strings make it easy to put complex expressions inside of an f-string. And they can become gradually more complex over time.
I would be fine to sticking to f-strings in a team if there was a linter rule (enforced in CI) disallowing complex expressions inside of them.

#

"Complex expression" meaning that only these are allowed:

  • name lookup (f"Hello, {name}!" ✅ )
  • attribute lookup (f"Hello, {user.name}!" ✅), but not too deep (f"Hello, {session.user.address.street.name}" ❌)
  • (maybe) index lookup with a constant (f"Hello, {user['name']}!" ❓), but I'm not sure, because this is putting a string inside of a string, and also forces to use a different quotation style
queen heron
#

I think starting with concatenation is a must. It's a necessary evil even thought it will quickly be replaced with other formatting

#

It forces beginners to understand that different data types behave in different ways

#

I personally use format 90% of the time, but largely because I'm jumping between py 2.7 and later versions. That being said, I like the benefits that .format offers with argument unpacking, or repeating arguments (not that those are necessarily beginner friendly)

#

filepath = r'creatures\{0}\game_files\{0}_moveset'.format(asset_name) as a practical example

cosmic aspen
#

For a beginner trying things out without guidance i think string concatenation is easier to discover since less additional syntax is required. Eventually they should move to format or f-strings once they dig deeper or notice the messy nature of string concats

#

I learned Python on my own and that was the sequence

untold island
#

I think it's true in some aspects of programming as well.

#

for example, ten architects can't design a system in 1/10 the time that it would take one architect

#

some companies do not aclnowledge

#

even for multiple developers, there will be lots of churn, conflicts, stepping on each other's toes, and reverted code, if multiple developers (let alone 10) are trying to work on (or especially refactor) the same file.

#

that's been my experience, anyway.

pure heron
#

I've also heard that if one developer can do a task in two days, then two developers can get it done in a week.

untold island
#

that's closer to the truth 😄

cosmic aspen
low carbon
#

I have a date slot in string (12hrs) format eg - "2:45 PM" and a time period to when this slot ends say 15 (mins). So time slots starts at "2: 45 PM" and ends in 15 mins. I want to show the ending time in the same format as time string in 12hrs format.

Example - Slot: "2: 45 PM", ends: 15
endingSlot will be "3: 00 PM"

white bough
#

Idea

Either remove the programming- from the channel name,
or
not only remove the programming- from the channel name but also rename it to something like epistemology or so and have the explanation in the sub-title.

currently when people enter the server, this is the top most channel that has the word programming ||(a word that most people will immediately recognize and focus on amidst the chili, kiwi, something-pep and the weird off-topic names)|| in it and also probably to a lesser impact a word that can be misunderstood as teaching happens here.
The word pedagogy is also cut-off to pedago on my desktop at least.

I think these two things ( more the programming-) funnel many people looking for help, immediately into this channel.

/Idea

fleet pulsar
#

cs-pedagogy?

#

I think "pedagogy" expresses the purpose of the channel very well, but "programming" in front of it does funnel in some people who don't read further

#

cs is a wider term than programming, but it's not as much of a buzzword, at least imo

silent goblet
#

People who will not read stuff will keep not reading stuff IMO.

#

But yeah, CS seems kinda better

fleet pulsar
green warren
#

The only way to prevent it is to move this section of channels below all the other Python topic channels in the list. We've had this discussion many times in the career channel.

silent goblet
native hearth
#

Could stand to be a bit stricter than that, why would people care if there's no punishment, just people telling them to move

green warren
#

We could just move the channels way down in the list and cut out most of the noise. I don't think this discord has a very obvious "landing pad" for new users, especially since the method of asking for help is quite counterintuitive (although I understand it's necessary since the discord is so big).

cosmic aspen
#

China has one lol the social credit system

green warren
#

I think punishments are silly, and imagine having to get the mods' attention every time someone drops in here.

cosmic aspen
#

Yeah we dont want to be China

#

(Apologies to Chinese)

native hearth
#

If you move these channels down some other channel will take their place, there needs to be a stick along with the carrot, some sort of punishment for people agreeing to the rules without reading them and then ignoring them

green warren
#

They'll end up in #algos-and-data-structs , it already happens a bit. I mean there's no magic bullet that will stop people from posting off topic. Cleaning up messages requires a mod's intervention. This is what already happens when possible.

white bough
#

Maybe just have the rando-help messages deleted her, it would at least make it more readable.

We are already talking over each other and having five conversations at the same time because of the medium we are using ||(Fuck I hate discord, who thought this was superior vs an bulletin board with Threads and stuff? I think I am old...)|| more messages in between does not make it easier. A single help request will automatically lead to 1-3 go here for help-messages.

Finally I can move this to #community-meta if wanted and feel free to delete my messages or tell me to delete my messages, as I seem to not be able to chose the right channel either and kind of doing off-topic ,for this channel, here also 😄

native hearth
#

Cleaning up messages doesnt need mod intervention, for example #black-formatter people have message management perms apparently and theyre not mods
And yea we should move this to meta

misty dirge
#

Why did this turn into a meta discussion about the channel name? That belongs in #community-meta. Please resume on topic discussion; do not even acknowledge this message.

oak breach
#

How much of a language's standard library do you think should be taught to students, and how much of it should they be left to discover on their own?

(Assuming they have already picked up the core concepts of programming (control flow, loops, etc))

native hearth
#

i dont know about "taught" but i would definitely appreciate being made aware of itertools, functools, collections and a few others back when i was learning

#

ie once you teach dicts, you could go over a couple common problems solved with dictionaries and how defaultdict or Counter fit in there

waxen fox
oak breach
#

anecdote incoming
java was (is) the language my school taught me and the only thing we ever used from its stdlib was a Scanner class, and that was just for reading stdin

we weren't taught about any of the collections for example - i discovered that java has lists and sets and hashmaps and stuff like that only after i picked up python by myself and wondered if java had them too. because i didnt know about lists, i wrote quite a few programs where i would basically copy over the contents of an array to a new array larger/smaller by 1 every time something was inserted/deleted

#

i think i agree that you should at least be made aware that tools like these exist, even if you're not taught about them in detail

buoyant tinsel
#

There are a few more I'd add to the 'things you should've heard of'-list

tidal orchid
buoyant tinsel
#

Namedtuples, deque, heapq, functool decorators, itertools combinations, pprint, statistics

#

Those are very situational tools, but you should know you have them at your disposal

tidal orchid
#

I'd leave deque and statistics out
and I do not even know what heapq is so probably that one too

buoyant tinsel
#

see? lemon_fingerguns

tidal orchid
#

are these queues significantly faster than just using lists?

buoyant tinsel
#

Heapq and deque are very basic datastructures you can implement in other ways, but it's nice to have them

fleet pulsar
#

heapq has a pretty limited use imo, you should be made aware of it, but not actively taught; iter/functools, though, may need a deeper explanation, as they are immensely useful

#

[for beginners]

buoyant tinsel
#

Heapq is mostly used for priority queues

#

With efficient sorting in place (logN, iirc)

neon pasture
#

I do think that pprint and even repr are underused.

green warren
#

I think itertools is pretty important. A lot of stuff in there people will end up implementing by hand, inefficiently, if they don't know it exists.

neon pasture
#

yeah, there are some fairly useful things there with regards to combinatorics, though a lot of it should just be a for loop.

misty dirge
buoyant tinsel
#

Pathlib.

#

No question for me

fallow terrace
#

I'd say pathlib, with a stray mention of os.path

noble aurora
buoyant tinsel
#

It's the ds you want if you want exactly this behavior

noble aurora
noble aurora
#

it's a queue how are you gonna get the rest out then

keen moat
#

If you just want to see the min/max at a given moment you can just look at the first cell

noble aurora
#

you don't need a heap for that

#

you can do that in constant space with a normal variable

keen moat
#

The point here is that the ds is dynamic

#

So removal and addition is logn but it's always sorted when you need to read it

noble aurora
#

but if you only need to know what the max is, you don't need a heap

keen moat
#

At any given moment, not just once

noble aurora
#

sure, each time you get a new element, update the max if you need to

#

if new > max: max = new

keen moat
#

Not sure I understand. When you remove an element in this way you won't know what the previous max was

noble aurora
#

but you said you didn't need to remove anything

keen moat
#

I didn't?

#

I said you could look without removing

noble aurora
#

sure

#

you can peek the max/min in constant time

misty dirge
misty dirge
oak breach
#

is functools really that interesting pithink i've only need @nocturne jetty and partial

#

fuck

#

sorry Cache

tidal orchid
#

functools.wraps is useful (if not essential) for decorators

oak breach
#

hm true

tidal orchid
misty dirge
#

||Apologizing is weakness.|| I like functools.reduce (and I wish map and filter were part of functools), but it's not something I'd cover until a course about programming paradigms.

keen moat
#

I think there're a lot of useful things in the stdlib, but very little that is actually necessary when learning to program

misty dirge
#

inb4 taking what is "necessary to learn to program" to the absurd conclusion that we should all write in Brianfuck.

oak breach
#

heh

misty dirge
#

but I agree in that the core skill of programming is formalizing your thoughts, and you can do that in any language, without necessarily using everything it makes available.

silent goblet
#

If you use everything it makes available... We all have that colleague

waxen fox
silent goblet
#

IMO "Priority queue" is a huge misnomer

#

it's not a queue in the colloquial sense, because it doesn't respect insertion order

fleet pulsar
#

That would largely depend on your definition of "queue", I guess. "Queue" tends to be used to refer to a FIFO queue specifically, but it makes sense to me to generalize it to "A container that is able to receive an arbitrary amount of arbitrary items and order them in a very specific way" (after all, IRL queues aren't always FIFO either, a fair amount of them have special rules in place that complicate the logic or even eradicate the FIFO element completely)

#

I will admit that I do not know the "official" (ig) definition of "queue", this is based exclusively on the experience I had learning programming

#

Treating a queue as "something that orders its contents" makes a priority queue the default, and a fifo/lifo queue a more narrow variation that uses the insertion time to prioritize values

#

tl;dr, my empirical understanding of "queue" in general (not only in regards to programming) is "something that defines consumption order for a bunch of items"; a traditional fifo queue is just a variation that prioritizes values based on their insertion time, and a traditional priority queue is one that orders based on values themselves

stone juniper
#

mathematically it makes sense to call stacks and queues two special cases of priority queue, but the way stacks and queues are usually taught is closely tied to their implementation, with a focus on which operations they support in constant time

#

for this it doesn't make sense to generalize them like that (nor does it make sense to call a priority queue a type of queue, although by then students probably aren't in too much danger of getting confused)

little burrow
#

Is there a genuine use case for hashmaps in python? If so, what, and why?

silent goblet
little burrow
#

Yes

silent goblet
#

Dictionaries are implemented as hash maps.

little burrow
#

Ohh my bad, I thought there was a literal type called hashmap lol

silent goblet
#

By the way, this is a channel for discussing how to teach Python and programming in general. This is not a help channel. If you have a normal Python question, you should see #❓|how-to-get-help and claim a help channel.

little burrow
waxen fox
#

Do you all think it's okay to lie about something to avoid confusion? Like for example, in my Python class the teacher said "exceptions are keywords" because the class didn't know what classes were yet

fallow terrace
#

I'm okay with lying about some stuff, but that seems a little too far

waxen fox
#

Yeah I agree, I was going to point it out but I didn't want to correct the teacher haha

fallow terrace
#

I'd just say "This is actually a class, something we'll talk about later on. Don't worry about it, it'll all make sense later"

noble aurora
#

why not just say "it's a class like a list or whatever we've talked about before"

misty dirge
fallow terrace
#

How do you always avoid that? Many things are defined circularly in my experience, completely avoiding that seems difficult.

misty dirge
#

I don't know that you can always avoid it. Can you think of another example?

pure heron
#

I'd much prefer half truths over lies. You might need to explain the exception hierarchy to someone who hasn't learned the concept of subclassing yet, but you can hand-wave it away by showing them the exception hierarchy from the docs - https://docs.python.org/3/library/exceptions.html?highlight=valueerror#exception-hierarchy - and saying that you can use the name of any of the types as a shorthand for the list of all the types under it on the tree

fallow terrace
misty dirge
buoyant tinsel
#

in this case maybe type() and a link to the docs about exception hierarchy

ripe folio
#

Oooh, from looking at another server I read someone claim that "Assembly is easier to wrap your head around". What do you guys think about teaching people assembly first to get into programming?

The argument would be that it's a natural next step from those code games were you have to say like "move forward", "rotate to the right", "move forward", "move forward".

#

The point isn't to learn full Assembly, but rather to get into writing imperative code for the computer.

#

It does everything you say, and nothing more or less.

#

Teaching simple math operations in Assembly as a first step, then once the class understands how to write instructions to the computer you can move on.

#

Another big argument for teaching Assembly is how simple the syntax is, there's nothing to it.

stone juniper
#

strongly against, the reason those code games work for beginners is that they're essentially a DSL for something they care about: making a little guy move around the screen

#

whereas assembly is a DSL for changing what number a register holds

misty dirge
#

define DSL?

stone juniper
#

I think making beginners do simple math operations with assembly is a way to make most of them quit before they can do something they care about

stone juniper
ripe folio
#

It's not meant to be a big chapter, but having a lesson or two just for understanding what instructions happen and get into the habit of writing imperative instructions

misty dirge
#

I think assembly is too far removed from anything a beginner would do for it to have any value for them, but I can appreciate wanting to have beginners start by writing very imperative code.

#

As a lesson in "the computer will run the instructions you give it and won't wonder why, or figure out what you meant if they're wrong".

ripe folio
#

It could help understand how a computer works tying into previous lessons about the different parts of the computer and how "it works in 0s and 1s"

green warren
ripe folio
#

I get that Assembly itself will transfer to little knowledge about how modern programming works, so I agree with that

ripe folio
#

I wasn't thinking like "Hello, welcome to Python Discord please write this 10-line Assembly"

#

😅

stone juniper
#

I'm someone with a strong math background who is motivated by puzzles and writing the code itself more than what it does, so I should be in the target audience for learning assembly, but even I found it incredibly boring

ripe folio
#

Yeah definitely depends on how you structure the lesson

#

I would oppose say a homework in Assembly, or deeper reading.

#

The vision I see is like an interactive lecture where the teacher is standing at the front and asking the class questions and going through it with them.

#

Like a more serious example of this:
https://youtu.be/cDA3_5982h8

Have you guys seen it before?

Exact Instructions Challenge PB&J edition
Another Challenge with Johnna and Evan: https://www.youtube.com/watch?v=sLaVM6af-RE&t=121s

We asked the kids to write instructions for a simple task but left out that we were going to be following their instructions EXACTLY as written. Great lesson for communication and a fun practice in patience!

Plea...

▶ Play video
#

(edited to the real author's video for correct credits)

wintry pilot
pure heron
stone juniper
#

I was about to make the same point, one of my friends took an intro class at CMU and they did exactly that

neon pasture
#

I fail to see how you could possibly make assembly interesting to beginners. you can only do low level and only vaguely sensible IO operations. There are better tools for teaching imperative programming where you can see the effects beyond just "look at how registers change values".

ripe folio
#

So yes I think you should have students play those games as well

#

Not sure if it adds much

neon pasture
#

the problem here is just how complex a modern CPU is. Assembly doesnt actually get evaluated from top to bottom linearily, one instruction after another, you have pipelining, registry renaming, transpilation, ...

ripe folio
ripe folio
neon pasture
#

you could probably use some older CPU, IK 6502 assembly is fairly accessible, but why teach assembly if you cant even run it.

#

What may be more interesting in this regard is giving the student an FPGA and a xilinx ISE license and having them write their own instruction set that way. But that is quite difficult, though I know a few people who managed simple instruction sets after only a semester of VHDL

untold island
#

some assemblers are very simple as well

#

you can build that yourself

gentle oriole
#

I think England's CS exam boards could learn a lot from looking at this channel

wintry pilot
#

didn't do this in A-levels but I did in GCSE

fiery lynx
gentle oriole
#

I think the ARMLite version is much better (https://www.peterhigginson.co.uk/ARMlite/), has more registers than just "the almighty accumulator", including a status register. Also has a bunch more instructions. LMC is a bit oversimplified imo

#

sort of off topic though haha

misty dirge
gentle oriole
#

LMC stands for little man computer

somber echo
#

Can anyone suggest me how to learn python by doing projects?

buoyant tinsel
worldly dewBOT
#

Kindling Projects

The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

misty dirge
waxen fox
#

on the topic we had earlier about teaching parts that their overall concept hasn't been introduced yet,

would you all say it's fine to say teach about @classmethod and @staticmethod before people know the concept of decorators?

#

eg in my python class we started learning about OOP so we touched on classmethod and staticmethod but we hadn't learned about decorators yet

#

Yea we go quite fast tbh, went from the concept of classes to classmethods and staticmethods in <1 week

#

though we had an assignment to incorporate all three types of methods (methods, classmethods, staticmethods) in a plausible example which was hard for most people because staticmethods really don't have much use compared to classmethods

waxen fox
oak breach
#

giving a general gist of what decorators do (take in a class/function, sprinkle magic dust on it and return a function/class) might be a good idea

#

descriptors are probably overkill

waxen fox
waxen fox
# oak breach descriptors are probably overkill

though ngl, i wish once the class as a whole got to a more advanced point in OOP, so towards the end of an OOP unit, they'd teach about descriptors and how they play a role in instance methods, class methods, etc.

#

for the longest time I thought that instance methods were just black magic

oak breach
#

also, how were staticmethods introduced 🤔

#

they're basically useless lol

waxen fox
oak breach
#

yeah

waxen fox
#

something along the lines of "this is just a function in the class's scope and isn't bound to a class or an instance"

waxen fox
#

at least classmethods have uses, like an asynchronous constructor

buoyant tinsel
#

in the past i thought staticmethods were useful grouping functions together instead of having everything global

#

then i tried to decorate them..

#

now i'm avoiding them like the plague

waxen fox
buoyant tinsel
#

oh god, shut up

#

it's such a mess

waxen fox
#

i'm guessing you had to make a whole class that implemented the descriptor protocol + whatever you wanted to add just to decorate it o_O

buoyant tinsel
#

there's that pipe package on github i love to add pipes in python, right?

#

you can decorate any function with @pipes and you can do stuff i like foo >> map >> print etc

#

the way it works, it modifies the ast...

#

now try that with staticmethods

#

i nearly cried when i had to completely refactor everything

#

(and not just for this decorator)

waxen fox
buoyant tinsel
#

yeah, exactly

#

classes are overrated 😉

waxen fox
#

This reminds me of another topic too; should Python classes teach OOP design?

buoyant tinsel
#

tbh, i had trouble getting the order right with those decorators

waxen fox
#

and not overuse it / underuse it

buoyant tinsel
#

is it ```py
@decorator
@staticmethod
def foo():...

or is it
```py
@staticmethod
@decorator
def foo(): ...
#

so.. i wouldn't even try to teach that

waxen fox
#

"a function that wraps another function and returns a function that replaces the original function"

buoyant tinsel
#

"which can return another function if your function is a function in a function"

waxen fox
#

ah wait, reading back i meant more along the lines of "OOP concepts"

misty dirge
#

We've been getting a lot of questions in #data-science-and-ml about jupyter notebooks vs pycharm, which are itself based on a misunderstanding about the relationship between the editor and the interpreter. How can we help beginners overcome this misunderstanding?

green warren
stone juniper
silent goblet
#

Tutorial often lump two things together: 1) higher order functions; 2) the decorator syntax (with @).
I think it's a big mistake. I've seen quite a few people here get confused as a result of this.

#

The first part of the tutorial (which should not mention the @ syntax at all) should teach higher-order functions and passing a function as an argument. Some good examples would be:

  • event handlers, where you pass in a function as an event listener
  • reimplementing map, filter, sorted, min, max
  • finally, closures:
    - start with something simple, like an adder function which is just +, but curried. This will teach about closures
    - then move on to functions which take a function as an argument and return another function
#

Now that the person understands how higher-order functions work, @-syntax can be explained.

pure heron
#

I agree.

tidal orchid
#

are we speaking about some specific (kind of) tutorial, or just which order things should be taught?

fallow terrace
#

I very much agree with that. The @ syntax is so much more complicated to grasp to start off.

#

Not because the syntax is bad, but simply because it gives the impression that the only way to use decorators is with the syntactic sugar.

#

That's a misconception I had for a long time.

#

Also, side note, but I really like tutorials that have you reimplement something that already exists (in e.g. the standard library) in order to comprehend what it actually is better, it's very helpful (once you know the basics of the language, of course).

misty dirge
fallow terrace
#

I haven't seen much of that with Python (not that I've gone through a lot of tutorials for it), but I encountered that in an OCaml book and it made the "black magic" of things like map much less-magicky and more approachable.

pure heron
misty dirge
#

You're not wrong shrug2

stone juniper
#

i didnt mean to get to into the weeds on decorators specifically, i was just saying that there's a type of lie that you use to hide complexity that i think is good teaching practice

misty dirge
#

!otn a the weeds of decorators

worldly dewBOT
#

:ok_hand: Added the-weeds-of-decorators to the names list.

pure heron
#

!e ```py
@print
class HelloWorld: ...

worldly dewBOT
#

@pure heron :white_check_mark: Your eval job has completed with return code 0.

<class '__main__.HelloWorld'>
silent goblet
#

!e

@print
@hex
@len
@dir
class HelloWorld: ...
worldly dewBOT
#

@silent goblet :white_check_mark: Your eval job has completed with return code 0.

0x1a
silver light
#

how can i lear to code ?

#

*learn

fallow terrace
buoyant tinsel
cosmic aspen
#

Lol same

buoyant tinsel
#

there's one other very interesting aspect of higher-order functions that are often overlooked are closures

#

where you have a kind of initiation phase and a work phase

#

that way you factor out some heavy calculation you'd have to do every time, calculate it once for a set of parameters and have minimal repeated work later#

cosmic aspen
#

Good for optimization .. i precalc when I can

buoyant tinsel
#

i think one of the most if not the most confusing aspect of stacking @decorators is the reversed order

#

everything in python is evaluated from top to bottom.. except..

#

that's also what i hate about the pipes package

#

i don't like it because the order in which things are evaluated requires you to jump back and forth with your eyes

#

same with decorator syntax - you're reading from top to bottom, but to understand the order of evaluation, you need to first read to the bottom, then back up and then down again

oak breach
#

well that applies to things like

f(
  g(
    h(x)
  )
)

too

buoyant tinsel
#

yeah

#

with that you can do ```py
x

h
g
f

drowsy delta
#

Hey

orchid thistle
#

observation: i feel like i've sometimes seen beginners writing code like this py x = '5' # take input or whatever int(x) # convert it to an integer print(x + 1) # it's an integer now

#

aside from badly written type conversions this also happens with str.replace

#

any ideas on how to do a good job at explaining the difference between changing a value (like you would have to for that code to make sense), and constructing a new related value (what it's actually doing)?

desert patio
#

just that the latter is probably a subclass of the former

orchid thistle
#

um, no they're not

#

if you construct a new value the original one is still there

#

if you mutate something the original is gone now

silent goblet
#

it also just randomly introduces garbage collection for no reason...

desert patio
desert patio
orchid thistle
#

doing py x = '5' int(x) print(x + 1) doesn't work

#

!e py x = '5' int(x) print(x + 1)

worldly dewBOT
#

@orchid thistle :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 | TypeError: can only concatenate str (not "int") to str
desert patio
desert patio
oak breach
#

i dont think that's enough, you have to introduce mutability/immutability

#

"how come list.append works without that then?"

buoyant tinsel
#

yes, exactly

#

you need to make the distinction of operating on an object and building a new object, basically templating

#

i couldn't find the right word

#

operating on an object vs. from an object?

#

we had that mutability/immutability topic before

#

back then we had trouble finding a good example and struggled with tuples vs lists

#

maybe int(x) is a good one

keen moat
#

I don't think it's accurate to say it's because of mutability. You have the sorted function which works on mutable objects, but the value needs to be assigned somewhere

#

It really is just knowing which functions work in-place and which don't

desert patio
#

in-place can describe it all i think

noble aurora
buoyant tinsel
#

always annoyed me

#

they could return the same object

#

then it would be possible to chain those calls

oak breach
#

i still think itd be appropriate to introduce mutability right then

#

like, "if you know an object is immutable then its not possible for it to have in-place functions. if it's mutable, it may or may not be in-place"

buoyant tinsel
#

yeah, me too. you don't even need to call it "mutable" but rather "works in place" or "changes the object" vs. "makes a new object based on the input"

ripe folio
#

Maybe the issue is how int() is taught (well, for this example). It's usually taught as "converting" something into an integer, almost like in lower languages where you "convert" something (although that's a different process).

If you instead say that int() will create an integer from the input (instead of converting the input to an integer) it'll probably be easier to understand that you need to assign int()'s return value.

buoyant tinsel
#

yeah, we need to be careful about the phrasing. maybe we can even use the precise term "constructor" for int() etc. even though it looks like a function

#

that's where python's std type convention being lowercase is problematic

stone juniper
#

I try to remember to say "creates an integer" or "gets an integer from the string"

misty dirge
#

I don't know that being precise about "convert" vs "creates from" matters when discussing immutable types, though I can see it becoming necessary when you start switching between container types.

pure heron
#

if you explain things like int using the terms that you would use when teaching the students def, you can lay the groundwork for that future lesson without them realizing it. "When you pass a string to int, it returns the integer corresponding to that string"

silent goblet
#

just teach that int and str are normal functions, like abs or input or print

winter spear
sage jasper
#

what about the use of the word "casting"

#

is that inaccurate?

silent goblet
#

@sage jasper Yes

winter spear
sage jasper
#

what's an accurate usage of the word "cast" in python?

silent goblet
winter spear
#

Casting is an implicit operation in C

silent goblet
#

"casting" refers to reinterpreting a value of one type (like uint64_t) as another (like double), or asserting a more specific type (e.g. if you have a type Animal, you can "cast" it to Cat. If it is not actually a cat, well, it depends on what language and particular feature you use)

#

this term is sometimes incorrectly used to name callable such as int or str

sage jasper
#

yeah I've noticed that

noble aurora
#

it's probably just inherited down from teachers who used to teach other langs

sage jasper
#

I've also heard "casting" a lot when referring to SQL

silent goblet
#

also movies 🙂

sage jasper
#

though in SQL it's a legitimate function name, right? I think

pure heron
#

I don't think I ever use the word "cast" when teaching Python. At least, not consciously 🙂

#

I try to go with something like "You're getting that error because you tried to do arithmetic on a string. You need an int instead, so you need to call the int function to get an int from your string."

stone juniper
#

this channel is about how to teach programming, and we don't allow offers for paid work on our server

weak mortar
#

Hey can someone pleasee help me with code for ascii art in python. It would be great help🙏

stone juniper
#

unless their solution is so terrible as to be unworkable, I would help them get it over the finish line and then ask whether they would like to see "how I would do it", or "a better way to do it"

#

and then explain how that way works too of course

rain plume
#

probably get more attendance if they change the date

buoyant tinsel
#

boolean expressions is an interesting point

#

would you show truth tables etc. to a newbie?

oak breach
#

its one of the first things we covered in our cs class

buoyant tinsel
#

does it help or do you think it's confusing?

oak breach
#

i think its quite helpful

#

having a condition like x != 1 or x != 2 is a pretty common mistake

pure heron
#

I show people truth tables without explaining what truth tables are or calling them "truth tables". Just a slide that says something like:

a and b is True if both a as well as b are True.

If a is | When b is | a and b is
False | False | False
False | True | False
True | False | False
True | True | True

#

That is, I give a prose explanation of how the operator behaves, and then use the truth table to illustrate what the prose explanation is trying to say, without ever calling it a "truth table" or explaining how to read it

untold island
#

what is the difference between CAST() and CONVERT() in sql

#

the syntax is pretty weird:
CAST(expr AS type)

#

well not being an imperative language, I guess they (standards bodies) can structure SQL's syntax however they like. I'd hate to imagine how horrible it is to parse. especially a dialect that allows arbitrary statements, loops, etc. yikes.

crisp stag
#

Hey I am currently reading "Automate the boring stuff wit python" but I want to at some point learn how to do something with machine learning. What do you think a good next book to read would be?

buoyant tinsel
fallow terrace
#

@fair steppe This channel is for discussion about teaching programming, not learning it. If you need help, #python-discussion or a help channel (#❓|how-to-get-help) would be a better place. Additionally, copying your code into Discord is a lot more helpful than an image.

crisp stag
#

@buoyant tinsel will do thanks!

oak breach
silent goblet
oak breach
#

🤔

#

i mean, this is less than half a step away from a truth table

silent goblet
#

introducing a new distinct concept always comes with a cost

oak breach
#

mmmh

#

okay, maybe the symbols for and/or/not are weird
but going from that table to

a | b | a and b
F | F | F
F | T | F
T | F | F
T | T | T

is not introducing anything new

fleet pulsar
#

It is a truth table, but the issue is people like to overcomplicate things in their heads. A good chunk of people would understand truth tables intuitively, but if you told them beforehand that it's a truth table (and, therefore, a new concept), they'd perceive them as a significantly more complex subject and get a mental block, because "cs/math/etc is hard, therefore this will also be hard"

#

Showing something first and only then mentioning that this was the entirety of the dreaded new concept is a really clever way of going around this issue that I myself have used quite a bunch in the past

#

You're basically saying "That wasn't so hard, now was it? And that's truth tables for ya"

noble aurora
#

maybe just presenting it one line at a time would be enough to make it digestible

pure heron
stone juniper
#

do beginners even know the term "truth table" before learning about them?

green warren
#

"Let's make a table where we mark down what happens when A and B are true or false"

sage jasper
#

i think older or adult beginners would have heard of truth tables from high school math classes

#

that's like the p and q stuff right 😂

green warren
#

Yeah it's hard to have a discussion about pedagogy without first defining the audience.

fleet pulsar
#

It really depends on the audience, yeah. Some people are fine with new terms and concepts, and some it feels like actively refuse to understand anything once you make them aware that it's a new concept, labeling it as inaccessible and complicated, even if it's not

#

From personal experience, you could see understanding fade away from my groupmates' eyes the moment someone mentioned pointers in their explanation, though they were perfectly capable of figuring things out when analogies or even just different words for "pointer" were used

#

Understanding the audience you're talking to is probably the most important part of teaching in general, besides the actual curriculum ofc

oak breach
fleet pulsar
#

This alone can be the reason for a mental block, because people anticipate complexity and difficulty from such things

oak breach
#

i guess

weak mortar
#

hey

#

i'm new

#

That all

fickle grotto
#

Hii

pure heron
oak breach
#

the more terms you're familiar with the easier it is to follow conversations

#

conversations outside class i mean, among more experienced friends, on the internet, etc

pure heron
#

The more terms you have to remember, also. Beginners are already swamped by information, so I try pretty hard to target my teaching to just what's most relevant for them to be able to start writing useful programs and learning on their own

#

Knowing what and does is much more important than knowing that the table that explains what and does is called a truth table

oak breach
#

i don't disagree, but i also think its important to know the names for concepts

queen heron
#

I think it's a good visual aid to expand on learning, or clarifying confusion for individuals who might have a harder time understanding than others

oak breach
#

eg how would you google it if you got stuck

pure heron
#

Wouldn't you Google "python and operator" instead of "and truth table"?

stone juniper
#

i guess i dont understand the big deal about truth tables, to me this seems like one of the easiest, least-scary concepts out there
why is it so important to avoid "truth table"?

oak breach
#

ive definitely googled for truth table generators to sanity check whether my condition is right

pure heron
stone juniper
#

hmm idk, if a CS student had a bug with some nested if-blocks or something and I told them to write out a truth table, i would expect them to know what I'm talking about

pure heron
#

I'd probably start calling them "truth tables" at the point where multiple operations are involved, but I don't do it when teaching the basic boolean operators

oak breach
#

then i am in agreement

noble aurora
#

that goes back to the "audience" part. I don't think any college CS student will have trouble with calling it a truth table

pure heron
#

That's fair. I've also never tried teaching "computer science" to anyone, I've only taught "introduction to software development in Python"

#

My audience was people who want to try out coding and see what it's about and whether they want to learn more.

oak breach
#

my teaching experience is zilch 🙃

fallow terrace
waxen fox
#

When I was learning about truth tables, they weren't really hard to grasp

I agree with farmart here because teaching the concept which seems hard but which is in actuality quite easy, then saying that concept was the one that seemed hard but was quite easy is a good way to go about it

violet nimbus
#

@fallen heron hi, can u help me with a code?

violet nimbus
orchid thistle
violet nimbus
#

hey there

orchid thistle
#

this channel is for talking about how to teach people programming

orchid thistle
#

it's not for actually giving programming help

neon pasture
narrow smelt
#

What this channel?

orchid thistle
#

For the discussion on the methods and practices of teaching.

narrow smelt
#

Ok I like it

orchid thistle
#

i feel like sometimes beginners focus too much on strings and/or the various types of string representations of objects, and then end up asking "how do i extract this information from the repr of an object" when they have the object right there and the information they want is just an attribute

#

or more generally questions that are phrased in terms of representations

#

like "how do i remove b'' around something" or "[('96',)] how do i get rid of everything except 96"

stone juniper
#

i think that and the confusion between printing and returning are direct consequences of all beginner programs being a few lines followed by printing something

brazen marsh
#

hello a person can help me

#

i have a goog assistant virtual the i mak

#

good

#

make

sudden hazel
untold island
untold island
next karma
#

Hi highly experienced programmers, I was wondering how would you guys go about teaching the logical aspect of programming to someone

weak mortar
cosmic aspen
worldly dewBOT
#

:incoming_envelope: :ok_hand: applied mute to @cloud compass until <t:1644912021:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

buoyant tinsel
#

logical could also be algorithms

#

there are some nice games that teach algorithms playfully

#

truth tables.. i remember one exam with a task involving 3 variables combined with different operations.. wasn't the most fun task

#

i think the most interesting and practical in every day life aspect of truth tables is conclusion and negation of conclusion

#

but it's some way to get there

#

and if you really want to get out there to expand people's mind - non-binary or fuzzy logic 🙂

#

fuzzy logic really captured me when i first learned about it in CS

#

that's why i really wanted a nice fuzzy logic lib for python, took me years to finish it (mostly) now

next karma
#

the thought process to solving problems

#

applies to anything in life really not just programming

#

I feel as a beginner this aspect of programming is never really touched in tutorials even thought it seems to be really important but then again I don't think its something that can just be learned maybe comes with experience

cosmic aspen
orchid thistle
#

i feel like programming is closer to maths than science

#

specifically, like, logic-y stuff

#

to me it feels like the main logic problems i encounter are:

  • failing to break down a task ("how do i read a list of integers from a file and print the sum of the maximum and the minimum")
  • making up stuff that doesn't exist (returning a variable, calling input and then assuming the input has been stored in input, etc.)
next karma
#

yeah

#

breaking down a task into smaller ones in a way that makes sense is also an issue for me

buoyant tinsel
#

for me programming is way more liberating than maths

#

in maths you're trying to simplify and solve things, in programming you can just let the machine do stuff and you see what's happening

orchid thistle
buoyant tinsel
#

i remember a while ago i had a practical problem and i tried to find a math formula. the simplest approach was to figure out a python program that produced numbers step by step, then i looked it up in the OEIS

#

if you enjoy (actual) math, it's nice if you have time and like to wrestle with the intellectual problem, but if you stumble over a problem in the wild (as in while tinkering with graphics in an app etc) it's just about getting a solution real quick and easy

cosmic aspen
#

It is empircal problem solving

#

And it starts with a problem and a hypothesis ...program that we need to test empirically leading to a binary pass or fail

buoyant tinsel
#

i don't know.. i'm just more of an explorer type of guy. i prefer to experiment and see what's happening

cosmic aspen
#

Experimentation is part of Science

buoyant tinsel
#

true

cosmic aspen
#

Then we have the rigor of the compiler

#

Like peer review - code review

#

Then publication - git

#

Then collaboration - OSS

buoyant tinsel
#

actually, we programmers are further in that regard than scientists, according to some scientists ^^

cosmic aspen
#

Citing references - using code modules by others

cosmic aspen
#

Literature review - looking for modules to reference

buoyant tinsel
#

can't recall where i read it but i've seen some scientists complaining how code reviews and using git, reporting and fixing issues is so engrained into software engineering culture compared to how papers need to be flawless and how publishing something not flawless is viewed as bad science instead embracing reporting and fixing issues

buoyant tinsel
#

damn, i knew it

#

where did i stumble over that..

#

let me check my history

cosmic aspen
#

Share it here could further the discussion but dont sweat it if you cant

buoyant tinsel
#

sorry, i can't find it anymore. i think it was on my mobile (firefox clear without history) 😦

cosmic aspen
#

Yeah Science is supposedly self correcting like how we do code reviews, bug reporting and fixing...the issue is the stakes are higher for scientist reputation wise if they come up with a result that is disproven later.

#

But the true Scientist should welcome being disproven

#

As devs we are constantly disproven by unit tests, testers or compilers

#

It makes us humble

buoyant tinsel
#

well, on freenode irc someone once complained about having been tasked by their boss to replicate some ML paper. the scientist had posted some of their code on github, but it wasn't reproducable, so the guy tried to get in touch with the scientist via github, and their reply was something like "meh, just try harder, i published this 3 years ago and moved on since"

#

i've been in similar situations, too, with unreproducable papers and no way or inclination to get support

cosmic aspen
#

Ah lol not helpful and probably not valid or useful

buoyant tinsel
#

but the scientist could claim to have released a paper

#

we think of science as something ephemeral, transcending people and cultures, but we forget that scientists are just people too

cosmic aspen
#

Yes

#

Like us devs

buoyant tinsel
#

yeah, like us devs.. who don't get paid for support and thenhalf the internet comes crashing down because one guy doesn't give a shit anymore

cosmic aspen
#

In science all it takes is a single valid and replicable experimental result to overthrow an established theory...why they keep testing relativity

buoyant tinsel
#

while this all seems relatively offtopic in this channel, there is the question of what values and cultural approach we should be focusing on while teaching

cosmic aspen
#

Ok let us close this

buoyant tinsel
#

no, you raised a good and important point

#

the values we focus on while teaching also determine how we teach

#

if we really want to take the scientific method as guide to our teaching, we need to include peer review etc

cosmic aspen
#

Love for the truth and honesty and humility is essential...also letting go of ego if you are faced with negative code or peer review... emotional maturity

#

It is from mistakes that we learn and grow

#

It is the same in science

buoyant tinsel
#

could we take TDD as an approach to teaching?

cosmic aspen
#

Yes frame test as hypothesis

#

There is a testing framework called hypothesis lol

buoyant tinsel
#

yeah, i love it 🙂

#

but it's definitely not for newbies 😉

cosmic aspen
buoyant tinsel
#

even guido couldn't wrap his head around it when he first came across, according to some mailing posts

cosmic aspen
#

Lol first time i heard of that

buoyant tinsel
#

really? that i can dig up again, i hope ^^

cosmic aspen
#

Ah not if you are too busy but ok if you can

#

It isnt too many times that Guido is befuddled

#

It shows he is human like us

buoyant tinsel
#

ah, i found it 😄

#

@cosmic aspen

#

that's the discussion

cosmic aspen
#

Nice thanks

delicate drum
#

hello

buoyant tinsel
#

hi

delicate drum
#

help me pls

buoyant tinsel
pure fog
#

but it turns out that generating example data is really useful for property-based testing

#

the idea of testing "invariant properties" i agree is subtle and imo is a completely different paradigm for thinking about software testing

#

but at the same time it's not actually that different in principle from what people do normally. the "paradigm shift" lies in the process of explicitly identifying and isolating testable invariant properties

#

basically it's a formalization of how most people probably intend to write tests subconsciously, but the formality leads to a totally different way of thinking about testing... not sure if that makes any sense

#

i think there is something pedagogical here... but i don't quite know what 😆

buoyant tinsel
native hearth
#

Assign the result of input to a variable and use that

muted scarab
#

Maybe it's an exmaple for bad teaching 🤣
'Input' is a function that 'returns' a value,
Where are you learning from?

weak mortar
#

yes it was intentional

muted scarab
# weak mortar yes it was intentional

Aha,
This iilustrates 2 concepts i always keep in mind:

  1. Many beginners lack fundamental understanding of the programming details -like here they need to understand input is a function.
  2. As a guide/teacher we need to understand if a student lacks understanding or just made a mistake
buoyant tinsel
#

well, there's another important point here - that python allows overwriting of functions without complaining

#

if you did input = input("foo")

#

and another point - that function names are variables like any other

#

which would be a good time to make sure they got the reserved keywords down

waxen fox
#

or should they just be left as a "learn at your own risk"

green warren
#

Every feature of the language is useful for something.

#

Asking whether something should be taught in a "Python class" without mentioning what sort of level or background is kinda hard to answer.

misty dirge
#

I just purged a bunch of off-topic comments. Please keep this channel on-topic. If someone goes off-topic, please do not follow that vein of conversation, even if well-intentioned. Well, maybe I misunderstood what the underlying goal of the messages were. I'll reintroduce the topic later with credit/apologies to the OP.

waxen fox
misty dirge
#

but that would be in a course about advanced Python usage, which I think are rare. Courses that are specifically about Python are usually (a) introduction to programming courses and (b) taught by a Java developer who doesn't know/secretly hates Python.

misty dirge
cosmic aspen
#

Like the joke about being able to shoot your own foot in a progranming language... more power more risk...look at C

#

Lol it appears Python isnt mentioned in the page above but Perl is...it is old but still a fun read

cosmic aspen
# misty dirge but that would be in a course about advanced Python usage, which I think are rar...

Java : You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage method on the Foot , so the Foot can damage itself in the most effective way. Now you run the program, and call the doShoot method on the instance of the Gun class. First the Gun creates an instance of Bullet , which calls the doFire method on the Gun . The Gun calls the hit(Bullet) method on the Foot , and the instance of Bullet is passed to the Foot . But this causes an IllegalHitByBullet exception to be thrown, and you die.

#

For the java prof that secretly hates Python lol

misty dirge
#

!otn a IllegalHitByBulletException

worldly dewBOT
#

:ok_hand: Added 𝖨llegal𝖧it𝖡y𝖡ullet𝖤xception to the names list.

misty dirge
#

Is it fair to say that the goal of OOP was to more intuitively manage state, and that caricatures of OOP weirdness are based on OOP use cases that create more state than is necessary?

green warren
#

I think if you are learning OOP, then abstract classes and interfaces are pretty important. Since Python enforces the abstract class concept via metaclasses, you need the vaguest understanding of what a metaclass is. But admittedly not that much.

green warren
misty dirge
green warren
#

Of course you can. I think it's best not to be married to one programming paradigm. Use OOP, procedural, or functional wherever they make the most sense.

#

(And yeah, I've implemented stateful algorithms in functional languages and it's a pain and confusing to follow. But functional languages are very elegant for expressing other things.)

mental wagon
#

Hey, don't know if it's the right discussion channel, but I want to ask you a question about learning python. At what point you've had your break point, where starting from it, you started to understand more easily everyother thing, that you've been learning about python and you could implement your knowledge more easily or started to create some kind of simple projects of your own? Thank you for your answers.

woeful snow
#

The thing that you may do is learning other languages, especially languages that are known to change the way you see programming (in my opinion, they are the only ones worth to learn). A language that i really love is APL, and it really changes the way you see programming. Another language that, i think, is really important to learn is LISP (and it can actually be useful for some projects, while APL is not).

woeful snow
mental wagon
#

thank you for your answers. I'm only learning Python for a few weeks, but as I'm learning, I still don't see what I can create by the knowledge I have right now. Still trying to find the break point, to have more passion, to pursue the learning and keep going with python. Maybe, after certain amount of time, I should try other coding languages, just to see what goes with me. Anyway, your answers are very appreciated!

light totem
#

I wouldn't say there's a specific point, but definitely after a couple of months you'll be learning less stuff and a lot more comfortable
However Python is such a broad ecosystem with lots of applications and use cases as soon as you switch domains it can almost feel like you're a beginner again
E.g. I spend most of my time on APIs at work and have almost 2 years experience with Python, but when I dabble in other stuff like ML at the weekend it feels almost like a different language
Also some packages definitely still seem like black magic to me when I browse the source code, e.g. Pydantic

weak mortar
# mental wagon thank you for your answers. I'm only learning Python for a few weeks, but as I'm...

sometimes i find it easier to learn when i’m trying to do a project as compared to just learning “by the book” (or tutorial etc etc).

what i’ll do is have a project i want to do, and just start doing it. one example:
i wanted to make a reddit scraper bot that i could say a subreddit, it scrapes titles and stores to a text file.
well what do you need for that?

  1. you need something to connect to reddit (an API call)
  2. you need something to process the text (text handling)
  3. you need something to tell you what the text is / output it to a file / tell the bot where to scrape (file handling / console input and output)
#

it can seem like a lot to look at it all at once, but then you can dive into the little pieces. start with the easiest one to you. for me, that’s usually reading and writing from a text file. so i’ll hardcode a sample string into the program and find a way to save that string to a text file. it might take me a day or a week to figure out but once i can figure it out once, i can use it forever

#

then maybe you look at connecting to an API.

my best tip for learning things in the beginning is to go to Google or Youtube and find a video tutorial walking you through. it’ll help you a lot to hear people talking about coding. as you start to understand things more you can add stackOverflow / other text based coding forums into the search.

there are so many great resources explaining how to connect a bot with PRAW (reddit API) , and you only need to consume videos until you get something that works.

remember, you’re doing this to learn, NOT to be the best programmer ever. if your code is ugly, at least you have code. make it prettier / faster / more efficient on the next build, and over time you’ll improve. ducttape code is fine, you can always improve it with a rewrite when you have hindsight to help

#

anyways, once you get the API setup and have reading and writing to files working, all you have to do is call the right functions with the API to get the data what you want. Youtube videos are your best friend

You can figure out the commands that get titles, comments, etc and then store it in some kind of data structure. you can use a dictionary or a list or whatever you’re comfortable with. remember, duct tape is fine! you’ll learn more stuff that you can put together later.

After you do the scrape (and store it to the data structure), you can loop through and save it to your file with a loop.

at this point you have a basic Reddit scrape bot set up that may or may not work correctly (duct tape is fine when you’re learning but it can leave you with… quirks once you put a few duct tape pieces together), and you’ve just learned a ton of things that you can now take with you to your next project

weak mortar
mental wagon
#

Thank you everybody for your inputs. With it, I can build up different perspectives of learning and will definetly try it out. It's great to be apart of a helpful community.

misty dirge
#

that's one of the nice things about programming. anyone with a computer can practice as much as they'd like.

pure fog
# buoyant tinsel well, read the mailing posts 😉 it wasn't property-based testing in principle bu...

well that's kind of a different thing... i wouldn't be surprised if the internals & the "shrinkage" algorithm were complicated. imo it's disingenuous to claim that guido "couldn't wrap his head around it" imo.

but yes, i think the pedagogical conclusion is: we should teach testing early (maybe not specifically strict TDD), and the language around testing should be the language of "invariants" and "properties", not ad-hoc "making sure it works"

pure fog
#

understanding lexical scope and how name binding works i think is a big one for a lot of people though

#

another one is understanding that "everything is bytes" and that data types are just a matter of interpretation

misty dirge
#

Topic: how can one effectively teach the difference between an object and variables that refer to it? I've encountered people who mistake multiple variables pointing to the same object as being "shallow copies", when that's not quite it. I think there's also some debate about whether or not "variable" should even be part of the vocabulary when talking about Python, and using the term "name" instead.

neon pasture
#

show them the talk by Ned on the topic.

misty dirge
#

show me the talk by Ned on the topic.

neon pasture
#

"Speaker: Ned Batchelder

The behavior of names and values in Python can be confusing. Like many parts of Python, it has an underlying simplicity that can be hard to discern, especially if you are used to other programming languages. Here I'll explain how it all works, and present some facts and myths along the way. Call-by-reference? Call-by-v...

▶ Play video
winter spear
misty dirge
#

I'm inclined to agree, but I think "variable" is so widely used in programmer parlance that we can't get away from it. (and I say this as a list vs array crusader.)

green warren
winter spear
#

Well list and array and very different imo

#

But I learned C first where arrays are predefined in size and type or at the very least type

green warren
#

Python list is not a list structure, but "array" is not quite accurate either. (But no worries, a C++ "vector" is certainly not a vector either! We seem to be lacking in good language to describe compound data structures).

stone juniper
#

Python list is not a list structure
wdym?

green warren
#

It's not a linked list. It's an array of pointers.

stone juniper
#

i dont think "list" = "linked list"

stone juniper
green warren
# stone juniper i dont think "list" = "linked list"

I mean, we are talking pedagogy here. It is helpful not to use too similar words for very different concepts. I think Python's choice of "list" is quite unfortunate. But I'm not quite sure of a good substitute.

oak breach
#

do you think its worth mentioning that other languages don't always work the same way when it comes to assignments and names and references

stone juniper
#

only if they have experience with other languages

oak breach
#

hmm

stone juniper
#

i remember being a beginner and it wasnt even clear how references, assignments, etc could work differently in different languages

#

i think its better to understand one language first

green warren
#

In general talking about the many things a new concept is not, is a terrible idea.

neon pasture
pure heron
#

e.g. given py x = 420 y = [x] there are at least 2 names for 420 - x and y[0]

#

One of those names (x) is a variable, the other (y[0]) is not (though y is)

oak breach
#

How do you define variable?

#

vs a name

native hearth
#

inb4 nedbat's name youtube talk

pure heron
#

No, you're not 😉

pure heron
# oak breach How do you define variable?

I'd say a name is any reference to an object (some of which aren't even accessible or visible from Python), whereas a variable is a name that exists in the global or local or non-local scope

#

a = 5 makes the variable a refer to the value 5.
a.b = 5 makes the attribute b of the object referred to by variable a refer to the value 5.

#

Both a and a.b are names, but a.b is not a variable.

oak breach
#

🤔

#

Id have said its the other way round

pure heron
#

What other way around? You would have said a.b is a variable, but a is not, though both are names?

oak breach
#

That both are variables, but a.b is not a name

#

But i can be convinced otherwise

pure heron
#

The language reference talks about "global variables", "local variables", and "free variables".

misty dirge
#
a = Foo()  # a is a name for an instance of Foo
c = [a]  # c[0] is now a reference to the same instance of Foo, but not a name for it
a.b = 5  # 5 is now an attribute of the Foo instance, with b as the attribute name
#

this is just my usage

#

I'm not sure how to effectively distinguish between whatever you call the thing after the . and the object being referred to.

pure heron
#

I'd use "name" and "reference" interchangeably.

misty dirge
#

I think most languages with support for OOP require you to specify a specific set of attributes/instance variables than an instance of a class can have. Python does not.

oak breach
#

"fields" too

silent goblet
#

static languages certainly do

misty dirge
#

to me, "instance variable" suggests that other instances are guaranteed to have an analogous value. but that's not true.

silent goblet
misty dirge
#

> internet perl

silent goblet
#

> machine learning perl

#

🔥

misty dirge
silent goblet
#

yep

misty dirge
#

ah

pure heron
#

Regardless, I think "don't say variable" is silly, especially given that the docs use the word "variable" all over the place. I don't think avoiding the word "variable" helps beginners understand the concept of multiple references to a single value at all, and that's what proponents of "don't say variable" seem to think it would help with

#

I think "name" is a more accessible word for "reference", so that you can say that y[0] is "another name for" some object, instead of "a reference to" some object.

stone juniper
#

I don't police the language of people who already know what they're talking about (or anyone really); I use "name" instead of "variable" with beginners because "name" carries with it helpful preconceptions about how names work whereas "variable" carries with it unhelpful preconceptions about how variables work. So it helps beginners develop an intuition about how they work without forcing them to stop and think about it explicitly.

I don't really care about attributes or other references because that can come later.

#

I also don't really care what the docs say because the beginners aren't reading the docs, and I'm far from convinced that they're pedagogically optimal.

pure heron
#

That's an interesting point that I don't think I've heard anyone articulate in the scope of the names vs variables discussion before: that variables in a programming language behave very differently from variables within a math equation

stone juniper
#

lol there's a very long conversation between Ned and I about it somewhere around here

pure fog
#

"variables are names or labels attached to pieces of data" is always how i say it

#

good to introduce the "binding" jargon too

#

"data D is bound to name N in scope S"

fallow terrace
#

I started with a language that uses let and const for variables (JS), and that kind of thing is how I think about it. A name is any identifier, whereas a variable is something that would be let or const. (of course, I could explain the specific rules, and I wouldn't ever teach variables in Python and explain it like that, but I think that suffices for the purposes of this conversation)

misty dirge
#

my intro to java course was emphatic about constants not being variables, but didn't offer a term that refers to either.

fallow terrace
#

I've always thought of the name "variable" as decoupled from whether the value can vary (sorry "variable," but I don't care what you mean), but maybe that's not true.

misty dirge
#

well, "able to vary" is what variable literally means, at least following a strict interpretation of its component morphemes.

fallow terrace
#

I understand that's what the word means, but for one reason or another I've never thought of it like that in programming. (not saying you're wrong, that's just how I think of it)

#

I suppose the term "immutable variables" is paradoxical then.

noble aurora
#

yeah, i kinda agree with dawn here. even if they're constants i still call them variables 🥴

pure heron
#

I generally do as well.

misty dirge
#

every day, the programmer technolect strays further from god's light.

noble aurora
#

saying constant vs variable is too much effort

pure heron
#

I'll specifically say "constant" if the distinction is relevant, but it rarely is - const-ness is just an extra piece of information attached to the variable (that it can't be reassigned), and that piece of metadata is usually irrelevant to whatever I want to say about the variable

misty dirge
#

If only we could go back and make programmer terminology and math terminology non-overlapping.

pure heron
#

note that when solving a math equation, a variable doesn't vary

misty dirge
#

that perception is also the result of a loose application of terminology. a letter representing a number, where the number doesn't change, is a "parameter".

#

so if you have y = mx + b, y and x are variables, and m and b are parameters.

#

which then doesn't line up with how "parameter" is used in programming.

pure heron
#

The x in 2x + 5 = 3x - 1 is the same value as the x in 2x + 6 = 3x and the same value as the x in 6 = x

misty dirge
#

sure, but are any of these statements intended to represent all possible (x, y) values for a certain line?

pure heron
#

(is what I meant by "when solving a math equation, a variable doesn't vary")

#

nope - I was explaining my previous statement, not addressing yours.

misty dirge
#

> not addressing my statement
sad_cat

pure heron
#

I lack the math expertise to have any opinion on your comment 🙂

stone juniper
misty dirge
#

Scofflaw knows math

#

Scofflaw, learn me parameter/variable

stone juniper
#

||this is sort of relevant to my earlier point, i swear||

pure heron
stone juniper
#

whether or not the equation holds is an open question in some contexts
on its own the equation is merely a theorem

#

from that equation you can apply formal rules to obtain a different statement: x = 6

#

but my point is that the "variable" in all of these is static in a way that variables in programming are not

#

it's just a part of a timeless statement, whereas programming variables are references to data

#

(in most programming languages)

pure heron
stone juniper
#

lol yes the incestuous terminology is inescapable

misty dirge
#

!otn a incestuous terminology is inescapable

worldly dewBOT
#

:ok_hand: Added incestuous-terminology-is-inescapable to the names list.

pure heron
#

describing formal systems using a language that humans speak is very difficult

#

at least, if you don't want to sound like a lawyer every time you open your mouth 🙂

stone juniper
#

or worse, a logician

noble aurora
#

or just..yknow..a nerd

stone juniper
#

which is relevant because on some level that isn't necessarily conscious, this is how math-literate students think about variables when doing math

pure heron
#

TIL I'm not math-literate lemon_grumpy

stone juniper
#

lol im guessing the way you actually do math would align with it though

oak breach
vale current
#

Amateurs, non-changeables

stone juniper
#

@arctic marlin @median yew @still brook @candid jay this channel is for discussion about teaching programming, but you can grab a help channel in #❓|how-to-get-help

neat canopy
#

What are good lesson plans/project to tech others

subtle owl
weak mortar
#

What is this about?

hot harness
#

Please share a channel link for Django projects and for Q&A

orchid thistle
#

is it just me or do people sometimes ask questions that are weirdly focused on specific features of python

#

"how do i do X using an if statement"

tidal orchid
#

a huge part of that might be due to the way universities teach Python

waxen fox
misty dirge
#

yep, sounds like a "you must now learn if statements!!!!" assignment. which is fine for beginners, I guess, but it's important that people eventually focus on the solution rather than the approach.

cosmic aspen
# orchid thistle is it just me or do people sometimes ask questions that are weirdly focused on s...

In making lesson plans you start with the learning objective.... write the material to address that objective...write the mechanism to check if that learning objective is met...eg the rubrik...test, quiz, project, recitation, reports...define how to measure outcome...then actually teach the class...that may lead actually to the feature list approach since it is easy to evaluate mastery of a topic in isolation before moving on to the next then hopefully synthesizing it all with a capstone project.

tidal orchid
#

in another topic:
How do you generally teach Threading / Concurrency?
Most of the time I just recommend reading Real Python's An Intro to Threading in Python, specially if they don't know what threading is at all, but idk if that's a bit too "rftm"

weak mortar
ripe folio
#

Doesn't that make it easier?

weak mortar
#

in the long run, not exactly

ripe folio
#

There's less race conditions someone has to understand

weak mortar
#

because if they try to apply what they learned in python multithreading to other languages, they would have to reteach themselves multithreading

ripe folio
ripe folio
weak mortar
#

from my experience, the easiest way to help beginners learn multithreading is to apply it to a business application

#

which would be by using a progress bar as one thread and a time-consuming process as the other thread

ripe folio
ripe folio
#

The one thing I've actually seen people have a lot of issues is what is blocking event loops and how it works

#

Threading is usually pretty intuitive for someone once they understand that multiple things can happen at once.

noble aurora
noble aurora
pure heron
#

it's not really any different.

#

there are some things that can't be interrupted in CPython, but as a general rule it's not documented which things can't be interrupted, and anyway it's an implementation detail that can change between versions - so, you're forced to code as though anything can be interrupted.

misty dirge
#

I don't see the connection between iadd and anything being interruptable

pure heron
#

+= can be interrupted - it's possible for two threads A and B that are both executing i += 1 to do
A loads the current value of i
B loads the current value of i
A adds 1 to the value it loaded
B adds 1 to the value it loaded
A stores the value it just computed to i
B stores the value it just computed to i
with the result that i was only incremented by 1 instead of 2 after both threads finished

misty dirge
#

perhaps I misunderstand what is meant by interrupted in this context.

pure heron
#

that a context switch can occur in the middle of the operation

misty dirge
#

sad_cat idk what a context switch is

pure heron
#

a running thread can be deactivated (by the kernel) to allow other threads to make progress. It's possible for a thread that's running i += 1 to get deactivated in between loading the current value of i and before storing the value 1 greater than that back into i. If it does, then another thread can become active and modify i while the first thread is paused - and if it does, the first thread will store the wrong thing when it's resumed.

misty dirge
#

that's terrible!

noble aurora
#

enter async 👀

#

async basically fixes the problem of not knowing when a context switch happens, because you control it with the await keyword

misty dirge
#

I hate waiting.

pure heron
#

in practice, it's not really much of a problem that context switches can occur at any time. When you manipulate shared state, you need locks, or you need to use thread-safe objects (like queue.Queue) to synchronize multiple threads

#

and in that sense (circling back to the channel topic) teaching multithreading in Python is no different than teaching multithreading in any other language - you need to explain what a race condition is, you need to explain things like the dining philosopher's problem to illustrate deadlocks and livelocks, you need to teach mutexes and condition variables, and then you tell people that they should almost always just use queue.Queue as the only way two threads communicate with each other and everything will work out and they don't need to think about it very hard

#

and maybe threading.Event, though they need to think a little harder to use that one in a way that can't deadlock.

pure heron
#

or, maybe a better way to say it - it's a huge problem that context switches can occur at any time, but it's essentially a solved problem. There are well known tools for synchronizing multiple threads with one another in a safe way, and as long as you use those tools, and use them correctly, much of that complexity is managed for you.

gleaming anvil
gleaming anvil
untold island
#

!d threading.Lock

worldly dewBOT
#

class threading.Lock```
The class implementing primitive lock objects. Once a thread has acquired a lock, subsequent attempts to acquire it block, until it is released; any thread may release it.

Note that `Lock` is actually a factory function which returns an instance of the most efficient version of the concrete Lock class that is supported by the platform.
untold island
#

is using a thread-safe data structure preferred over explicit locks ?

noble aurora
#

yes

pure heron
untold island
#

I have yet to use py queue.Queue

noble aurora
#

not only is it way harder to screw up, it also looks way nicer than having with lock: everywhere

misty dirge
#

Welcome to #programming-concurrency

#

(for the record, I'm not too worried about straying off topic as long as it stays in an "advanced discussion"-like domain.)

pure heron
# noble aurora yes

a more nuanced answer, actually: I don't think the lesson is "prefer thread-safe data structures over explicit locks", so much as "prefer to use existing, well tested components as building blocks wherever possible". The authors of queue.Queue went to a lot of effort to figure out every possible edge case a queue can have and handle them. Likewise for something like concurrent.futures.ThreadPoolExecutor.

The reason you should use a thread-safe data structure wherever possible is the same reason that you shouldn't implement your own HTTP client using the raw socket API: someone else already did it, and they removed many bugs over many years, and the final product is almost certainly better than what you'd get if you wrote it yourself from scratch. If you try to do your own HTTP messaging, you'll likely have bugs that requests or httpx don't have. If you try to do your own message passing system to communicate between threads, you'll likely have bugs that queue doesn't have.

#

Now, the one way in which threading is somewhat unique is that it's really, really hard to get right, and the bugs can be really, really subtle - which is all the more reason why you should prefer to reuse existing and well debugged library components over attempting to use low level primitives yourself.

fossil thicket
#

So didn't know where to put this but, I have been looking for some physical computing books, programming, networking, databases, etc. Just cause I prefer them over ebooks as I just can't seem to get grabbed by them. Does anyone where/what I should be looking for? UK Waterstones was a bit disappointing

#

Just for learning, reading and referencing for uni

silent goblet
# pure heron a more nuanced answer, actually: I don't think the lesson is "prefer thread-safe...

prefer to use existing, well tested components as building blocks wherever possible
My latest discovery is how complicated contextlib.contextmanager actually is.
https://github.com/python/cpython/blob/main/Lib/contextlib.py#L141-L187
So many edge cases I would've never thought of. And even the CPython developers haven't thought of them at first - they were discovered after the first version of contextlib:
https://github.com/python/cpython/blob/f669436189dd44a841caa9ab1ad97a3f7662bf58/Lib/contextlib.py

fossil thicket
#

Never heard of them? Is that a US thing? Sorry should have said UK

#

Oh nvm they are UK

torpid prawn
#

if you had to teach high schoolers programming, what topics would you try to cover? and which topics are "nice to get to if theres time"

silent goblet
#

and the audience - is it all the students? or just the ones who are interested in programming?

torpid prawn
#

the latter

#

what about a year?

#

ideally, id like to incorporate a few small projects as i feel like thats where the magic happens but ofc you need to get to that point

fleet pulsar
#

An approach that was used by the course I took when I was a beginner worked well for me; they gave a bunch of practice tasks separated into groups, and one of the groups would involve tasks that build on top of each other and/or contribute to the same project from lesson to lesson

#

This way we got both immediate practice for newly covered topics and started making projects relatively soon

weak mortar
#

I'm showing (teaching?) someone interested in programming Python and I don't have much experience. I'm used to linux/macOS environment (I spend a lot of time in the terminal), but this person is used to windows. I don't have any experience developing on windows.

I've installed python for them on windows through the official website and I've recommended vscode + automate stuff with python for tutorial

#

the book I've recommended is using MU editor

#

there wasn't time to install it yet

#

should I install it when I have the chance and go with my recommendations, or is there a better way on windows?

misty dirge
#

@weak mortar one of the more difficult parts of learning programming as a Windows user is that most online resources show command line stuff with bash, whereas PowerShell is the most capable command line for Windows.

The Python that comes with Windows has a lot of permissions weirdness, so it's best to download and install one from the Python website.

#

I usually encourage beginners to use a simple text editor like notepad++ or sublime, and then move to an IDE once they have an understanding of virtual environments and how to install stuff.

#

The reason being that when IDE-natives come here asking for help with installing a dependency, it's often very difficult to help them.

#

they usually don't understand why a package that they've installed can't be imported (because the IDE is running the program with a different environment), or how to install something to the right environment, etc.

weak mortar
#

I know installing stuff can be a pain and I don't want this person (complete beginner) to deal with this at the moment

misty dirge
weak mortar
#

no, this is a complete beginner that wants to learn the basics of programming atm

pure fog
#

thonny is good and recommended for beginners

#

it's a step up from idle but not so overwhelming and complicated as vs code

#

i'd definitely say that you're right to avoid messing with venvs at the beginning, but make sure you have them using --user for pip install at least

weak mortar
#

I've never heard about thonny before

#

as for pip install, that's forbidden for the moment :)

#

no need atm

#

from what I hear it's similar to sublime without plugins

pure fog
#

yeah, i am talking about vs code the editor

#

it's "simple" until they need to actually configure something

#

then, like sublime, it's no longer simple

#

i guess you can start them on vs code too, but thonny might be simpler to work with (and has some good python-specific tools that you'd otherwise have to install as vs code plugins)

#

my personal bias is that we shouldn't encourage the vs code hegemony anyway, it's bad for the ecosystem and it's bad if people start to get the idea that "programming = vs code" (which of course is what microsoft wants)

weak mortar
weak mortar
misty dirge
#

aren't you necessarily injecting your opinion when you make decisions about what they should learn and in what order? I think that's just part of teaching.

weak mortar
#

I am, but my advice here would be - it's better to use y instead of x, because of greater good, but for now I'd use x because it would be easier on you

#

:)

weak mortar
pure fog
#

it's more of an IDE than an "editor", but it works without all the complexity of a full-size IDE like pycharm

#

so you get lots of nice graphical-based features

#

there's nothing wrong with vs code though so fair

weak mortar
#

I agree with your point about encouraging people to use vscode

#

my question now is which of the two: thonny or vscode is better for a beginner python programmer

weak mortar
pure fog
#

yeah, that's why my suggestion is thonny

weak mortar
#

my suggestion was vscode without plugins specifically

pure fog
#

this person has no personal preferences yet, no favorite color scheme, etc. so give them a program that works and is featureful out of the box with no extra config

#

admittedly im not sure what is now a plugin vs built into vs code. so if it comes with a debugger etc in the standard package then the difference is smaller

#

ah one thonny deficiency: there's no "run current line" hotkey or button

weak mortar
#

I've recommended no plugins for vscode so it would be used as a normal editor. I wanted them to learn without the crutch of plugins

pure fog
#

hm, so you want them to use the command line to run programs? are they going to be using the repl?

weak mortar
#

I was thinking I don't want them to use cmd, so it would be easier on them

pure fog
#

ok

weak mortar
#

but I'm not sure what's the best way

pure fog
#

thonny has a lot of cool stuff built in: an object inspector, a dedicated window to show the last stack trace, a file browser, an "outline" viewer with classes and functions, even advanced stuff like a syntax tree browser and a heap inspector

#

i'd say it's actually a good general-purpose python ide too

#

but maybe not as powerful as vs code, and not "extensible" with plugins

weak mortar
#

you said you're an educator? you teach python beginners?

pure fog
#

no, sorry i didn't mean it like that

#

i meant "from the perspective of educating"

#

i have taught individuals programming but never professionally

weak mortar
#

ah, ok

pure fog
#

if anything i think the lack of a "run current line/function" is a bit of a dealbreaker for a classroom setting

weak mortar
#

this is my second time and honestly, I'm having trouble putting myself in the shoes of complete beginner :)

pure fog
#

it's probably a good habit to "run entire file", but it makes the process less interactive

#

my memory of being a beginner is that i mostly just did what i was told w/ respect to tools

#

and that i understood what basically nothing did

#

so it was important to have tools that made it easy to do the easy things, and kept complicated things out of the way until i learned about what they did

#

i learned python on idle