#pedagogy

1 messages ยท Page 10 of 1

pure fog
#

python regex is a pretty decent subset of pcre

#

the only "missing feature" is variable-length lookarounds

#

and unicode character classes, annoyingly

#

The regex library has the latter and maybe the former

#

!pypi regex

worldly dewBOT
lusty geyser
#

So I have a classmate I'd like to take under my wing

#

He's a smart enough guy, but his fundamentals are really lacking

#

So the way I see it, I can either encourage him to go back to the basics, or push forwards with a focus on unambiguously clean code

#

Wondering if anyone has ever been in a similar situation and if so, what they'd recommend

misty dirge
#

@lusty geyser what fundamentals is he lacking?

lusty geyser
#

Well, we're entering into our second term

#

So being able to work with arrays is going to get pretty important

#

This in C++ btw, but the teaching is more or less the same

#

And he still couldn't tell me the difference between pass by value and pass by reference, let alone what's actually going on with the data

#

And honestly, some other pretty serious mistakes like egregious syntax errors

#

He's just trying to go along to get along, but he's got no idea what's going on

#

And I'd like to start with the basic idea of what data actually is in memory, how it relates to declaring our variables with their types, and how it moves around

#

But that's how it makes sense to me. And I'm not a good example because, and I don't mean to come off as conceded here, but coding has always been as clear as water to me

#

I don't struggle to understand things the way most of my classmates do and that makes it hard for me to know where the sticking points are

#

So I worry that starting with "what data actually is" is like trying to tell someone how atoms and molecules work without first explaining to them what chemicals are

#

If that makes sense

misty dirge
#

do you have any examples of the assignments from the previous term/semester?

lusty geyser
#

But not his assignments

#

Did you just want to see the specifications?

misty dirge
lusty geyser
#

I'm not sure I'm following. Are you suggesting that "if he just doesn't get it, there no way he can get it?"

#

I'm certain I must be misunderstanding ๐Ÿ˜

pure heron
#

so, second term of first year of university?

lusty geyser
#

Yeah

#

Also, I'll ask you to bear with me. I've been getting progressively more congested since I first posted my question, and I've taken some cough syrup

pure heron
#

has this friend talked to TA's or professors about what he's struggling with, or availed himself of office hours?

lusty geyser
#

I think so. I know he was on close terms with his teacher last term

#

And he's focused, I know he's been reaching out for tutors

pure heron
#

and despite all that, he's struggling to grasp the basics of the material?

#

when you say "egregious" syntax errors - can you give some examples of the egregiousness?

lusty geyser
#
void some_function(int& x, int& y) {
  x = 10;
  y = 20;
}

int main() {
  some_function(int& 1, int& 2)
}

pure heron
#

hm, ok. Well, that's... ballpark, at least.

lusty geyser
#
for (int i = 0; i < 10; i++) {
  somearray::name[i]
  // what he was trying to do...
  // somearray[i].name
}
pure heron
#

ok. that's not so bad.

#

does he have any previous coding experience, do you know?

#

C++ is an exceptionally hard first language, I think...

noble aurora
#

it seems like he's got all the ideas, tbh. just needs more practice

pure heron
#

my general advice here would be to let people with more teaching experience - the professor and TAs - take the lead. If this person's asking you for help, that shows that they really want to learn the material, but I don't think you're the best person for them to learn it from.

#

if you decide you want to be more involved, I'd start by going back to previous homework assignments, and sitting down to pair program them - him at the keyboard, and you available to ask questions as soon as a question pops into his head, or to correct a problem soon after you see him starting to make it.

#

I agree, though - it seems like he's having trouble remembering the syntax, but has a reasonable grasp of the ideas (beyond the fact that he was passing references to temporary variables in the first one, but references are a bit hard to grasp at first, and at least the compiler will catch that mistake)

lusty geyser
#

And you're probably right

#

That said, I want to become someone who can teach (tutor) ๐Ÿ˜ I definitely have the knowledge base, but I want to get better at the teaching part. Maybe I should start with some reading on teaching

#

Beyond that though, our school is a joke

#

He won't get much from the instructors

#

Anyway, thanks y'all

pure heron
#

pair programming is a great educational tool - if you decide to stick with this plan, that's the tool I'd reach for

#

it gives him a chance to get immediate feedback to validate a strategy or correct a mistake, and lets him practice his skills in an environment that should hopefully be less frustrating than if he were working alone

lusty geyser
#

๐Ÿ™‚ Perfect

pure heron
#

and rather than starting any new material, I'd revisit past assignments, since you know he doesn't have the basics down yet

#

or slight variations on past assignments

weak mortar
#

question

#

i've been programming for months and wondered what its like to be a master programmer

#

like you can really do things in front of computer creatively with googling things reasonably?

cosmic aspen
#

Lol old timers can dispense with the googling things we grew up without it

weak mortar
#

but using my definition, a master programmer would be able to take on almost anything comfortably. they'd still have to learn when trying new things of course, but they'd know how to do it efficiently and where to start (the docs for example)

green warren
#

I wouldn't expect anyone to have memorized everything. But I would expect someone to know a handful of useful design patterns, to understand most "gotchas" and caveats, to know where to look up information, and be able to understand more advanced documentation and put it to use.

buoyant tinsel
#

Well, there are two ways to become a master in something

#

Either someone you and everyone else recognise as 'master' proclaims that you are, indeed, a master of the craft, inviting you into this society

#

That's basically the way academic degrees work

#

Or you have some measurable notion, which gives yourself a measure how good you are, a fuzzy degree of how much of a master you are, like the percentage of time you spend googling instead of writing code

#

That is more important in job interviews

#

But it would be strange, if not stupid, if a self-proclaimed master would never google for existing solutions

#

Especially in a fast moving field like CS the most important skill imo is the ability to keep learning, staying curious and never assume that you're 'done'

#

And you also need to distinguish between being creative and being productive

#

The highest productivity is achieved by the contrary of creativity - repetition

#

If you want people to be productive, you teach the bare minimum of a framework, like a GUI framework, how to do things, and nothing more. Then you give some spec and expect them to realise those specs without any deviation

#

That was the idea of management of many big companies a few decades ago, how to outsource coding jobs to India, Russia, China

#

Then they realised that good, creative, individual solutions can't be build like a car

#

But creativity is hard to control, requires time for research, experimentation

#

And always comes with an element of risk

#

So, mastery.. hard to define.

#

In Hagakure it's said that one is a true master only when you are useful and recognized as one, but also realize that you never will be done training and learning

#

So, I guess coders are like Samurai in that regard

misty dirge
buoyant tinsel
neon pasture
#

it is a very reliable method to get someone up to speed on a new technology

buoyant tinsel
#

I think good error messages are more reliable lemon_grimace

silent goblet
ancient siren
#

amogorkon you must be familiar with the concept of "beginner's mind" -- I think it could be of great value in teaching / learning programming, don't you?

rich mural
#

I much prefer being able to work on a problem at my own pace, and then have my work be reviewed asynchronously by someone else.

weak mortar
#

hey

#

something about OOP

#

@rich mural and @pure heron have raised good points about how OOP is taught

#

When teaching about OOP we should properly show that replicating real-world examples isn't always the best use for them

#

and in fact can be downright problematic like dementati said

keen moat
#

While I don't disagree with the issues outlined, I don't think presenting such intricacies is useful to someone who is trying to understand how to write code with this new tool and why it's even useful

#

Starting with half truths is fine sometimes

white bough
#

A lot more programming teaching should be problem orientated and not feature orientated

rich mural
weak mortar
#

I agree

rich mural
#

And maybe there are still things we can improve in how we teach the basics.

weak mortar
#

a fundamental concept of examples

keen moat
#

Sure, I can agree with that. But if someone who is still trying to understand the basics is asking for a primer on OOP, I'll probably go for the Animal -> Dog example, because it's very easy to chew. Yes, it glosses over a lot of what OOP is about, but everything that OOP is about is not necessarily what this person needs right now

#

It gives them a starting position to hack away from

noble aurora
#

it also has the added bonus of not being dumb like Squares and Rectangles

rich mural
#

Or at least more.

#

Bringing up the Rectangle/Square problem is a good example of something you could put in an introductory OOP class and provide slightly deeper insight into what designing class hierarchies in practice is like.

keen moat
#

I think as long as you're imparting them with the idea that it's a popular way to tie together structured data and behavior, and then show various good/bad examples of where it can be used, you're probably doing an ok job at explaining it

rich mural
keen moat
#

What is missing?

#

You also don't have to teach inheritance for a while, it's a very specific part of OOP

rich mural
keen moat
#

Hmm ok, but let's say we taught them some OOP, gave them various examples, some more abstract than others, and we now want to teach them about inheritance. Is there a fundamental issue you want to address? from the screenshots above I see Rectangle->Square as a counter-example, but in the end it's just another example you can show

rich mural
keen moat
#

As a tangent, this conversation made me remember the time I wrote a chess game for the terminal, and made the queen class a subclass of the rook and the bishop classes so that I could use their code ๐Ÿ˜„

keen moat
#

I think it was in C++

rich mural
#

Blasphemy

unique oak
#

๐Ÿฅด

misty dirge
weak mortar
#

ok thanks

lavish goblet
#

has this channel been here always?

oak copper
buoyant tinsel
sudden thorn
#

Hello

#

Can Anyone help me with a code

#

Its a C++ program to make a shape like this

silent goblet
#

@sudden thorn This channel is for discussing the teaching of programming. This is not a help channel.
If you have a C++ question, you can ask in an off-topic channel, or find a server dedicated to C++:

worldly dewBOT
#

Communities

The communities page on our website contains a number of communities we have partnered with as well as a curated list of other communities relating to programming and technology.

misty dirge
#

Topic: One of the hardest questions on here to answer, in my opinion, are those about environments and dependency installation. The reason being that figuring out which environment something is installed to and which one is being used to run some code requires command line skills that beginners typically don't have. How can this be answered effectively? When should command line skills be introduced?

#

One approach that I use is "please put import sys; print(sys.executable); exit()' at the top of your program", which at least gives us the execution environment without touching the command line.

sage jasper
#

hm is the command line that unapproachable ?

oak copper
#

My impression is that this is more a matter of people not knowing what their IDE is doing behind the scenes (creating venvs), or not knowing that they have multiple python versions installed, than it is of them not knowing how to use the command line.

sage jasper
#

but using command line to determine your sys.executable is what helps the helper diagnose the issue, i think that's what stel is getting at

#

or in his suggestion, having the user put that at the top of their script

misty dirge
# sage jasper hm is the command line that unapproachable ?

most novice programmers have a lot of experience with consumer software and start their Python journey with some kind of editor that "runs" the program, the novice not knowing that the Python executable exists separately from the editor.

A friend once sent me a screenshot of a conversation we had years earlier, where I was confused as to how I could even run a program without PyCharm.

#

anyway, I remember being intimidated by the command line at first, and for those who are doing all their Pythoning in an IDE, I think this often works out to be their first problem that is best diagnosed from the terminal.

buoyant tinsel
#

Understanding how a text file gets turned into executable code can be quite confusing, but relevant general knowledge, considering viruses etc

winter spear
#

Some context, we're moving our tooling from Matlab to Python

#

I personally think IDEs are bad for beginners

#

Even in C/C++

#

Install GCC and go to town

silent goblet
#

wdym security reasons? PyCharm community is open source

winter spear
#

PyCharm is owned by Russian company... JetBrains is Russian

silent goblet
#

๐Ÿค” its code is still openly available

winter spear
#

DoD doesn't care

silent goblet
#

ah

#

i c

fallow terrace
winter spear
#

because like Stelercus is pointing out, you aren't actually learning basics of the language

misty dirge
winter spear
#

Headquarters might be Czech Republic

#

Well regardless, Security doesn't allow it on the classified systems, and part of that is mandated by DoD

fallow terrace
winter spear
#

I would say if you come under the expectation that you have to fire up your IDE to run the code, you haven't.

#

Especially the scripting languages

fallow terrace
#

I'm of the opinion that for beginners, it's much more encouraging to learn with a run button, and then tie in the terminal after.

winter spear
#

Now if you were doing large C/C++ I wouldn't expect beginners to be making their own MakeFiles for that but imo its an important part of the compilation process that the IDE just takes away

robust bane
buoyant tinsel
#

Thonny is extremely good for beginners imo

robust bane
#

plus most guides instruct people to pip install packages without considering venvs

robust bane
fallow terrace
winter spear
#

So i first learned python from Zed Shaw's book

#

I know a lot of people aren't a fan of it

#

But it teaches you bare bones python and imo you'll be better for it

robust bane
buoyant tinsel
#

I find thonny's debugger very valuable for prototyping, even still

#

Watching step by step what code is doing is awesome

winter spear
#

Never heard of IDLE

#

Wait is this different than the basic REPL?

sage jasper
#

IDLE has both a repl/shell and editor

#

it's really important to point out to beginners that they are 2 different things

winter spear
#

Its not in the basic python install?

sage jasper
#

it's bundled with python yes, at least on windows

winter spear
#

Ah im trying to fire it up on WSL

#

It doesn't come native with linux

#

its probably bc I am using Ubuntu through WSL2

sage jasper
winter spear
#

Usually when I experiment I do it in ipython and then output the session to a file using %history -n

sage jasper
#

which imo is terrible lol (of IDLE)

sage jasper
winter spear
sage jasper
#

yeah i'm not at a computer to try it and was just curious haha

winter spear
#

You can send the entire history to a file or select specific line numbers

quasi latch
silent goblet
#

all my coworkers use PyCharm, but I am immediately lost in there

#

oh and it comes with a terrible type checker

sage jasper
robust bane
#

I dont remember now, let me check

#
~ idle
** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **
~
~ sudo pacman -S tk  
silent goblet
#

@real oar This is not a help channel, this is a discussion channel about teaching programming.

real oar
silent goblet
#

@real oar You already claimed a help channel. Just be patient

real oar
ancient siren
#

it's like starting off at the Graveyard in a text adventure game

real oar
#

@ancient siren Sometimes I can feel pain when I think about this problem, because I am waiting for 4 days.

ancient siren
#

oh i am sorry to hear that, i'm just a learner myself

dusky mirage
#

Can someone help me with (what i assume would be) simple problem with bs4?

silent goblet
#

@dusky mirage This is not a help channel, this is a discussion channel about teaching programming. If you have a question, you should see #โ“๏ฝœhow-to-get-help and claim a help channel.

dusky mirage
#

Ope sorry. Just was suggested to this channel. Thanks

fallow terrace
#

hell, I do it all the time to people at school

rich mural
#

The advantage of IDLE over Thonny is that it comes preinstalled.

#

But Thonny is very easy to install, so I prefer to recommend that.

rich mural
# misty dirge One approach that I use is "please put `import sys; print(sys.executable); exit(...

I've never done this myself, but I think it seems like a great idea, not just because you don't have to use the command-line but because it works no matter how the code is run. Even if you were to teach someone how to find their executable through the command-line, that doesn't guarantee it'll find the same environment as is used when they run their code through whatever IDE they use, but if you put that output in the code, it'll definitely locate the right one.

calm roost
#

Hello everyone, I'm now in the midst of grading analytics students but it seems that performance has been poor and that they are not well-versed in various parts of Python... any tips?

The questions were reasonably advanced, but it seems even their lack of mathematical skills creeps into the code, so that issues also comes up.

I am holding a tutorial session and interest remains low (~25% respondents), but I think among this group, interest is higher. What are good topics to cover? The assignment has a lot of use of numpy, and I think numpy can speed certain python-only loops up (which they wrote), but I'm really wondering what other things I need to say. If possible I'd like to teach the art of 'just googling,' but even on this I can see that they might not know keywords to google

#

I think I could also try to direct them here, but I don't know how gamery they are (or basically if they use discord), and more importantly if that is a good idea to persuade non-discord users to try discord, especially help-related communities like this one

buoyant tinsel
#

Btw, to speed up regular python loops, there are even better tools than numpy, like numba jit

buoyant tinsel
#

Telegram and IRC also have python communities that are very alive

stone juniper
pure heron
mental urchin
#

Hey guys! Where can i learn the pktinker module in python??

mental urchin
rich mural
robust bane
calm roost
calm roost
calm roost
calm roost
stone juniper
#

what sort of mistakes were they making?

calm mural
#

Well depends on which algorithms you want to get to know and how well

#

For datuastructures and algorithms I mainly used hackerrank (but codewars/leetcode etc are options too) and just take an example, see if I can solve it myself

#

And often it required the code to be a certain time complexity

#

which meant you had to use dictionaries or sets or binary trees etc. to make it efficient

#

The sites also show solutions of other people (sometimes only once you solved it) and you can always open wikipedia or a yt video if you really get stuck

#

@lethal raft

#

not sure if that means practicing your skills on problems but sure!

#

practice makes perfect

stone juniper
#

I would definitely recommend learning the basics, that'll keep you from making big mistakes, but for a lot of jobs you don't need to know more than that.
If you're struggling to figure out how other people are coming up with their leetcode (or whatever) solutions, you should probably read a textbook on it. To a certain extent DSA is inherently dense and mathematical.

gray sand
#

Hi Everyone! I am new to python. I want to understand the "[parent=f1]" in python. Why do we create another python function inside of a original python function. What is the purpose/advantage of using this?

Code Example:
def sum(n, lst,):
def sum2(m,k,lst):
pass

stone juniper
stone juniper
calm roost
# stone juniper what sort of mistakes were they making?

I don't have the full frequency yet but

  1. Not checking constraints fulfilled (Variance equality, or approximately equal at least)
  2. Submitting scripts (notebooks) that would error on trying to run
  3. Not understanding RNGs
    I was also asked a lot on iteration and they seem to have a tendency to use while True loops and sometimes do not know how to break out of such loops themselves
tidal orchid
#

when helping someone with pandas, how do you usually balance between "spoonfeeding" and "rftm"?
most of the questions can be resumed to one or two functions (or how to use .loc properly), which I usually do not mind going a bit over on spoonfeeding, but even when it's something with multiple steps, most of the times each of these steps is still just one function
(ping on reply btw)

keen moat
#

Part of the skill known as programming is being able to find the tools you need for the job, and understanding how they play together in fixing your problem. I think there's a connection between being able to use the right data structure and knowing how to manipulate it to achieve the desired result, and understanding what library functions will help you with your problem

#

So I really don't mind just showing them the right page in the documentation and telling them that they should focus on that

#

Because half of their problem is even understanding what to focus on out of the hundreds of available functions

tidal orchid
#

hmm, yeah - most of the time there are some User Guides I could link instead, but if I link the exact function it's not much different from just giving it away?

#

that feels a little bit on the 'rtfm' side, with how large the User Guide pages usually are, but not too much

keen moat
#

Well, I understand the aversion, but this is the kind of thing where it's either pointing them in the right function or letting them continue to wander the maze that is the documentation. With numpy for example, if you're familiar with a set of basic operations you'll probably do pretty well, I assume it's somewhat similar with pandas.

#

At the same time giving a user guide feels kind of artificial, it's like saying "I'm giving you the answer, but I'm not telling you where exactly"

#

I'll link guides when it seems they need a more general overview

#

The core issue here really is that they're not familiar with programming enough to know what keyword to search for

#

And to recognize whether a page they find is relevant or not

winter spear
#

I think with both of them the difference between intermediate and advanced is large

keen moat
#

yeah, true. But what I mean is that if for example you have a solid understanding of magic slicing in numpy, you don't have to rely on a function like np.where

#

A lot of functions are just special cases of other features, so you if you have those basic features down it'll save you a good amount of googling

versed solstice
#

where can I find someone to practice with

winter spear
#

They do the same thing but the np.where let's u treat it as first class and pass it around like operator module

keen moat
#

Sure, my point is that at some point if you know a few of the basics of the library you'll stop searching so much even if there's a very specific function to deal with your specific case

winter spear
#

Right you can get a lot done by learning some fundamental topics

keen moat
#

So being shown those fundamentals can go a long way

gloomy zenith
#

Would it be alright to post a question regarding Python and Vapoursynth here?

#

My remote server has Ubuntu 18.04 installed that comes with Python 3.6.9. Anytime I try to install Vapoursynth R57 it just doesn't get anywhere

#

Vapoursynth folder ends up in usr/local/include instead of usr/local/lib. Also, ffms2 gets installed to usr/local/lib instead of in the vs folder.

tidal orchid
#

See the pins for what this channel is about

gloomy zenith
#

Will do, thanks.

wanton beacon
#

anyone here good at working with git just to ask a question?

tidal orchid
buoyant tinsel
#

Hmm.. I think a crucial but undervalued skill in programming is speed reading

#

It also needs to be trained

#

It would be best if you could hand someone the numpy book, tell them to read it over the weekend to get a general overview

green warren
#

Teaching is "giving things away". If you don't like to explain concepts yourself and help people, then it is not for you.

buoyant tinsel
tidal orchid
calm roost
#

But yes I think they should take an effort to improve their own skills if they seem lacking, hmm...

buoyant tinsel
#

Then it's much easier to ask and look for help

#

Basically solves your initial problem, that your students don't have the lingo to formulate their qurstions

#

Having the book online, in a browser lets me kick back and autoscroll nonstop for an hour or two

#

Books are better for that purpose because they're easier digestible than the docs that come with the code, which aren't intended for excessive consumption

#

Once you have a general overview, youtube videos with animations etc can be very effective to drill down

calm roost
#

๐Ÿ‘

keen saddle
#

They way I learned to code was just to play around with it. Once I learned Lua I moved on to JS, then Python. Right now Iโ€™m trying to learn Java. Anyone else learned this way?

rich mural
unreal bridge
#

What is RFTM?

native hearth
#

it stands for read the fucking manual

unreal bridge
#

So they put the T and the F in the wrong spot?

native hearth
#

no you just got the acronym wrong im guessing

unreal bridge
#

Oh lol

#

RTD is where it's at

native hearth
#

it is rude

#

but on the other hand that doesnt mean you forget about the manual

misty dirge
#

the problem with "read the fucking manual" mentality is that novices typically don't understand how to use docs to solve their problem

unreal bridge
#

And that a lot of stuff has garbage docs

misty dirge
#

yes

#

ironically, I like the discord.py docs, even though they're widely hated. and tbf, it shouldn't be one big text dump.

neon pasture
#

Documentation is not targeted at novices, nor should be targeted at novices.

native hearth
#

garbage docs or not, people should put some effort into reading the docs
this isnt school

unreal bridge
#

And also SO is wildly toxic to beginners

#

Since half the answers for beginners boil down to that hostility

native hearth
#

its not, SO is not a beginner place

noble aurora
#

they're not toxic to beginners, they're toxic to bad questions written by people who don't read the instructions

native hearth
#

stop posting duplicates lmao, its a repository of answers, they dont want duplicates

misty dirge
#

I don't know that I agree what "SO is wildly toxic to beginners". beginners just have incorrect expectations about what SO is.

native hearth
#

its not a Q&A place and its not a forum, stop using it that way

#

the docs thing is close to my heart because i write docs at work for the tools we use and i specifically ask people to suggest improvements to them, to do with structure, wording, examples, images, code samples, and the interns still wont use them

#

helping them with the most minor things when they could open an html page and read from it would be so much faster

unreal bridge
#

If it's not a Q&A and not a forum then what the frick is it

#

How else do you classify questions

native hearth
#

its a repository of answers

#

the same way you would close down duplicate issues on projects, they close down duplicate questions that already have answers

unreal bridge
#

And I also don't get how asking a basic question gets you crucified

noble aurora
#

it doesn't, if it's not a duplicate and not badly written

unreal bridge
native hearth
#

if its a basic question it should be resolved in the docs, why are you asking on SO

unreal bridge
noble aurora
#

that doesn't make it a bad question

native hearth
#

the accepted answer doesnt use sum, but i would close it down anyway because that probably is a duplicate

native hearth
#

thats missing an element in the question

#

sum of comma separated strings, is more involved than sum of ints/floats

#

theres splitting strings, theres mapping int over that, then theres summing

unreal bridge
#

Last one address that

#

But the answer actually ignores that detail funnily enough

noble aurora
#

just because a question can be answered by looking through the docs doesn't make it bad

native hearth
#

yea, one part out of three

unique oak
unique oak
#

it's more that most people think SO is something it's not (and also most people expect spoonfeeding)

wintry pilot
pure heron
wintry pilot
# pure heron Those types of questions will often be closed, since SO's question-and-answer fo...

As that link points out not all subjective questions are removed:

Some subjective questions are allowed, but โ€œsubjectiveโ€ does not mean โ€œanything goesโ€. All subjective questions are expected to beย constructive. What does that mean? Constructive subjective questions:

inspire answers that explain โ€œwhyโ€ and โ€œhowโ€

tend to have long, not short, answers

have a constructive, fair, and impartial tone

invite sharing experiences over opinions

insist that opinion be backed up with facts and references

are more than just mindless social fun

And objective questions (although honestly in software it's pretty difficult to answer many questions objectively) can still have multiple correct answers

pure heron
#

I said "often" and "usually" ๐Ÿ™‚

misty dirge
upper shale
#

what attributes of the api reference would you put on a different page?

misty dirge
#

it's annoying when I have to control + f my way around the whole page

winter spear
#

I prefer book learning too but I recognize it's not for everyone

prisma flax
prisma flax
#

yeah but surely it would take efforts :)

winter spear
#

The issue imo is that learning is both a passive and active process. Book learning is highly passive and being able to translate that into an active process (doing examples) is difficult for a lot imo

prisma flax
#

Makes sense.

buoyant tinsel
#

I've got a couple of issues with SO but the biggest for me is that there is no mechanism to get answers updated. If you search now for some non-trivial problem with python, the accepted one is for python 2.6 with convoluted code because that's how it was done. There is no incentive to post a modern solution for python 3 at all - no points, no community interest. On the contrary, it's similar to a forum with people complaining about raising zombie threads

#

And if you post a question specific to a new version, it gets shot down as duplicate

native hearth
# unique oak why do you say it's not a Q&A place

my idea of a Q&A (which probably is different to most) is that of a reddit Q&A where you have a whole bunch of questions that possibly and probably contain duplicates, some might go unanswered but theres no cleanup/closing mechanism afaik

#

what trips up beginners is that their duplicates/badly formed/irrelevant questions get violently shot down and purged from the site

native hearth
weak mortar
#

!split

sage estuary
#

This is a great topic.

#

Back when I was writing my books, I was very worried about how to order topics, how much to cover, how much knowledge to pre-assume, ... it was very difficult.

#

Since, I've been noticing that very little seems to be written about pedagogy.

#

It seems suprirsing, because we've been teaching each other for thousands of years. But what do we know about the teaching process? What do you knew about how to structure complex material, how to present abstract ideas, how to help learners?

#

it happens in servers like this all the time that people will ask "what's the best way to learn Python?" or "please recommend the best materials for me?" or "how long should it take me to learn Python?"

#

These questions have no answers.

sage estuary
#

I wrote some C++ programming books.

muted scarab
# sage estuary These questions have no answers.

Meta learning is a whole topic, I think the more a person is aware of learning processes the better they can help themselves and others.
Many times I get asked if they should get a paid course, learn from a book or take a video course.
I always try to ask questions before answering them, and of course mentioning how I like to learn

sage estuary
#

Yep, everyone wants to learn differently. I don't think that's wrong.

muted scarab
sage estuary
#

OTOH, there's some adaptation in teaching method that has to happen for each person's preferred learning approach, right?

#

The way I explain something in a video is different than how I'd explain it in prose. (Isn't it?)

muted scarab
sage estuary
muted scarab
#

Learning without curiosity is not learning but memorizing

sage estuary
#

I think that's a good point. If I write a book, it's not up to me to keep you motivated... though maybe my book should try to be interesting and not boring. OTOH, at what point is it distracting?

#

If I give a seminar at a professional conference, it will be interesting. But your motivation is ont my concern.

#

If I'm a college professor, though, should I be working to help you with your motivation?

muted scarab
sage estuary
#

"Curiosity" implies, though, that there's more to the subject matter and it's presented in such a way that people learn diagnostics, testing, fixes, workarounds, troubleshooting for the material, in addition to the material itself.

muted scarab
#

I like Head first design patterns - they simplified the whole process with various textual and graphical additions

sage estuary
#

It seems like a lot of students who take a programming course never, ever use a debugger as part of the course, for example.

muted scarab
#

Because it's basic communication - Do you want the other person to understand you?

subtle owl
muted scarab
sage estuary
#

Meanwhile, count how many times people post wherever, asking for help. The first thing they'll say is "the professor is terrible" or "lazy" or "not teaching anything".

muted scarab
subtle owl
# muted scarab How would you define it?

motivation has more to do about what brings me to it and make me want to acquire that knowledge
interesting has more to do about the pedagogy and how the materials keep me interested and not make me want to switch to a more rewarding activity.

I may be very well hyper motivated to learn something from the presenter, but if the materials are dull or not relatable, I may pay a lot less attention or just leave the room

muted scarab
silent goblet
#

if the teacher is actually doing a bad job, students usually don't complain about it, it seems ๐Ÿค”

queen heron
#

I always try and relate to real world applications as much as possible instead of "If billy has 5 apples..."

native hearth
#

I would imagine its because theres little a group of students can do even if they do complain, its easier to move on and self learn

silent goblet
#

like, sometimes you see a problem or a quiz so terrible your hair starts dancing

queen heron
#

Like repurposing a quiz from a different language

sage estuary
#

I've never known students not to complain. Socrates himself could teach the class, and they'd be pissed about something.

silent goblet
#

Python

#

we don't know the answer

#

but none of the options make sense

#

First, the statement "a variable occupies N bytes of memory" is nonsense. In Python, every variables occupies the same amount of memory. But objects is what they're probably talking about.

#

It's actually not defined in the language spec how much memory each of them occupies. So the question does not have an answer, even if phrased correctly

oak breach
#

Heh

silent goblet
sage estuary
#

I had a similar question in a Java class. Most of the same problems: we don't know the size of any storage, since its below the implementation line in that language.

#

It seems like professors often don't review their materials, hand-outs, quizzes, tests.

green warren
#

I do know that every Python list is allocated with enough space for 4 items. I'm a bit annoyed that I need to know that, though.

native hearth
#

You dont need to, and isnt it 8

green warren
#

I do need to, because I'm using Python inappropriately and I have to care about low-level details. And it is 4.

oak breach
#

Mm yeah its 4, 8, 16...

green warren
#

Yes, I mean when the list is first allocated. And the growth is a funny schedule that starts out exponential but then changes. Fortunately I don't need to know that.

subtle owl
muted scarab
silent goblet
#

the scaling factor is not 2

silent goblet
worldly dewBOT
#

Objects/listobject.c lines 66 to 68

* The growth pattern is:  0, 4, 8, 16, 24, 32, 40, 52, 64, 76, ...
* Note: new_allocated won't overflow because the largest possible value
*       is PY_SSIZE_T_MAX * (9 / 8) + 6 which always fits in a size_t.```
silent goblet
#

not sure if it starts out with 4 items preallocated though

jolly night
green warren
#

I'm using a whole lot of short lists, and it's nice to know that they get pre-allocated to that size, and won't be reallocated.

jolly night
#

i see, you are nearing the limits of your RAM?

green warren
#

No, but I'm writing code for performance, and allocations cost cycles.

jolly night
green warren
#

I told you I was using it inappropriately ๐Ÿ™‚

jolly night
silent goblet
#

hm, how is this pattern explained?

green warren
#

Is it counting the size of the integers? I don't know what Python's integer implementation is like, except that it's some kind of BigInt, which must secretly be an array

silent goblet
#

sys.getsizeof([[[[[]]]]]) is also 64

jolly night
fleet pulsar
#

Were there some changes to BUILD_LIST and related opcodes maybe?

#

It seems like it just stopped preallocating exact chunks, following the standard growth rates

silent goblet
jolly night
green warren
#

I didn't make a claim about the number of bytes, but the number of elements. I was wrong in that an empty list is created empty. But as soon as you add one element, it allocates space for four. At least it does on my system in Python 3.9, where 56 jumps immediately to 88 (and 88 - 56 = 32, or four 64-bit pointers)

#

56 is kind of an amazing size for an empty list, to be honest.

jolly night
#

though i can only see 5 8-byte members: ref count, pointer to type, length of list, pointer to vector, and size of vector.

sage estuary
sage estuary
deep urchin
#

this exists?

misty dirge
deep urchin
#

oH

#

haha, well this channels seems fun

misty dirge
#

Though strictly speaking, you can't prove that anything other than yourself exists, though if that were the case, you already have all the knowledge you could possibly obtain, and the experiences you perceive yourself to have are only unlocking knowledge previously unavailable to your consciousness.

worldly dewBOT
#

Include/internal/pycore_gc.h lines 11 to 20

/* GC information is stored BEFORE the object structure. */
typedef struct {
    // Pointer to next object in the list.
    // 0 means the object is not tracked
    uintptr_t _gc_next;

    // Pointer to previous object in the list.
    // Lowest two bits are used for flags documented later.
    uintptr_t _gc_prev;
} PyGC_Head;```
buoyant tinsel
#

I've had a few profs who taught CS in python who barely knew the language themselves. Basically used it as pseudo code, but not pythonic at all

#

And those questions about mem allocation of variables also feels very much resulting from this

#

You need to come up with some questions to check if people paid attention, you pick some seemingly interesting tidbits you found on the internet

#

Without realizing that memory allocation is not straightforward in python at all

#

I always encourage people to think of python as a general tool, think of questions or problems that might've been bugging them that could be solved or automated by a machine

#

And then come from that angle as motivation and goal, then start the journey in that direction

#

Teaching DS and algos, general functionality etc without a goal doesn't trigger the dopamine system as much

green warren
#

Yeah, this whole discussion about how many bytes are allocated for a list is of course missing the fact that the Python memory model is way more complex and is not really based on allocating one thing at a time. Python grabs whole chunks of memory and then divides them up into pieces.

pure heron
#

Well, so does C

lost urchin
pure heron
lost urchin
#

i am so sorry i didn't kknow am new here

pure heron
weak mortar
#

the thing is its so nonspecific, and it teaches people to generalise

sage estuary
sage estuary
#

Python makes a promise about memory that excuses programmers from needing to worry about that level of memory management. There is no contract that guarantees any particular answer to that question.

#

Sure, you can go look at the source and figure out what pattern List uses when growing or allocating memory.

#

But you've also got to understand that implementation detail changes on a whim. It's not guaranteed, it's not documented, it's not the part of any kind of contract.

#

A professor who's asking these kinds of questions doesn't understand that fundamental fact of implenntation and dependency and complexity management.

#

They don't understand computer science, funamdentally, really.

#

Maybe that's harsh ... but, at least, one of the very fundamental tenets of applied CS.

opaque kayak
#

Hello, has anyone deployed mediapipe pose detection python code using flask for websites. I am facing a problem that the output video streaming with landmarks is lagging on the website. I am trying multi-threading, however, I am facing difficulties. Can someone share their experience on tackling such a problem

pure heron
# sage estuary But in C, you're getting memory -- not objects.

That depends on how you define "objects", really. That's either trivially true because the C language doesn't have anything that you'd consider an object, or untrue because you can malloc the space for a structure, or an array of structures, or whatever.

But my point was that, just as CPython allocates memory from the system in big chunks and manages it in pools, so does malloc.

sage estuary
#

BUT! I think we can all agree this is the wrong way to teach. Focusing students at some trivia like this doesn't help them build an understanding of the language, or programming in general. It's the wrong thing to cover.

#

While this case is obvious, what other cases are sublte? When do professors or cousewear-writers make the mistake of teachnig the wrong thing? How can we identify those cases? How do we fix them?

pure heron
#

Yeah, the CPython growth strategy for lists can be interesting as a case study for a production quality dynamic array, but beyond that it's trivia and implementation details

sage estuary
pure heron
#

Sure. I agree it's implementation details, but every real world malloc implementation has arenas and manages memory in pools. You could make an implementation where every malloc() call makes a syscall to allocate new memory, but it would be terrible, so no one does.

sage estuary
#

Same's true for Python; maybe List() gets just enough memory for a list object; maybe a lot more, maybe less. What it does at that level isn't any part of the language defintion.

#

every real world malloc implementation
Sorry, but this is objectively false. You need to look no further than the tiny C compilers for Atmel or Microchip microcontrollers, for example. And it's really irrelevant to this discussion and the topic of this sub, even if it were true.

pure heron
#

Hm. Well, fair enough, though in the embedded case there's no "system" to allocate memory from.

#

But I agree it's not exactly on topic. I was just pointing out that the fact that Python uses memory pools is not different from malloc() in a typical userland C application

#

I agree with your points about the dubious value of teaching students anything about implementation details, beyond as an interesting case study.

sage estuary
#

I don't think it's dubious; I think it's unambiguously without merit.

stone juniper
#

i agree that question is premised on a category error but to play devils advocate, maybe there is some value in just getting beginners to make the connection python objects are data literally stored in memory

sage estuary
#

That connection can be established in a much more direct way.

delicate flower
#

yeah for a beginner class trivia about implementation has no merit

sage estuary
#

And it should be obvious, anyway: if a program stores data, then it's using memory. Where else would it store data? How could Python objects possibly be anything but memory?

#

Asking a question about the storage size doesn't establish that relationship because it draws focus on the exact size ... at least, the relative size of different objects, from the the way that question was worded.

pure heron
stone juniper
#

its obvious to anyone moderately experienced in programming or computers, but kids are abstracted away from those things in every day computer use, and many beginners struggle to understand the concept of objects apart from the literal python syntax in the py file

pure heron
#

When you learn a C like language, you learn an abstraction where memory is like a big array, and pointers are indices into that array. When you start with Python, the entire concept of memory is foreign and needs to be introduced.

sage estuary
#

I've been trying to find the same question in the class I took. It was for Java. I wanted to burn the place down -- so frustrating!

sage estuary
# pure heron Beginners don't exactly know what memory _is_.

Maybe. But then I think that means we're teaching things in the wrong order. Students are being asked to write programs when they don't even know how memory is organized, what the processor does, what the machine architecture is or what the computing model is.

silent goblet
weak mortar
#

if it was (True), ("True"), ["T", "R"..., (1)

noble aurora
weak mortar
#

that'd be better. but it isn't even a good question because it'll never be helpful!

sage estuary
#

Here it is. Now, I can finally vent! ๐Ÿ™‚ This was in an Algorithms class, which my school for some reason separated from Data Structures. Taught using Java, and the Java version of the Sedgewick book.

stone juniper
sage estuary
#

Frequencies? Wha ... ?

stone juniper
#

or voltages or whatever
see? i dont need to know anything about EE

sage estuary
#

Voltages, yes. You could use a frequency (or a phase, even) to represent a one or a zero in an RF signal.

sage estuary
# stone juniper its obvious to anyone moderately experienced in programming or computers, but ki...

I'm not so sure I agree. People who use computers know that data takes memory. If a one-page letter in Word creatses a 350 megabyte file, they know something's up. Look at any forum where people bitch about how much memory Chrome uses, for instance. They think 1.5 gigs is too much, but they have no estimate for how much it should use. They're unaware of everything the browser is doing, how memory works ... but they do know that data takes up memory.

pure heron
sage estuary
#

Either way, it seems like teaching CS majors should start with what's usually in a "Systems Architecture" course. What's the processor really doing? When I think of a program or algorithm, what am I really asking the machine to do?

pure heron
#

That's usually a second or third year course, for good reason I think.

sage estuary
sage estuary
stone juniper
#

yeah i disagree with that, the connection to what they see as the final product of programming will be totally missing

pure heron
sage estuary
#

isn't that exactly what an architecture class teaches?

pure heron
#

If you don't understand the concept of a conditional, learning jump instructions is a bad place to start.

sage estuary
#

Sounds like you're thinking of the ordering of specific small topics within an architecture class, now. I can't figure how that supports your claim that the architecture class should be taught later rather than sooner.

pure heron
pure heron
#

Are unis that teach systems architecture in year 1 common? I don't think I've ever heard of one

stone juniper
#

mine was year 2

pure heron
#

Mine too.

sage estuary
#

Nope -- and I suggest that's a problem. The ACM's standard curricula (which is what accredited colleges mostly use, in the US) puts it in the 3rd year.

pure heron
#

So... What makes systems architecture the ideal level of abstraction for introducing computing, in your mind? Why not something lower level, or higher level?

sage estuary
#

"ideal" is your characterization, not mine.

pure heron
#

You said "should", which I understood to be your opinion about how things would happen in an ideal world

sage estuary
#

I think that intro to programming classes -- CS110, or whatever it ends up being -- can be augmented by architecture learning in a very useful way.

#

Books like Code or Understadning the Machine have an important place at this level of the curricula.

stone juniper
#

why?

sage estuary
#

Straight to one of the Patterson books? I don't think that's necessary. But discussing the underlying concepts of information theory and computer science seems like the obvious place to start.

pure heron
#

Why?

sage estuary
# stone juniper why?

Because they establish important concepts about programming: information representation, system organization, computing model, and so on. The explain why so many concepts are important. Why do we use binary, for example?

#

In conventional curricula, these ideas are left for later -- either for the student to swallow whole, or for them to reason out themselves later.

pure heron
#

Grade school students don't learn why we use decimal before they start learning arithmetic. Why should computer science students learn why we use binary before learning about functions and control flow?

#

For that matter, history classes don't start with Babylon.

stone juniper
#

at the risk of committing heresy, i think the comparison is even more apt because the use of binary in computing is almost as arbitrary as the use of decimal in grade school arithmetic

sage estuary
#

Assignments in those classes are usually pretty simple. They're intro classes, after all. Read a file from disk, sort it line-by-line, print it out. Or get a number from the user, n. And print out a christmas tree with n rows. n == 3:

   *
  ***
 *****

Students with no understanding of the computer -- what does it even do? How are programs structured? -- don't understand what means to "read a file" or "loop". Yet we expect them to jump right in to Java or C++ or Python or whatever language the class is using and solve these problems.

Their natrual ,and understandable reaction is to wonder why it's so hard. The have no framework for decomposing the problem into smaller problems or steps becaues they don't understand what those steps might look like. Why isn't there just one step: "print the tree"?

sage estuary
pure heron
#

You need to start at some level of abstraction. You've asserted that starting at a very low level would be better, but you haven't explained why you think so, or why you've chosen that level instead of an even lower one, like the subject of electricity and transistors.

noble aurora
#

for simple tasks in an intro course, you don't need an extremely detailed low level understanding. a simple "layman's" high level understanding is enough. a loop simply repeats some actions. there's no need to know exactly what machine code is produced, because they understand it at a high level

sage estuary
#

Right -- I'm suggesting a high-level understanding of the low-level concepts.

pure heron
#

When we teach people how to drive a car, we don't start by explaining how a drive train works.

sage estuary
#

I think that's pretty obviously a broken analogy. CS isn't teaching people how to drive cars. It's more like teaching them how to build them.

stone juniper
#

i'd even say that a python loop is a self-contained concept on it's own, that's why the python language doesn't need to specify an implementation

sage estuary
#

Simiarly, elementary kids are learning basic mathematics -- not number theory. CS students are a lot more mature in thinking, and are a lot closer to learning number theory than learning simple mathematical operations. (In fact, Discrete Mathematics is often a part of CS curricula.)

pure heron
#

Or why birds like bird houses ๐Ÿ˜‚

sage estuary
pure heron
#

Perhaps a better analogy: when we teach people to cook, we don't start by explaining the molecular reactions that make eggs whip up or steaks brown.

sage estuary
# pure heron Or why birds like bird houses ๐Ÿ˜‚

Of course not -- because we're sensible about choosing the abstractions we use, and those we take for granted in the context of the class. The only reason someone would suggest otherwise is to make an absurd argument to the contrary.

#

Sometimes, we do: Chemistry of Cooking or Cluinary Reactions, for example. Salt Fat Acid Heat, too.

silent goblet
#

what are you arguing about?

stone juniper
#

the proper abstraction level for CS beginners

silent goblet
#

it depends (c)

#

that's my 2 c ๐Ÿ˜Ž

sage estuary
#

I know you're being glib, but it does depend -- different people learn in different ways. But the educational system and the curricula it delivers doesn't care about that: it's invariant for each stduent.

pure heron
sage estuary
# stone juniper the proper abstraction level for CS beginners

I think my assertion is a little simpler: that an exposure to fundamental system organization and architecture concepts has a place earlier in the curricula for CS-path than is usually delivered today. I make this claim because I think it's important to acknowledge these topics as a key to understanding even simple programs, rather than deferring that understanding to after those concepts are delivered.

#

This assertion came back to me with various disingenuous analogies, but I think it holds water. I'm not suggesting that we start with a hard-core architecture class; instead, that something like the first chapter of Structure and Interpretation mushed up with topics from Code and Understanding the Machine be covered at the same time (just before, I guess) students are introduced to their first programming language.

pure heron
#

Would you put "what is memory and what is a CPU" ahead of "print('hello world')"? Ahead of x = 1 + 2? Ahead of functions? Ahead of recursion?

sage estuary
#

I never said I would.

pure heron
#

You haven't said anything concrete, that's why I'm asking

sage estuary
#

Instead, I'm suggesting they're used to teach each other. If we start with x = 1 + 2, we're obliged to explain what x is.

#

Sorry, but this is a suggestion. It's not an implementation. I can't point you to my textbook or lesson plans just yet.

#

Intro to programming books will typically talk about data types and assignments and xpressions; then hurry on to loops and branching and conditionals.

#

Instead, why not take a beat? Introduce expressions. Explain where they're stored; explain the difference between code and data.

#

Explain that, after each step, we're in a known and consistent state.

#

Then introduce what other steps there are -- loops and conditionals and so on.

stone juniper
#

hm would you pick python for the language in this curriculum?

sage estuary
#

I think there's a lot of ways to reach that goal, which is why I've talked about the goal rather than the concrete steps to get there. The goal itself (cover the organizational and model fundamentals) is more important than the prescriptive steps to get to that goal.

#

I don't think the approach I suggest is incompatible with Python -- or any other language, really. So, why not?

pure heron
#

So, at the point of explaining x = 1 + 2 to a student, how would you explain what x is?

stone juniper
#

i think that python is a great first language, but it's further away than some other languages from the stuff you'd be trying to each alongside it
so I'd be worried that you'd be introducing unnecessary complexity by using python and erasing its benefits

pure heron
stone juniper
misty dirge
dusty oriole
#

would be nice if the projects were usually shown as projects (how theyre organized, how to make Python version work only for this , how to read the documentation, its a foreign "language" and its being taught like math)

white bough
#

Generally we are constantly talking about almost bare beginner stuff, but there is already so much out there for it. I suggest we talk about intermediate python and advanced python.

There is almost nothing or rather splintered or bad stuff out there for anything above beginner.

The first thing to talk about could be what is actually beginner, intermediate , and advanced python.

fallow terrace
#

I think the distinction between them is useless to make. My personal division of resources goes simply as "beginner-friendly or not so much?"

cosmic aspen
cosmic aspen
misty dirge
#

(for the record, I've never been in a car accident.)

noble aurora
gentle oriole
cosmic aspen
#

The difference between driving school and learning to be a mechanic....

#

Dont mix the two lol

#

Python is great for learning to drive...aka programming...less accidents waiting to happen unlike C , Java...focus on the road....eg core logic, variables , loops, etc

noble aurora
#

it is actually quite analogous to driving manual vs automatic

#

at least here in the states, almost no one drives manuals anymore

cosmic aspen
#

C, C++ For mechanics who want to build cars like compilers and interpreters

cosmic aspen
#

And those that have a need for speed and are not afraid of 'accidents' like memory leaks

cosmic aspen
silent goblet
#

dynamic typing though...

#

That's one manual bit

#

"We don't need street signs or road markings, drivers should just know how fast to drive and where the road is. And if they park in the wrong spot, no worries, we'll just remove their car"

cosmic aspen
silent goblet
subtle owl
noble aurora
#

until you get towed

subtle owl
#

garbage collected*

#

Although in the context of that analogy, that would only be a runtime exception, no different than when trying to mix the wrong types together

sage estuary
sage estuary
native hearth
#

I think the globals part is whats gonna trip up most beginners

sage estuary
#

Then we find a way to explain it, and help.

#

The negativity seems remarkable. Maybe the overarching "can't do it" and "shouldn't do it" attitude is why teaching seems so difficult; why few are interested in investigating and experimenting with improvements in the pedogeological arts.

#

Me, I think scoping is a bit harder to understand than global visibility.

noble aurora
#

aren't they related

sage estuary
#

But it highlights the issue of finding a path. We have to talk about functions (and modules, or whatever other scoping the language offers), then talk about variables, then talk about lifecycles, then describe variables in the first place ... all with a mind towards erasing the lies we've told when we need to findally describe low-level addressable memory and machine stack.

#

What's the best order for doing that? I've been questioned that it's difficult to describe A before B. And sure, it is -- or it can be, without care. But in what order should things be described?

#

So many students learn about pointers in C, and get stuck. They have no idea what the concept means or how it can be applied.

#

All those students are saying is that they don't know what memory really is, how it works, how to manage it (or how it might be managed for them).

#

When I was in second grade, I claimed that there was such a thing as negative numbers.

#

My teacher insisted they didn't exist. That 2 minus 5 was just impossible, and I shouldn't engage in such nonsense.

#

I brought in a pocket calculator -- at the time, worth probably $50 or $80 -- and demonstrated: 2 then - then 5 then = showed -3 on the LED display.

#

Despite my demonstration of a concept at least two millenia old, I was sent to the principal's office.

#

A few short years later, kids who demonstrated that 8 * 17 * 39103 == BOOBIES were subject to no sanctions.

#

And so I think we must be careful with some abstractions. If a student isn't pursuing a CS degree, maybe they just want to use Python abstractly to analyse results from their physics or chemistry equiment, or try to run simulations in the stock market or anaylse stats for a psych study.

#

They don't need the details. But a CS student must come to understand the machine architecture, sooner or later.

#

Why unwind lies?

queen heron
#

Might it be for the sake of progress? If the entry material is more challenging/difficult to grasp, the overall progress could be slowed

#

is it quicker to teach a simpler concept, and then unwind it to explain deeper, or is it quicker to jump right into the deeper ideas?

cosmic aspen
sage estuary
#

WEll, sure. We all use abstractions for progress. We use them to ignore things and focus somewhere else.

#

But an abstraction -- even an insufficient one -- isn't a lie.

queen heron
#

It might have them forming a different mental image of the concept, but that's ok

sage estuary
#

To a point. If that mental image is incompatible with reality, then it's harmful.

cosmic aspen
sage estuary
#

If it's a little off, not perfect, no bigs. But wholly incompatible? I insist we can do etter.

queen heron
#

but it's compatible with their current tasks

sage estuary
queen heron
#

The mental image they have should be solid enough for completing their current tasks. As we dive into deeper topics, we can slowly replace pieces of that image

native hearth
#

I must have missed the part where "lie" is used, where is it mentioned?

cosmic aspen
sage estuary
queen heron
#

I'm purely a python coder. I know there's deeper knowledge out there if I go the path of the C languages, but I'm happy in my ignorance

sage estuary
#

OTOH, if I am a CS (or maybe Systems Engineer, or Electrical Engineer, maybe a few others) I do need to understand the details.

queen heron
cosmic aspen
fallow terrace
#

wait no what

#

I don't know what I'm saying

#

manual is worse a lot

#

please ignore me

cosmic aspen
sage estuary
#

Who's next to the right? Gauss?

sage estuary
#

People who love that course are likely to be natural born CS-killas. People who hate it are probably better off with another path, another vocation.

queen heron
#

I had a Java class in highschool and hated it

cosmic aspen
#

Why Python at high school is better

sage estuary
#

or, are you asking?

fallow terrace
#

I'm taking a Python class in HS right now, and it's kind of annoying how the course doesn't use proper python idioms

#

e.g. the number of times they use camelCase istg

cosmic aspen
#

or EE

fallow terrace
#

I feel like that part is really important (the idioms), because they help with reading code and writing readable code so much

#

And programming is just as much reading as it is writing, if not more

cosmic aspen
#

And programming is needed almost everywhere

#

You dont want to turn off people from programming with a hard first language when they are still uncertain of their majors

white bough
# noble aurora i agree with dawn here. what's the point of making these divisions past the begi...

Let me rephrase that:

There a bazillion tutorials about how to unpack a tuple and stuff.

Almost nothing for:

  • Meta-classes ||I know Metaclasses are deeper magic than..., but at the same time a lot of heavy used and praised libraries and apps use them and nobody is complaining there||

  • Mixins ||same as above, they are vilified as bad but a lot of praised libraries use them, I even saw django mentioned as a library that is perfect to read good code and it is completely Mixins||

  • correct multiple inheritance ||same as the two above||

  • python tricks (ala descriptors and dunder stuff) ||I repeat myself, people say this is bad but will use any ORM all day, that does this||

  • protocols and ABC's

  • more advanced decorators than just time the function or print the args

  • extensions, via hooks or via runtime importing

  • importing stuff that is more than import os

  • packaging as a whole, but just a well structured and mostly complete packaging tutorial

  • peripheral stuff like cython

  • Project structure that not only goes beyond use this cookiecutter but also maybe shows different approaches to it

  • In-depth GUI

  • correct documentation that goes beyond just generally saying how you technically do the documentation, but also what to write with real life examples and package documentation (ala sphinx/pydoc/...)

  • type hinting, omg a real good type-hinting doc ||please do not say the mypy docs as they are quite confusing see #type-hinting ||

  • Concurrency in all its forms with examples that aren't just sleep(10) # this should simulate work

...

  • And last but most important: Performance considerations, that are not only up to date, but also collects all the tidbits in a place and give concrete tips and examples

Don't care what it is called, but this is what I mean and everything beyond the basics is basically a desert in regards to good courses/tutorials/docs.

noble aurora
#

that's just not true

#

there aren't really any "intermediate programming tutorial" videos, sure, but that doesn't mean there's a lack of resources. they just tend to be more specific to a specific idea. they're also less approachable, stuff like docs or blogs

white bough
#

thats what I meant with fractured

sage estuary
#

Docs are less approachable? Than ... videos?

noble aurora
white bough
#

If you want to write a tutorial, do not write another basic tutorial but maybe do something like collecting those fractured ideas (maybe as a group effort) in one place and rewriting them to be less abstract (explaining instead of reading the docs for a class that just also does the thing)

fallow terrace
#

In that case, why not focus your efforts into improving the docs?

#

If they're not helpful at the current moment, then you should leave the docs as the single source of truth, and just make them better.

white bough
fallow terrace
#

Once you get past the "basics," a tutorial is only so helpful. To make something useful, you need to know how to take the build blocks and apply the glue. That's not something you can teach. The best you can do is make the building blocks nice to use.

#

If it wasn't clear, the metaphorical building blocks could be the "more advanced" features or various libraries or whatnot.

white bough
#

Ok then in the spirit of this channel :
how do you identify the blocks of various "advanced" concepts and how do you approach recombining the blocks for use?

fallow terrace
#

Maybe my analogy was unclear and only makes sense to me. My metaphorical blocks are different features or libraries or anything you use, really, and the metaphorical glue is the code you use to combine them.

#

Each application will require you to write different "combination" code, so tutorials aren't really useful at a certain stage imo (unless you're doing exactly what the tutorial was made for).

#

That's not a skill that can be taught, it takes time to learn. I think that the only thing we, as a community, can do to help with that is make the individual "blocks" easier to use.

waxen fox
#

I think you mostly just teach the concept by basic decorators, decorators are more of a case-by-case basis

winter spear
sage estuary
#

Understanding descriptors is a key to a deep understanding of Python because they are the basis for many features including functions, methods, properties, class methods, static methods, and reference to super classes.
Doesn't everyone use descriptors?

noble aurora
#

no, not really

waxen fox
#

I only ever make descriptors for fun, it's not a need-to-know concept or anything

#

Sometimes the icing on top is all you need, no need to dig into the cake

sage estuary
#

The docs say they're used for functions and methods.

#

And properties, and ...

noble aurora
#

but almost no one needs to make their own

sage estuary
#

Melen's coworker didn't make their own, did they?

noble aurora
#

huh?

waxen fox
sage estuary
#

I SAID: MELEN'S COWORKER DIDN'T MAKE THEIR OWN, DID THEy?

noble aurora
#

oh, i missed that context

coarse thunder
#

hello can anybody help me

#

i have an error in number 1

fallow terrace
misty dirge
#

@coarse thunder you are continuing to write off-topic messages. please refer to dawn's message about which channels to refer to, and DM @viscid mural if you have any questions about that.

winter spear
#

You don't need like 9/10s of the python data model, but didn't make it any less useful

misty dirge
#

@sage estuary thank you for your willingness to help this person. Please do not prolong off-topic discussions.

noble aurora
winter spear
#

Reread what I said

winter spear
#

He wasn't talking about know how a descriptor works at all

#

But why would he ever use one

#

Much to omar's point we all use them all the time and then he goes and uses one specifically from a library

#

param.Parameter is a descriptor and is literally the point of the library

sage estuary
#

Wow, deleted and everything?

#

Why do descriptors have such a bad rap? (Or is that off-topic, too?)

#

Also: my eyesight is terrible. I can barely see emojis, so all I have is the descriptive text. Which is "scboplaugh" and "pepelaugh". What are those symbols meant to convey?

#

Sorry @coarse thunder, I am unable to provide help in DMs.

waxen fox
sage estuary
#

It seems like there are many strong opinions about what to teach earlier or later.

#

They range from "A should be taught before B", or "X is a terrible beginning language and that's not controversial".

#

How do people arrive at such opinions? After all, they can only learn programming once, so it can't come from experience.

#

Is there any more subjective information about these things?

#

People will draw analogies. "We teach children J before K, and that's sthe same as B before A!"

#

But what research or studies are done on these subjects?

fallow terrace
#

Teaching others can also provide the experience necessary to make such judgements.

sage estuary
#

Can it? That implies everyone learns in the same way.

#

Or, at least, that we identify people who learn best in certain ways, then correlate that against how they tried to learn, and measure their success quantitatively.

fallow terrace
#

Well, nothing will work for everyone.

sage estuary
#

That sounds hard.

#

We'd also have to isolate history. The languages available changed over time. For a time, everyone learned machine language first, since that was the only language available. Period! It's what I learned first in the 70s, since it was the only language available to me.

#

Lots of people in that era learned languages that are dead or despised now: BASIC, Pascal, COBOL, for instance. Those people didn't have such a hard time learning about computers, and went on to contribute (very!) positively to the field.

subtle owl
#

There were many less layers of abstractions in these times as well.
So going bottom -> up or up -> bottom didn't matter as much

#

It's also reflected in the projects written by the students. a few years ago, writing a socket based program was huge. Now people are doing DL based video classification and analysis

sage estuary
#

Yep. to me that sems like an advantage. Expectations were much less, too. New developers didn't have the goal, for example, of writing a AAA game title.

storm plaza
#

What's the best way to learn or get into machine learning?

sage estuary
#

Are such projects teaching much? they're really just gluing a video management library to a cloud-based platform. It's integration, not development.

#

Which is valuable, at some level.

storm plaza
#

or beneficial way?

subtle owl
sage estuary
# storm plaza or beneficial way?

Anything you do will be beneficial. Most people fail because they don't stick with it, not because they chose some path that wasn't somehow "best".

storm plaza
sage estuary
#

Why not take a class at your local college?

#

There are also any number of courses on Udemy and whatever other online service you can name.

#

I learned from Machine Learning, by Mitchell. It's a classic. It's out of print, tho, and hard to find.

#

Learning from Data is very good. By Mostafa, et al. Fundamentals of Machine Learning is great, especially the newer edition. Kelleher, et all.

#

What's your goal? Are you thinking of a particular project? Some particular problem?

waxen fox
#

Unnecessary information that will just confuse the students

sage estuary
#

Well, I think it can be easy to identify what things should be taught sometimes.

#

Flushing probably isn't important. OTOH, if we're teaching a class in C++, and insisting that students use iostreams for input and output, it's totally necessary to teach about flushing because their programs will break in weird ways if they don't understand what's going on.

#

And they don't have the tools (knowing how to use a debugger, knowing how to debug into/from standard libraries) to diagnose what they've done wrong.

#

For other platforms not so fussy with buffering, it isn't important and would be confusing.

#

Is there nomenclature for this? How do we reason about identifying interedependent ideas, and ordering them in a curricula? What I worry about are situations when the ordering isn't quite so clear.

storm plaza
#

but thanks

cosmic aspen
cosmic aspen
dusk relic
#

Does anyone have recommendations for online Python courses that also incorporate some aspects of software engineering? While I personally have tutored Python in years past to people already enrolled in classes, Iโ€™ve been asked to recommend a course for some electronics manufacturing technicians to learn Python alongside modern best practices in software construction.

ripe folio
#

You're literally better off explaining less so that I think I know (the less you get me to think about it, the better), but wouldn't be able to explain it to someone else. It's why in movies, especially with science fiction plots, there's often a lack off scientific explanation and because the movie characters accept and seem to understand it, you do too.

#

I never understood methods for classes (like at all) and the difference to staticmethods, classmethods and properties, until I learnt about descriptors.

buoyant tinsel
#

I think we should stop thinking about the right order of topics that will work for everyone and instead teach the tools and resources needed to drill down if they desire or require. That means debugging, documentation, profiling, introspection.

#

With those tools you can learn those details on your own whenever you feel curious or required by practical necessity.

white bough
buoyant tinsel
#

Step-by-step debugging should be taught in the very first session. Tools like ast and dis in the second. And then go from there

ripe folio
buoyant tinsel
#

Whenever there's a question about internals, they then are able to answer them on their own

ripe folio
#

Too many people see errors and stop everything and think "ahhh error, but this should work" then either give up on that approach or ask in help-forums like these.

buoyant tinsel
#

Well, ast and dis I would mention and show a quick example but not go in deep

#

Anyone who's curious will look further on their own, people who don't care, don't have to know

ripe folio
buoyant tinsel
#

But even those will have heard those terms and can google if needed in the future and don't be completely dumbfoundef

buoyant tinsel
oak breach
#

running your code in your head is another important thing to learn to do

buoyant tinsel
#

I also would show the data model page of the docs very early on. It's one of the most important pages imo and gives you a good idea what's possible in python and reduces dunder-anxiety

white bough
#

without fanning long cold flames,
Refering to google to solve problems in python can be confusing.

One of my first questions that I searched for:

how do I iterate through a dict as key, value pairs

Answer I found:

easy, dict.iteritems()โ€ฆ

Or recently:

is the range function a generator?

Answer:

no it is not.

Further down

you have to use xrange

Please always make sure to tell people to check the time when the answer was posted.

oak breach
#

yeah

#

i think SO has this problem too

buoyant tinsel
#

Was so frustrating when I tried to work out a problem with pyqt and all the answers were outdated and had to be pieced together

#

But that's definitely not a problem only beginners have to struggle with

white bough
white bough
buoyant tinsel
#

Maybe a wiki of sorts that link to concepts related to a certain dunder?

white bough
#

There is a page, need to find it again , that explains dunders real well with examples and good site design, but it is outdated. Which leads me to a related point, findig out which dunders were changed when is really hard for some reason.

buoyant tinsel
#

Hmm. I would rephrase the whole thing, sounds way too unapproachable.

#

But the examples interleaved are nice

#

I somehow have to think of the gentoo documentation

#

They put an extraordinary amount of work in that

rich mural
#

!rule 6

worldly dewBOT
#

6. Do not post unapproved advertising.

rich mural
#

Please message @viscid mural to request approval.

orchid thistle
#

imo a general thing with teaching anything is that there isn't a way to do it that will work for everyone

#

there isn't just one way to teach programming that will work because different people will understand different things and be good at different things and different explanations will work better and.........

#

there are obviously some things that will be true for most people and are reasonable things to default to, but if you make a huge detailed plan and refuse to rewrite it according to what the person learning actually needs that you couldn't possibly have predicted beforehand, you're not going to get anywhere

#

so really if you want to teach programming, you need to be flexible enough to account for anything that could reasonably happen

buoyant tinsel
sage estuary
sage estuary
buoyant tinsel
#

With jupyter you get a similar effect with the ? Magic for documentation, vars

misty dirge
#

jupyter for debugging? ๐Ÿ˜ 

buoyant tinsel
#

Both jupyter and thonny but also other IDEs have good introspection and documentation support

sage estuary
# cosmic aspen It is something like curriculum design and proper labeling of course prerequisit...

Well, sure -- someone should design the course, and it would be great if materials were reviewed and edited before they were turned loose on their audience.

I think the questions being asked here are about how to best design a class or other learning material, like a book. Various decisions are made in designing course-ware. How can those decisions be evaluated for their efficacy? Is one way really better than another? Is there a "right" way, or patterns we can identify, or ... ?

buoyant tinsel
sage estuary
buoyant tinsel
#

I like jupyter for teaching as a field diary

buoyant tinsel
#

Many concepts become self-explaining, like loops etx

cosmic aspen
#

Do AB testing of various approaches to see what is better

sage estuary
#

It took me about nine months to write my first book, for example; should I spend six months more or so to write the B-version, then a year of testing and revising, before releasing the book?

sage estuary
cosmic aspen
#

So the next batch will get a better book and you obsolete old books and sell new lol

buoyant tinsel
sage estuary
buoyant tinsel
sage estuary
cosmic aspen
buoyant tinsel
#

I always try to find examples that people currently are concerned with, something they can relate to, but I haven't got a patent recipe either

sage estuary
# buoyant tinsel Oh yeah. That's the real hard question, isn't it

Well, I'm not even sure it's possible. Or even the responsibility of the instructor. For sure, examples and themes should be relevant (and maybe that's what you mean by "good"?) but "interesting" is subjective and fickle. It can also result in material that ends up excluding parts of its intended audience.

cosmic aspen
sage estuary
#

Most people have taken classes, like at college, right? How did the course material end up being as it is? What was it presented as it is? For sure, this is almost exclusively up to the professor -- they'll specify a book for the class and then completely ignore it. Or follow it chapter-by-chapter exactly. Or anything in between. Are they just shooting from the hip? Are they doing A-B comparisons like tanuki suggests? Or iterating? Or even considering their feedback? What about all of the material they have to come up with themselves -- hand outs, quizzes, homeworks, tests, labs, ... ?

#

Maybe one professor has a quiz every friday. Maybe another has no quizzes, and just three tests plus a final in the semester. Which is better? How do we know? If we were to write a book on Python, should we try to support the first teacher or the second teacher in the book's structure?

buoyant tinsel
#

Or give up and go back to R because they realize they suck at python..

sage estuary
buoyant tinsel
#

A prof of mine did, at least

cosmic aspen
sage estuary
#

Neat! Do you have a link to the paper?

cosmic aspen
#

Pm me i will send you pictures of the journal soon as I return home ...it is in a paper form lol. I am in the hospital as the guardian of my mom who will be released tomorrow.. she is fine dont worry but I was stuck in hospital with her since admission

sage estuary
#

Ugh. Good luck with your mom. ๐Ÿ˜ฆ

cosmic aspen
cosmic aspen
buoyant tinsel
#

In pharmaceutical engineering (which I studied) python could've been used to model statistics (monte carlo) in test design or give a glimpse into fluid mechanics..

#

Enrich dry theory with some hands-on programming

cerulean sable
#

yo ppl sup..am facing a difficulty in coding this so pls help

#

whats the error in here??

buoyant tinsel
cerulean sable
#

omg am new to this

buoyant tinsel
#

No prob

cerulean sable
#

which chan do u think can help me??

#

hmm

#

thanks btw<#

buoyant tinsel
#

There are help channels pinned, you can claim

cerulean sable
#

dude do u know anything about coding python??

buoyant tinsel
#

Yes.

cerulean sable
#

woah..

#

then pls help

#

whats wrong in that program

cerulean sable
buoyant tinsel
#

If you ask in the main channel, there are enough people who can help you

cerulean sable
#

whers the main chan??

buoyant tinsel
buoyant tinsel
#

Ahh. It's a channel

#

Nvm

#

I want my irc back lemon_grimace

cosmic aspen
cosmic aspen
# buoyant tinsel It might help to get some ideas/stories/problems from other areas/departments th...

Yes cross pollination of disciplines sometimes is fruitful and might lead to unexpected collaborations that lead to an Academic Paper being published lol like in my case. I saw an opportunity to make a courseware as a Dev in a Uni IT department and I proposed it to the Physics Department. The uni funded our study after we submitted a proposal. We conducted the courseware AB test versus old style lecture without the courseware and we got published

cosmic aspen
misty dirge
#

Topic: In my experience, object-oriented programming is the preeminent style taught in CS education. Does it deserve this status?

#

Pretty much all of my programming is either data science stuff for work, and the occasional contribution to the @worldly dew bot. Python's data science ecosystem has classes for the sorts of data structures and tools one might need to use, but doesn't really encourage you to create new Python classes, or to use classes in a C++/Java-style of OOP.

#

I think the way the discord.py library uses OOP in an intuitive way (there are classes for users, messages, channels, and other things that "exist" in Discord), but the actual code that you write is basically procedures that use those Discord types in response to various events.

#

Anyway, I think the value of OOP design principles (single responsibility, encapsulation, conceptualizing everything as objects interacting with eachother) are overstated, and that newcomers to programming shouldn't be encouraged to approach problems that way from the start.

green warren
#

Newcomers to programming have very little use for OOP, it's more of a tool for designing larger pieces of software while keeping them testable and understandable.

cosmic aspen
cosmic aspen
#

Before the dawn of OOP many learned procedural C and had implemented a lot using it

misty dirge
#

I mean, you can do anything in C if you're patient enough

rich mural
# cosmic aspen Maybe true...I find functional programming more appealing after doing OOP in mul...

I see functional programming and OOP like tools with different purposes. Functional programming helps in the small scale and OOP helps in the large, they don't really overlap or compete much. And in both cases, it pays not to be overly absolutist about either principles or techniques. What @misty dirge said, and also, with respect to functional techniques, sometimes a for loop is better than a list comprehension, for example.

cosmic aspen
#

During the transition from C to C++ a couple of profs teaching numerical methods just swapped scanf and print f with cin and cout lol and did procedural in an OO lang

#

Found it funny that some of them couldnt define OOP and had to ask me but they were scientists first coders second and it was when OO was new

#

Sometimes it is simply not needed

#

Big framework type projects benefit from OOP but they arent the stuff many do code since it takes much effort

rich mural
#

If I'm writing a small program in Java (maybe because the jvm is the only runtime environment available on a deployed environment), I don't bother with creating class structures unless they serve an explicit purpose, I mostly have a single class with a bunch of static methods.

#

Doesn't matter if the language design is hardcore into OOP or not.

cosmic aspen
rich mural
#

Yeah, I mean, I use a single class in Java because you're forced to.

#

In Python I don't use classes at all until the program grows to a certain size.

#

With functional it's a different type of consideration, some problems can be solved very neatly with functional techniques and others are simpler and more readable with imperative code.

cosmic aspen
rich mural
#

Yeah, unless you need to model shared state between many functions, that's sufficient.

buoyant tinsel
#

I find OOP useful to get nice APIs

#

I prefer functional style for testability

rich mural
#

Like @cosmic aspen said, you can encapsulate with modules too.

#

It's just that if you have shared state, you might not wanna pass it in as an explicit parameter in every call.

buoyant tinsel
#

But having a single op vs needing to type a function name can make a huge difference in usability

rich mural
#

A single "op"?

buoyant tinsel
#

/ vs divide()

#

It's not the correct term

rich mural
#

I mean, yeah, if you are modelling an algebraic type, it makes sense to use a type with operators of course

#

But that's a pretty special case

#

And in that case, you do have shared state, the internal state of the type.

buoyant tinsel
#

Not only, thinking of pathlib, requests

rich mural
#

pathlib is also a pretty special, but different case.

#

And it's a slightly questionable use of operator overloading

#

It works, but it's weird.

buoyant tinsel
#

Well, numpy slicing also could be done finctiomally

#

functionally

rich mural
#

numpy also works with algebraic types

buoyant tinsel
#

Yeah, they basically implement both sides

#

One for convenience, one for extensionability, I guess

sage estuary
#

Either being off-topic is okay, or nobody really knows what "pedagogy" means. ๐Ÿ˜

buoyant tinsel
#

Actually I'm thinking about pedagogy in that context

#

The question was whether OOP or functional style should be preferred

#

For teaching

#

I've argued before to teach dunders early on

rich mural
buoyant tinsel
#

But I'm torn

rich mural
#

You can view this as a discussion of how to convey the idea of programming paradigms and if and when they should be used.

#

I think as important as knowing how to teach OOP is teaching what it's good for and when not to use it.

#

Same with functional and imperative programming.

buoyant tinsel
#

Yeah, I think it's best to have good examples for both at hand, so discussing those is a valid point

sage estuary
#

Well, if we ignore all the personal anecdotes and think specifically about the premise:

Topic: In my experience, object-oriented programming is the preeminent style taught in CS education. Does it deserve this status?
then the first thing I wonder is: is it true? Is OOP really the pre-eminent style in CS education?

rich mural
#

I can't really speak in anything other than anecdotes, because I haven't studied and have no information about any CS education beside my own. But in my case, I wouldn't say that. I had an OOP course and a "software engineering" course that expected us to model the high-level design using OOP, but that's about it. All other courses didn't really presuppose a paradigm (aside from my "functional languages" course).

rich mural
buoyant tinsel
#

The question is rather whether or how functional style should be more prominently taught in python, there definitely is a lack

sage estuary
#

I'm struggling to parse that. Definitely a lack of... what?

rich mural
#

My CS education didn't really concern itself with language-specific details much. I had an OOP course, which used Java as an example language, and a functional languages course, which used Standard ML as the example language, but the point wasn't to delve deep into language-specific features but rather to just give a general idea of what OOP and functional programming means. All other courses were about general topics as well, and sometimes just gave examples in a particular language. But the message was always, the implementation details don't matter, they can be picked up quickly as needed, it's the general, timeless concepts that are important to learn. And I find that that's generally true.

#

So I wouldn't necessarily advocate for trying to get CS education to include more Python-specific functional features.

#

Teaching those features here in this server is another matter.

#

But I don't think it's the job of academia to do that.

sage estuary
#

It's interesting that you had an OOP course and a FL course. I don't think those are too common. [In the US, at accredited schools]

buoyant tinsel
rich mural
sage estuary
#

I don't have too many surveys of non-US curricula.

rich mural
buoyant tinsel
#

It's not surprising though, since some features supporting functional style are still fairly new

rich mural
#

Is that not what you're referring to?

sage estuary
#

So you've already answered the "wether" part, and the "how" part is "everywhere"?

buoyant tinsel
rich mural
buoyant tinsel
#

Well, if you have pure functions that operate on functions, what else is it?

#

Many people are confused when they see map

rich mural
fleet pulsar
#

Functional programming is an entire approach to designing your program, simply having higher-order and/or pure functions doesn't automatically mean you're doing FP; with that said, teaching these things is still fairly important, as well as properly showing when to use free functions and when to use a class

rich mural
#

"OOP" and "functional" aren't really mutually exclusive, but "functional" and "imperative" are.

fleet pulsar
#

I find it that some people who come from other OOP languages bring some less-than-desirable practices with quite a bit of class overuse in cases where a function would do great on its own

#

One (tangentially related, but still) example would be filling a class with staticmethods instead of making a module with free functions; another, more severe in my eyes, is passing instances of subclasses with an overloaded method instead of simply passing a function

green warren
#

It doesn't seem to be too common to override __call__ in Python, but I do the equivalent in C++ all the time.

stone juniper
native hearth
#

What about flooding the code with classes when dicts would be enough

#

Or dataclasses even

green warren
#

But yeah, I agree @staticmethod should be avoided, and a class full of them is definitely a Java-ism

#

Honestly the fact that classes in Python are just dicts is pretty annoying. I don't want to be able to create new member variables just by talking about them.

#

But in any case I would argue that a dict is not an appropriate substitute for a class, because my IDE gives me code completion for member names, but it doesn't know what keys are in a dict, since that is runtime information.

waxen fox
#

My IDE can autocomplete keys too if some of them are hard defined from the start

green warren
#

Which IDE? ๐Ÿ‘€

oak breach
#

pycharm

green warren
#

Huh, never noticed this. But I basically never user dictionaries with pre defined keys.

noble aurora
#

huh, must be new, I've never seen that

oak breach
silent goblet
#

I don't know what-ism it is since Java doesn't really have mixins

green warren
#

That sounds bizarre and I can't imagine a use case for it

noble aurora
silent goblet
#

lol

silent goblet
#

but yeah, it's exactly equivalent to a set of free functions

sage estuary
noble aurora
#

not really, you can do the same with a module

silent goblet
#

Well, it's used as a mixin. So the methods are mixed in with the normal methods

#

I would say it provides worse scoping than a module

pale lotus
#

wow, i'm late to the party

#

this channel is awesome and i just found out about it now lol

keen moat
#

I like how this channel essentially became "OOP is confusing"

misty dirge
rich mural
#

And OOP is very hard to teach, so it kinda makes sense.

fleet pulsar
#

True, and it's especially true for python, because it has some significant differences when compared to "Traditional" OOP languages (e.g. Java)

#

And since a good amount of people who teach python to others don't give enough attention to these differences, they sometimes explain things poorly or show practices that don't fit well

silent goblet
#

OCaml has structural subtyping

#

Also TypeScript

rich mural
#

What do you mean by protocols?

#

Duck typing?

#

Duck typing can apparently only apply to dynamically typed languages, a corresponding concept for statically typed languages is https://en.wikipedia.org/wiki/Structural_type_system

A structural type system (or property-based type system) is a major class of type systems in which type compatibility and equivalence are determined by the type's actual structure or definition and not by other characteristics such as its name or place of declaration. Structural systems are used to determine if types are equivalent and whether a...