#pedagogy

1 messages Β· Page 12 of 1

weak mortar
#

how do feel about thonny?

#

@pure fog at first glance thonny seems more like an IDE to me than vscode

misty dirge
weak mortar
#

@pure fog thonny comes with embedded python?

pure fog
#

yeah, it's actually a python library and you can pip install it, but on mac at least you can get a standalone application

#

i am pretty sure there is also one for windows

weak mortar
#

so, I've installed it

#

@pure fog if it has an embedded python for windows too, I'm convinced

#

it's an awesome tool and I'd recommend it over vscode for a beginner!

#

thank you!

misty dirge
weak mortar
#

thanks, for the additional info, but it doesn't answer my question :)

#

would you recommend another tutorial?

misty dirge
#

If the person you're trying to teach doesn't have stuff that they want to automate, and you just want to teach them general programming, I would pick a different one

weak mortar
misty dirge
#

@cloud pawn your question was off-topic, but would be on-topic for #data-science-and-ml. Though don't be vague: say what the project would be.

robust bane
#

omg

torpid prawn
#

interesting. thanks for the info

molten star
#

Hi, I'll have to create my homeproject in python. We can do whatever we want, so I'm interested if it is possible to controll google home appliances from a python console application. Like switching the lights and other simple things. I also did some research but I couldn't found anything related to google home. (I don't want to build an app for google assistant, I want to create an app that connects to google home and can controll my lights/plugs)

misty dirge
#

@molten star your message is off topic. Please refer to the channel description before speaking in a channel for the first time. Thanks!

fallow terrace
#

prompt-thingy: Is it important to introduce various programming paradigms early on, or can that wait until one is very proficient in languages that use one (e.g. OOP)?

misty dirge
# fallow terrace prompt-thingy: Is it important to introduce various programming paradigms early ...

I don't think OOP deserves its preeminent status in CS education. As we've established in this channel, the examples one ends up using to teach OOP to complete beginners are often contrived, and the reason for that is that the virtues of OOP aren't really applicable to beginners.

I would probably do it like this:

  1. start with purely imperative programming. Talk about how the imperative code is expressing procedures. (you don't have to say "imperative" or "procedural" at this time.)
  2. Over time, put more emphasis on functions as a means of breaking down complexity into intuitive and re-usable parts. You might discuss how effectively naming functions enables you to write code that expresses your intentions.
fallow terrace
#

I see

misty dirge
#

an important caveat is that even if you're using data structures like lists, dicts, etc. during all this, using data structures that happen to be objects in Python isn't really the same as OOP.

pure heron
#

how is it not? If you call list.append() or dict.pop() or whatever, you're calling a method on an object, which is (part of) OOP

misty dirge
#

sure, but beginners aren't likely to think about how lists and dicts have persistent state and hidden implementations.

pure heron
#

you don't think they ever wonder how a list or dict works? I've definitely seen beginners here ask those questions.

misty dirge
#

let me rephrase: they aren't likely to think about how state and hidden implementations reflect a certain programming paradigm. when people talk about "learning/teaching OOP" in general (not specific to Python), they're usually talking about object-oriented design, and using classes as the primary way of modularizing code, and conceptualizing your code primarily as objects interacting with one another.

cosmic aspen
cosmic aspen
fallow terrace
# misty dirge I don't think OOP deserves its preeminent status in CS education. As we've estab...

the examples one ends up using to teach OOP to complete beginners are often contrived
That's a very good point. A while ago, my Python course forced us to do something like

try:
    import asdfjkl
except ModuleNotFoundError:
    ...
```in order to teach us try/except. I know that's not OOP, but it's the kind of thing that makes students think "this is useless." So many courses focus on "modularity" and small programs to introduce concepts, which is very harmful in my opinion. Exposure to real world projects would be so much more beneficial. Like in this case, maybe show (or make students write) an example of taking a string and converting it to an int, and then error if it can't be converted or something like that. /rant
misty dirge
#

what were you supposed to do if the module isn't found? just print a low-fi error message?

#

coming up with good examples is really important for effective teaching. this just looks lazy.

cosmic aspen
fallow terrace
oak breach
#

msft? microsoft..?

cosmic aspen
misty dirge
cosmic aspen
fallow terrace
#

My original question was meant to be a tiny bit more broad than what I made it seem. When I said "paradigms," I meant static vs. dynamic typing, compilers vs intepreters, etc.

misty dirge
#

I don't know that those are thought of as parts of programming paradigms

#

also, compiled vs interpreted is part of the language implementation, and doesn't necessarily affect how code in the language is written. though the different approaches to typing can be pretty interesting

oak breach
#

Slightly unrelated, but i feel type hints should be taught fairly early on

stone juniper
#

havent thought about this before, but I wonder if python is especially good for that since it lets you write typehints but also doesn't crash if you get it wrong

misty dirge
#

To what extent? I think type hints should probably be taught as the default assumption for function signatures, at least for absolute beginners to programming.

fallow terrace
#

my wording was just bad

fallow terrace
strange moon
#

Hey guys, do any of you know any good refresher courses for python covering everything from loops to classes? Preferably resources that are free

misty dirge
noble aurora
#

you might want to try importing something and instead of a sad error message for the user you could output a nice error message

fallow terrace
#

I don't deny that.

#

My problem is that students aren't introduced to those real world use cases.

pure heron
#

I think the best way to teach exceptions is in the context of operations that can fail even if the programmer did everything right - file IO or network requests or the like

green warren
#

Exceptions are tricky, because someone might get paranoid and start putting try...except around everything.

#

Or they'll start using it as flow control.

#

I think part of the point is it's not just "operations that can fail even if the programmer did everything right", but more like "operations that can fail even if we did everything right, but we can meaningfully recover from that failure if we are made aware of it".

silent goblet
pure heron
pure heron
silent goblet
#

hmmm good point

#

input can fail with EOFError but that's kinda fringe

pure heron
#

yeah, and explaining "end of file" to beginners who don't realize that stdin is a file seems... not fun.

silent goblet
#

lots of stuff can be checked in advance, like a file not existing

#

I guess network failures are not, but it's pretty hard to emulate one

pure heron
#

whether or not a disk has enough space left to hold your file can basically only be tested by trying to write it and seeing what happens

#

at least, in the presence of other processes running on the machine at the same time.

silent goblet
#

sure, but it's pretty hard to simulate tbh

pure heron
#

maybe on Windows >_>

silent goblet
#

"just fill in the 500GB you have left but make sure to leave about 7MB of free space"

pure heron
#

permissions are easy to simulate

silent goblet
#

permissions - yes

pure heron
#

though granted, you could check those in advance.

silent goblet
#

yeah we're not going to explain TOCTOU before try-except

pure heron
#

but it's never too early to teach TOCTOU bugs, I think - conceptually, they're not that hard to understand, I think, and they're the biggest motivating reason behind exceptions/error codes

silent walrus
#

what about reading json from a file?
afaik there is no easy way in the stdlib to check for errors in json before trying to load it

silent goblet
#

explaining a multithreaded/multiprocess issue seems pretty hard to someone who hasn't heard about try-except yet @pure heron

noble aurora
#

i don't think you have to go in depth, it just has to be "your computer can run two things at once, like google chrome and spotify"

pure heron
#

"You prompt the user for a filename, and you write your output to that file. What happens if that file is on a thumb drive, and they unplug it while you're in the middle of writing to it?"

silent goblet
#

hmm

pure heron
#

that's enough of an example to illustrate that you couldn't check for the condition in advance, and could only find out that it failed part way through.

silent goblet
#

I guess

fleet pulsar
# pure heron mm. In that case I'd probably prefer students check `isdigit()` instead - `int()...

IIRC isdigit can still contain characters that don't form base-10 numbers, and it would also return False for very much valid negative integers. There's no similar method to check for specific bases other than 10, and neither is there a viable option to check if a string is a valid float without too much complication, so I'd argue try-except is rightfully mentioned as a better approach for conversion

#

Although this particular scenario does allow choice betweel EAFP and LBYL, unlike file/socket IO, which can only be reliably done with exceptions

pure heron
#

fair enough, isdigit includes more than I would have expected. But yeah, that latter point re: LBYL vs EAFP is what I was driving at.

fleet pulsar
#

LBYL vs EAFP should definitely be explained and taught properly, because it's a vital topic - both approaches are valid in their own contexts, and in certain cases choosing the wrong one will lead to not just poorer performance, but possibly severe and inconsistent bugs. Providing this information in an accessible and an applicable way is pretty important imo

#

So I support the idea, but we should pay extra-close attention to the examples we give to make sure their practical value is understandable and they provide an insight into why this specific approach was chosen (which is a pretty hard thing to do, tbh)

misty dirge
#

what are those two acronyms?

pure heron
#

Look Before You Leap, and [It's] Easier to Ask for Forgiveness than Permission

#

The "look before you leap" approach is checking whether all of the preconditions for some call are satisfied before attempting that call.
The "easier to ask for forgiveness than permission" approach is trying the call, and being prepared to handle an exception if it fails.

#

and we referenced TOCTOU above, that's "Time of Check / Time of Use" - there are cases where LBYL cannot work, because the condition can change at any time (asynchronously to your program's execution). For instance, you can check whether a file exists before you try to open it, but just because it exists doesn't mean that opening it will work - because another program can delete it just after you check if it exists, but just before you try to open it.

#

We were talking about the value of queue.Queue for synchronizing multithreaded applications a few days back, and the public interface of queue.Queue has another example of TOCTOU in it...

#

!d queue.Queue.qsize

worldly dewBOT
#

Queue.qsize()```
Return the approximate size of the queue. Note, qsize() > 0 doesn’t guarantee that a subsequent get() will not block, nor will qsize() < maxsize guarantee that put() will not block.
pure heron
#

You can check whether a queue is empty before attempting to pop an item from it, but just because it's non-empty doesn't mean that popping an item won't block - because it's possible that it becomes empty after you check, and before you pop (because of another thread popping an item from that queue)

#

Anyway, relating it back to exceptions - the interesting point to make about exceptions is that, even though it's often faster to check preconditions up front and only make calls that you know will succeed, there are cases where you cannot know whether a call will succeed without attempting that call, and exception handling is the way to recover from a failed call in Python.

#

!d queue.Queue.empty

worldly dewBOT
#

Queue.empty()```
Return `True` if the queue is empty, `False` otherwise. If empty() returns `True` it doesn’t guarantee that a subsequent call to put() will not block. Similarly, if empty() returns `False` it doesn’t guarantee that a subsequent call to get() will not block.
pure heron
#

that might have been a better way to illustrate that point, actually - empty and qsize have exactly the same TOCTOU issue, but the implications are perhaps more surprising for empty than for qsize.

blazing ginkgo
#

I've heard that in python EAFP is preferred over LBYL generally speaking, due to the way the language is designed, but that doesn't necessarily hold in other languages (although that's when they're both suitable for the problem in question)

#

In terms of runtime I mean, not necessarily in other aspects

pure heron
#

that's broadly true, I'd say.

stone juniper
pure heron
#

you could do it with re, I suppose, but at that point...

oak breach
#

if set(s) <= set("0123456789") πŸ₯΄

oak breach
stone juniper
#

imo no, the benefit of typehints for beginners is just to get them to think about the underlying objects and what type they are

pure heron
#

really I think it's r"^[-+]?[0-9]+$" that users would typically want to validate against - but, that's not great.

pure heron
#

Most people validating input() as an int probably wouldn't want to allow octal or hex or binary, I suspect

#

In fact, that's an argument against using int() for the input validation; allowing numbers specified in other bases would usually be undesirable

stone juniper
#

!e

print(int("0o10"))
worldly dewBOT
#

@stone juniper :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ValueError: invalid literal for int() with base 10: '0o10'
stone juniper
#

is there a way to make it work?

oak breach
#

ast.literal_eval and then isinstance(x, int) ig

stone juniper
#

i mean nothing is going to work with int, right?

pure heron
#

No, you're right, I'm wrong, again πŸ™‚

stone juniper
#

tbh i was a bit surprised it didnt

pure heron
#

!e print(int("1_0_0"))

worldly dewBOT
#

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

100
pure heron
#

That works, though, and someone performing input validation likely wouldn't expect it to

undone girder
#

Hello everyone, I have a question about Python. How can I fix it?

fleet pulsar
#

!e ```py
strings = [
"0b111",
"0o111",
"0x111",
"111"
]

for s in strings:
print(int(s, base=0))

worldly dewBOT
#

@fleet pulsar :white_check_mark: Your eval job has completed with return code 0.

001 | 7
002 | 73
003 | 273
004 | 111
fleet pulsar
#

So unless you explicitly enable inferring the base from the string, it assumes decimal

white bough
# pure heron that's broadly true, I'd say.

At the same time it introduces some overhead, that can be quite substantial. This can be seen as unnecessary optimization, but combined with the rather verbose syntax that can make code quickly unreadable, I fail to see the benefit of general EAFP. You have shown some cases where it is necessary, but what are actually the benefits of it compared to LBYL that make it the standard case in python?

What I also miss most from it, is a way to easily and not completely ugly and unreadable, write a cascading check, ala if/else/elif, when there can be multiple errors and each would warrant a different way of alternative behavior. ||Could be bad design to want to do something like that but meh||

buoyant tinsel
#

i think it's all a question of the specific case and sticking to one mindset because of some misguided notion of right and wrong is counter-productive. the most important question here is where to draw the border of your system. if resources are outside of your control (like trying to open files) there may be unforeseeable circumstances leading to exceptions you couldn't anticipate, so looking before leaping would be futile.

#

on the other hand, if you're inside the borders of what you can control, you can make assumptions about the things you're dealing with, so you can do exhaustive and preemptive checks

#

which i would say is part of defensive programming, leading to more robust code

#

so i would use try/except mostly exclusively at the borders, like API but would never consider using it as a control-flow (like check against division by zero)

#

if you are in control of the input, you can definitely check for conditions that might lead to such exceptions

#

and then gracefully handle those cases with little to no performance-overhead

#

only problem with division-by-zero is that - which hypothesis taught me the hard way - there can be a number of combinations that may lead up to NaN when handling floats that are not obvious to check against (it suffices to multiply numbers that are small enough but non-zero that round to zero inside the function)

#

but if you handle those via exceptions, you might open yourself up to DOS of some kind, so it's still important to have performant checks

#

so i think the most important lesson to teach here is about system borders

#

str vs. bytes also would be a topic for this

silent goblet
#

EAFP actually doesn't need to be implemented with exceptions, by the way

#

For example, in Rust it's done with Result or Option

neon pasture
#

you will find some python APIs which do it with None as well

winter spear
# white bough At the same time it introduces some overhead, that can be quite substantial. Thi...

In the context of python I associat EAFP with try...except and LBYL with conditional statements. The way I choose them is based on how frequent I expect a failure to occur. Try-except has zero overhead if no exception is thrown. So if I don't expect the exception often, and the code is called a lot, I'll use the EAFP instead of LYBL. On the other hand if I know the code is called frequently and I could raise the exception frequently then I'll just do the check first.

Ultimately you should always profile but that's my general rule

silent goblet
#

Try-except has zero overhead if no exception is thrown
since python3.11 πŸ™‚

silent goblet
#

hmmm, maybe Mapping.get

white bough
#

Just generally, how can something have now overhead if it has to reset states? Or do I just imagine that about python try/except and it actually resets nothing?

To also show what I meant with ugly/unreadable:


def something(in_data):
    try:
        in_data = int(in_data)
    except ValueError:
        try:
            in_data = [int(i) for i in in_data.split(";")]
        except AttributeError:
            try:
                in_data = [int(i) for i in in_data]
            except TypeError:
                in_data = None
    return in_data

This is a stupid example and no way I would accept all this possibilities in a single function, but it show the limitations and the unreadableness (||probably not a word πŸ™‚ ||).

versus:

def something(in_data):
    if isinstance(in_data, list):
        in_data = [int(i) for i in in_data]
    elif isinstance(in_data, str):
        if in_data.isnumeric():
            in_data = int(in_data)
        else:
            in_data = [int(i) for i in in_data.split(";")]
    else:
        in_data = None
    return in_data

or even:

def something(in_data):
    match in_data:

        case list():
            return [int(i) for i in in_data]

        case str():
            if in_data.isnumeric():
                return int(in_data)
            else:
                return [int(i) for i in in_data.split(";")]

        case _:
            return None

stupid examples I am creating here, but trying to show my point by going to the extreme.

buoyant tinsel
#

match/case would probably be preferable nowadays over if/elif/else

#

as i said, having try/except can backfire badly if you get lots of bad input either maliciously or accidentally, so if possible i'd try to cover the cases by LBYL

#

but hey, both approaches aren't exclusive either

stone juniper
#

which might be partly my fault but let's try to get back on topic

white bough
#

--remove by myself, this is really more something for other channels.--

tidal orchid
#

you'll have to be a bit more specific about what you mean / when.
should you teach that 0 and None are treated as false? sure, and maybe include lists and alike
to use is None instead of == None? probably no need unless you're talking about OOP

white bough
#

--remove by myself, this is really more something for other channels.--

winter spear
pure heron
#

It currently adds some overhead, but less than in most languages.

misty dirge
#

How do those who frequent this chat use the word "implement"? I see those who I perceive as beginners use it much more broadly than I think makes sense, basically as a synonym for "use".

"I was trying to do such and such and got this error message", "to solve the problem, you need to use x", "I don't know how to implement x into my code".

I only use "implement" to refer to creating something that fulfills a defined requirement. I'm not sure if my definition is narrower than everyone else's, or if this is a case of beginners trying to show that they know certain vocabulary.

pure fog
#

yeah "implement" mostly means "fulfill a requirement or functionality" to me

#

"implement into" seems like people using the word without realizing how it's used otherwise

#

that or it's international english, like "have a doubt"

fallow terrace
#

I use "implement" in a much broader sense. Basically writing any code (that may appear in a public interface, if I have to be specific), whether that's a function or a class or whatever.

pure fog
#

i think that counts

#

"implement an interface" or "an implementation of a type" is standard jargon too

#

"implement into" is more like how non-programmers use the word i guess

fallow terrace
green warren
misty dirge
fallow terrace
#

none, really

misty dirge
#

Anyway, I suppose any time you're writing code, you're also implementing something.

languid yacht
#

What do you guys tell people when they ask how they can improve? I still see when they follow a tutorial they think they are expert on the topic.

subtle owl
gleaming anvil
misty dirge
gleaming anvil
#

ya. e.g. "I'm working on implementing a new plotting library in this page so we can show data this new way yadda yadda yadda"

#

it like encapsulates that cycle of 1) learn new tool/library 2) install it into environment 3) write code that actually uses it

#

but that's like a pretty loose usage, not nearly as precise as what you're thinking

misty dirge
#

not sure what you mean by "in this page" though.

gleaming anvil
#

like, they are importing matplotlib.pyplot.hist to make a histogram on some dashboard

#

obviously real life is usually harder than that

misty dirge
tardy acorn
#

hello

#

I had a q. can i ask here???

stone juniper
tardy acorn
#

thank

gleaming anvil
misty dirge
gleaming anvil
#

ah okay. I thought my prior wording might have been confusing. well, Just one more example that words can mean different concepts in different contexts

weak mortar
misty dirge
# weak mortar why is that? genuinely curious.

in general language use, the meanings of words are pretty flexible and change over time. I can't really get into why that is and why it's okay at the moment. but in technical contexts, a lot of miscommunication results from technical terms being used imprecisely, and I hate that. I hate it

weak mortar
#

ah, sorry, I misunderstood. I thought it was about imports

misty dirge
#

no. I used to work in coffee retail, and every so often I'd be cussed out by customers for doing what they said, because their instructions meant something completely different than their established meanings.

weak mortar
#

but in technical contexts, a lot of miscommunication results from technical terms being used imprecisely, and I hate that. I hate it

#

I understand you here 100% :)

misty dirge
#

"I like coffee that's really light" serves them the lightest roast "THIS IS BLACK. WHERE IS THE MILK????!"

#

now I'm triggered sad_cat

weak mortar
#

:D

#

was not my intention

misty dirge
#

dw, I'm just really easily triggered

#

I guess I should make this on-topic.

Does anyone else feel that beginners are especially inclined to want to build an exe for their Python program?

pure fog
#

i think discord tends to attract a certain category of young person who thinks that they need/want an exe

#

i don't think this is a general trend, it seems to be a peculiarity of the audience here

green warren
#

You may have noticed that the majority of people are terrible communicators

pure fog
#

indeed

#

maybe not terrible, but i think part of the role of a teacher can be to help the student improve their ability to reason about and discuss the topic being taught

#

"conveying information" includes the linguistic tools to describe and engage with that information

#

a lot of people lack experience with putting thoughts into words, and they don't realize that writing/speaking/communicating is itself a skill that takes practice

#

like most things, if you realize it's a skill and you spend time/energy paying attention to it, you will improve at it

gleaming anvil
#

pedantry can be both a blessing and a curse

pure fog
#

i don't think it's fair to conflate "precision" and "pedantry"

#

but yes i agree with the point

gleaming anvil
#

I find a little self-deprecation goes a long way towards the diplomacy of that kind of conversation is why I use that word lol. But yes fair

weak mortar
# gleaming anvil I totally resonate with this btw, honestly a surprisingly large part of my job i...

Subscribe for more short comedy sketches & films: http://bit.ly/laurisb Funny business meeting illustrating how hard it is for an engineer to fit into the corporate world! Watch the next episodes: http://bit.ly/SquareProjectEp1, http://bit.ly/SquareProjectEp2 & http://bit.ly/SquareProjectEp3

Starring: Orion Lee, James Marlowe, Abdiel LeRoy, Ewa...

β–Ά Play video
misty dirge
#

also, I have to give the linguist caveat that language is entirely user-driven and there are no absolutes. but otherwise, yes, all of this ^

#

not that video but the discussion in general

gleaming anvil
misty dirge
worldly dewBOT
#

:ok_hand: Added precision-is-pedantry to the names list.

gleaming anvil
#

also I guess part of what makes it pedantry is that, to avoid confusion with commonly used words that have subtly different meanings, these terms to be used in highly precise technical contexts often can be very uncommon/fancy words

#

especially in the domain-specific data science space I work in

weak mortar
#

big data is not specific enough for you?

misty dirge
gleaming anvil
#

Ag-tech. This is getting pretty far from pedagogy tho

misty dirge
#

I'm not super concerned with sticking tightly to the topic as long as (a) it's available if someone decides to introduce a more relevant topic or (b) the channel is being used for high-level conversations that wouldn't be feasible in other channels.

pure fog
#

sometimes the best way to do your job is to educate the people around you

#

PMs, internal stakeholders, etc.

white bough
# misty dirge I guess I should make this on-topic. Does anyone else feel that beginners are e...

if you do it as a hobby you look for some projects other people need or want around you, those other people are most likely not programmers and most likely only have a windows pc available.

You can either try to explain how to install and use, python, pip and pipx or venv, or you just give them an exe.

The thought of not needing exes for python programming is most likely from the bubble that people ,that do this for a living or study this, are in. An exe is the easiest way to make something for someone else to really use. The same goes for GUI.

You can either try to explain everything and force them to use CLI and pip or you make something that is most easy to use for you intended target audience.

Why not make a web thingy?

  • often more complex
  • often has some cost attached (server,...)
  • or has some kind of real life registration attached
    when doing this as a hobby for a target audience of 1-5 people, these points can make the project not viable.
misty dirge
white bough
#

dont forget you can also easier take an exe with you to show a friend on his PC instead of setting up the whole python ecosystem on his windows pc

quartz solstice
# misty dirge sure, but I sense that most python beginners think they need to create an exe to...

imo it's done out of convenience. Python is a relatively easy language to learn and work with, and it allows you to do a lot of stuff pretty easily, so it would be understandable why someone (specially a beginner who has just started) would like to stick with that language, including compiling to a binary. At some point they'll have to show their friends or someone a project they made, or outright distribute it to other people, and they probably don't want them to go setup Python for this single project of theirs.

orchid thistle
#

am i the only one who feels like people sometimes come to ask for help with errors before even reading what the error says

#

like, error messages don't always tell you exactly what went wrong but most of the time they should be pretty intelligible

#

but i feel like sometimes i see questions where they either didn't look at the error at all, or looked at it and did not mention the conclusions that are obviously related

gleaming anvil
#

yeah happens all the time

#

I think it's easy to forget once you're very comfortable with reading them, but actually understanding an error message takes a lot of contextual knowledge and experience

#

So it's a common beginner habit to see an error message, don't even know how to begin understanding what it means, and go ask for help

#

whereas for an expert it's obvious - the error is telling you exactly what's wrong

noble aurora
#

I think in that situation all you should do is just point at the error message

gleaming anvil
#

it's like someone giving you directions - "Take the second left after you've passed the McDonalds", but you don't know what a McDonalds is, you don't know what cars or roads are

#

it's so bloody obvious to someone who knows the context, but completely inscrutable to someone lacking the contextual knowledge

#

I think if you've never tried using Rust, it's a great teacher for this concept

#

the compiler will give you the most wonderfully helpful error messages like "change these exact 2 characters from "[","]" to "{","}" on line 83 in positions 12 and 65 and it'll fix your memory leak

cosmic aspen
gleaming anvil
#

and if you're new to rust it can be so infuriating

#

like "I HAVE NO IDEA WHY YOU WANT THAT"

noble aurora
#

"but why do I need to insert indirection 😩"

cosmic aspen
gleaming anvil
#

also to be understanding towards people who are new to programming, and not get upset at them for asking questions that seem to have obvious answers

#

it's not at all obvious to the beginners, or they wouldn't have bothered asking for help

runic sigil
#

I vaguely recall getting that "rabbit in the headlights" syndrome when looking at my first list of C compilation error messages. And, yes, I think that's exactly it - all they see is a wall of (RED!) text, rather than the actual error message that's important. And that just translates to "ERROR", rather than anything specific.

#

(Depending on the user!) My approach is usually to say "I see this in the error message, and that means....blah"

ripe folio
#

I am happy explaining a KeyError or IndexError to people, because KeyError: 'a' is often not self-explanatory. That said some errors have super perceivable text that tells you what to do and some don't try to comprehend it.

gleaming anvil
#

yeah for sure. I think there's usually a productive conversation to have with novices around being respectful of the mentor's time

ripe folio
#

Definitely, I think it's good practice to not only explain the error and what need fixing - but also how you arrived at that conclusion.

#

It's like when I Google something for someone. They may not use the correct keywords and the links they find they might accidentally ignore because they think it is unrelated.

#

Usually I drop the link (not the Google search; of what I found) and the keywords I used to find it, that way they can re-use the same keywords as me and learn that way. I want to teach them to help themselves - as is best done with errors.

gleaming anvil
#

ya for sure, I do the same thing

stone juniper
#

when someone says "I got an error", I ask them to post the error message, then ask if they read it, then if they looked at the line it references, then what they think about the error message
basically making them go through all the steps that they need to learn to do on their own

#

after all that I explain why they got it and how they can fix it, so hopefully next time they go through those steps on their own to skip the tedious dialogue

fossil thicket
#

What are people's opinions on the current Humble Bundle programming bundle of books

pure fog
#

once in a while the error is confusing and unhelpful, in which case i just explain it

#

other times i make dad jokes like "what went wrong? did your computer catch on fire?" which most of the time seems to get the idea across

#

maybe people once in a while misinterpret it as being harsh or snarky, but for the most part i think it gets the point across better than "explain what the error is please"

#

"here, take a look at the traceback. what do you think the last 3 lines mean? can you identify the problem in your own code using this information?"

#

i also try to soften things by stating that learning to read and understand error messages is an important skill in programming

#

"it is a skill, it takes practice, but you will get better over time, and it is necessary to be a productive programmer"

ripe folio
pure fog
#

hah, that's a good one too

#

"sorry to hear that! let me know what the error is if you want help solving it."

#

i'm going to use that one on my kids one day

ripe folio
#

Lol

#

Another one I quite firmly remember being used in here (this server) is when someone asked like "Hey does anybody know anything about X?" so I just said "No, hope I answered your question! πŸ™‚". I wanted to follow it up with a quick help about asking questions but I don't think I got a response.

It's such a waste of time for both the person trying to get help, and the helper, to have talk. The person trying to get help also has a lower chance of getting help!

pure fog
#

i tend to take the "don't ask to ask" angle with that one

#

because i think the "nope, sorry!" approach might be misconstrued as an actual answer

#

i think for the most part the people asking questions like that are young and/or inexperienced with online etiquette, and the "nope sorry" response might go over their heads as sarcasm

misty dirge
#

(that's where it suddenly completely fails to exist, leaving behind no trace of its former existence.)

misty dirge
pure fog
misty dirge
#

!otn a catastrophic existence failure

worldly dewBOT
#

:ok_hand: Added catastrophic-existence-failure to the names list.

misty dirge
pure fog
#

at least then it's in their hands: choose to comply and trust that they will learn "why" later, or be stubborn and don't get help

gleaming anvil
#

In case of a CatastrophicExistenceFailure , please consult your nearest copy of the HitchHiker's Guide

misty dirge
noble aurora
#

iykyk 😩

gleaming anvil
#

I'm just giving some topical debugging support is all

jolly night
pure fog
#

imo, not to someone who already knows what for does. but maybe to someone who is learning it all for the first time

#

but i think it does kind of justify the existence of for/else

jolly night
pure fog
#

yeah, fair enough

#

the two meanings are analogous in some sense

jolly night
pure fog
#

because i don't think the analogy really goes very far

#

the else in for isn't really "connected" to the inner if

#

but the code you wrote is pretty clever and i hadn't thought of it that way before

jolly night
#

but that's exactly what makes it make sense: the else is the alternative if none of the ifs are taken.

pure fog
#

i always thought of it as conveniently "symmetric" syntax

#

or reading it in in english as "else, if the loop is exited early, ..."

#

because you can (technically) have for/else without if, although it'd probably be kind of contrived

jolly night
#

yeah, i can't think of a reason to use for/else without if

pure fog
#

are you envisioning this as a kind of "lifting" the else from the if up to the level of the loop?

jolly night
#

i'm not sure what lifting means. I just wanted a parallel that would help people grok for/else

pure fog
#

do you find that you have trouble explaining it as "else is triggered when the loop ends early for some reason"?

jolly night
#

people understand that, but that doesn't justify using the word "else".

#

"else" sounds like "if there's nothing to loop over"

#

btw, your explanation is backwards: else is triggered when the loop doesn't end early.

#

that's the problem: ends early, doesn't end early, it doesn't map to "else" in a clear way

pure fog
#

good point

#

and yes i knew that sounded wrong...

pure heron
stone juniper
jolly night
pure heron
#

intermediate/expert level?

#

cause for beginners, I'd say it just shouldn't be taught at all - it's a relatively niche flow control tool

jolly night
#

I'm considering a tweet πŸ™‚

pure heron
#

The way I reason about py for x in it: if cond(x): break else: print("not found") is by thinking of what we'd do in languages that don't have it - it's equivalent to ```py
found = False
for x in it:
if cond(x):
found = True
break

if not found:
print("not found")

jolly night
#

but that's unsatisfying: there's no else in the second code

pure heron
#

well, yeah - else is a terrible word for what it does, and I'm sure it's just what we have because there was no desire to add another keyword for it, heh

jolly night
#

but that's the point: in my code, it's exactly "else"

pure heron
#

I guess - if you know exactly how many elements the sequence has - but it doesn't seem like a useful way to reason about it to me

#

like - your example only works because you know seq has exactly 3 elements. If it didn't, you'd need a loop - and if you had a loop, it wouldn't be the else anymore

jolly night
#

you have to squint over the seq[0] stuff. the point is that the else is the alternative if none of the if's worked out.

#

just like in if/elif/elif/else

stone juniper
pure heron
#

... is it?

#

mentally mapping "else" to "if not found" doesn't seem unreasonable to me.

jolly night
#

i'd rather map it to "else" πŸ™‚

pure heron
#

I don't even read it as "else" when I'm reading a normal if/else, honestly - I read "else" as "otherwise" in my head

#

Why not just tell people that the "else" in "for/else" stands for `Ended Loop with StopIteration Exception"

stone juniper
#

lmao

noble aurora
#

that's actually not bad, tbh. just need to abstract a little.. "ended loop normally"

pure heron
#

I almost wish it had been ```py
for x in it:
...
not break:
...

jolly night
#

ok, we differ on this. This was a huge help to me understanding it.

pure fog
#

it kind of just "is what it is", and the choice of else versus jaiolwuvhawliufbnalwe is kind of arbitrary

pure heron
#

I think "finally" would have made approximately as much sense as "else" does, though it would mean something different than what "finally" means in "try/finally". I can imagine that we could have had a "for/finally" where "finally" means "at the end", and a "break" logically stops it from reaching 'the end", so that path isn't taken.

pure fog
misty dirge
worldly dewBOT
#

:ok_hand: Added else-vs-jaiolwuvhawliufbnalwe to the names list.

misty dirge
#

looks like an irish word kinda

pure fog
#

πŸ˜† i would have just gone with jaiolwuvhawliufbnalwe as the channel name

misty dirge
winter spear
#

I agree that else part is deceiving but the gist is equally confusing. Mainly because even if you have nothing to loop over, else is still hit.

#

I still have trouble remembering when I need until I need it.

native hearth
#

An empty iterable would not cause any breaks so why wouldnt you expect else to be hit

cedar musk
#

Is it considered a better practice to write a command line script that controls hardware and provides feedback via command line or have a local server running which can you can make requests to for the above?
in terms of interoperability since i need to be able to call this 'script' programatically and return a value i can either make a http call with arguments or call for the execution of the script from command line via the program.
Maintenance is something i need to keep in mind too as it might be hard to make changes to a server remotely but i could modify environent variables etcetc in command line.

winter spear
# native hearth An empty iterable would not cause any breaks so why wouldnt you expect else to b...

When I first learned for...else my mind naturally went to " the else block is executed if there is nothing to loop over" but instead it's entered if we break the loop early. It's more of the use of the english chosen for the construct. I have similar feelings about the chosen variable names that Ned chose to describe it.

I just do not think for...else is correct english for what it's supposed to be doing

runic sigil
#

It's equivalent to the "default" in a switch. A fallthrough case. I guess a useful English mapping would be "else fallthrough happened:" - but that might require some prior knowledge of programming terminology; I'm not sure how easily a non-programmer would understand that use.
ObAnswer: I don't like the gist for the use of the walrus operator - I think that obfuscates the point being made with another less-known mechanic. Otherwise I like the mapping between the elses.

noble aurora
oak breach
#

imo for-else is a... useless feature

runic sigil
#

Ah, no. I see that as being equivalent to the "fallthrough" in a switch statement.

#

i.e. Nothing caused the for loop to break out, so we've fallen through to this else. But, I see your point, it's still not the clearest.

noble aurora
oak breach
#

yeah but i would find the flag variable more readable

gleaming anvil
#

I definitely prefer for…else to flags. I find when there’s complex logic going on in the body of the for loop it’s shockingly easy for even experienced programmers to update the flag incorrectly in one of many subtle ways. The else block removes that potential bug.

waxen fox
#

also if you have one for...else and a nested for...else, making both flag vars gets messy

gleaming anvil
#

I honestly interpret the presence of a lot of for loops in a python codebase as a code smell these days

#

With list comprehensions and so many commands that can directly operate on collections, I find there’s almost always a better way that removes the possible bugs of manually futzing with state inside the loop

waxen fox
#

but say you're trying to iterate through the result of a request and set different things based on the information; a list comprehension would look quite packed and unnecessarily esoteric for that use case

gleaming anvil
#

Oh sure sometimes it’s definitely the best tool for the job. I don’t begrudge that. I just find it very often isn’t the best tool, and it’s only being used because the programmer doesn’t know how to use a list comprehension, or filter, or map, or most often didn’t read the pandas documentation and just looped over values in the data frame

winter spear
waxen fox
sage jasper
#

how soon do you teach people to use debuggers?
i've heard it said that for some reason python devs aren't introduced very early on to debuggers
i kind of wish i was showed how to use one on day 1

fleet pulsar
#

the course i took taught us debuggers in the first month

#

Well, pycharm's integrated debugger anyway

#

I always made the assumption that debuggers are usually introduced pretty early on, although I admit I should've changed my mind after seeing my uni

vale current
#

I didn't know how to use a debugger for quite a while

oak breach
#

ive still never used a debugger for like actual debugging

vale current
#

I've used it, but not too much

#

I havent habituated myself with it, so it's never the first solution to come to mind, and I usually end up solving the bug with whatever other things I do

#

And then if I get desperate I remember it exists

weak mortar
misty dirge
#

!mute 846978476493111296 "3 hours" Spamming the same question in lots of channels after a warning. Please contact @viscid mural to discuss your understanding of channel topics.

gleaming anvil
# weak mortar A list comprehension is just a for loop arranged in another order. Sometimes peo...

It's much easier to mess around with state during the looping, and persist state across loop iterations with the for-loop syntax than the list-comprehension syntax. This is a common source of bugs that using a list comprehension discourages. The VM and many libraries treat them differently as well, and in a lot of cases list comprehensions will evaluate much faster at runtime than the equivalent operation expressed as a for-loop.

weak mortar
#

It’s just a quick one liner. If anything it just sounds like the programmer failed to simplify or compress the logic prior to looping IMO. Unless you have some really great example to share

neon pasture
#

there are some cases where trying to write a oneliner with itertools and comprehensions yields fairly messy code compared to just a loop, but vice versa, it also holds.

gleaming anvil
#

I don't really agree with that idea @weak mortar b/c i've often seen very experienced engineers make simple off-by-one errors, or accidentally changing a variable before doing a thing with it in the loop body instead of changing the variable after, that sort of thing. These can be quite hard to catch, since they're in a class of errors that may never raise any error but leave data inconsistencies in their wake

#

It's not really something to do w/ programming skill IMO. Reading code carefully is hard, regardless of how talented one is, and we all only have so much time in our days. We all make mistakes. Making decisions to use certain syntax or tools that reduce the risk of mistakes is almost always a good idea.

mossy horizon
#

hi everybody somone can call with me now for help me of the combobox ?

gleaming anvil
#

like the joke "the two hardest things in programming are naming, off-by-one errors, and caching" is in my experience very, very true. avoiding for-loops cuts means not having to look out for off-by-one errors in a whole lot of code

green warren
#

I find that if a looping structure seems complicated, there's probably a more elegant way to do it with generators

pure fog
#

on the other hand, sometimes loops are a great "escape hatch" where the functional-style version would be convoluted or messy

misty dirge
#

No.
Unlimited functions.

misty dirge
#

How do we feel about the taxonomy of CS in academia? It seems most universities originally placed it in the same school/college as their mathematics program, and that over time, some universities have relocated it to their engineering school/department.

At my university, it was part of the college of engineering, but had been part of the math department before. The other majors offered there were all "{mechanical,electrical,chemical,biomedical} engineering", so CS definitely felt like the odd one out. The college also charged an additional fee to account for the higher salaries of their faculty, who could presumably make more in industry than their counterparts in the other colleges. I suspect that fee (and the reason for it) informed the decision to move the CS program to engineering.

There seems to be a spectrum of topics within CS, with theory (Turing machines and time complexity) on one end and software design (specific programming languages, design principles, Scrum) on the other, and that exemplifies the math<->engineering distinction.

#

It's also interesting to note that the other engineering programs along side mine depended on one or more natural sciences, and computer science really does not.

winter spear
# misty dirge How do we feel about the taxonomy of CS in academia? It seems most universities ...

CS is one of those topics where the theory and practical application vary wildly imo. Imo CS leads to a job that is more akin to a trade. You don't need the theory, it's great and really wonderful if you understand it but for a job not necessary. Engineering follows suite to an extent. So it makes sense for the two be in the same college. On the other hand, the theory part of CS is similar to math and I can see why they go together.

green warren
#

Computer science is mathematics. But I think hardly anyone does it. Software engineering/design is a different thing.

torpid prawn
#

otherwise, it does feel like the odd one out at times tbh

alpine moss
#

I just feel a need to say, at first I read this channel name as programming-propaganda

gleaming anvil
#

Remember, stick the to party line- the GIL means all python code is thread-safe. Anyone who says otherwise is a rustacean in disguise

jolly night
#

i don't see how a false statement can be the party line πŸ™‚

misty dirge
#

Someone in #career-advice said recently that they didn't think "anyone cares about a piece of paper". To what extent does a university education deliver the educational value that it's purported to have? are there "unofficial" reasons that having a university education would benefit one going into industry? are there ways in which university education is overrated?

pure heron
#

Some, yes, yes.

#

πŸ˜„

sand bramble
#

I think it depends on the person and how they learn? An example is how valuable I find my education... Without the structure and curation (as someone in career discussion put it) I'd be lost.

pure heron
#

Someone in #career-advice said recently that they didn't think "anyone cares about a piece of paper".
This suggestion is empirically wrong. It's easy to find job postings that require a degree, at all levels. Smaller companies are less likely to care about the degree, larger companies and government agencies are more likely to care, but even at the senior level it's possible to find out you will not be hired for a job solely because you don't have that piece of paper.

To what extent does a university education deliver the educational value that it's purported to have?
There's value in the structure, curriculum, and curation. There's also value in the accreditation process for universities, which allows people who see the piece of paper trust that you have learned a particular set of material up to a particular common minimum standard. But university professors aren't always the best teachers, and it's expected that you'll need to do a lot of learning outside of class. The curriculum, and the structure, and the curation are all beneficial, as is having someone knowledgeable to turn to (professor/TA) whenever you get stuck. But the coursework is what you make of it; if you don't put any effort in, you won't get much education out.

#

are there "unofficial" reasons that having a university education would benefit one going into industry?
Yes - internships are a huge one; they're an opportunity that's generally only available to students. Forming a network of other people who are entering the same industry as you is another; it's very valuable to be able to figure out whether you're getting paid as much as you deserve by asking your college friends what they're making. They'll also quite possibly be helpful to you in landing other jobs in the future, or things like that.

It also gives people a chance to grow up a bit before entering the workforce. 18 year olds who've never lived alone before and who have never needed to set their own schedules or cope with unlimited freedom tend to make some really poor decisions, and it's a whole lot nicer to figure out who you are and how to cope with responsibility amongst a group of people your own age who are going through the same experience, rather than amongst a group of older workers in industry. Not to mention that people who haven't yet gone to uni tend to drastically underestimate how much more learning and growing up those who have gone were able to pack into those 4 years.

#

are there ways in which university education is overrated?
Some. For computer science in particular, one notable way is that the university education teaches computer science, not programming. Computer science is less relevant to a lot of entry level jobs than programming skill is.

Despite that, however, computer science knowledge is often a requirement for achieving industry jobs, especially at the entry level (leetcode style whiteboard questions, etc). And, computer science knowledge becomes much more useful as you advance towards the senior level in your career. Self-taught programmers often hit a ceiling they struggle to advance past because of a lack of grounding in theory (or, possibly, this is correlation and not causation - perhaps the people who struggle to learn theory opt for the self-taught programmer route rather than the computer science university education).

#

I think that it's much easier to self-teach programming than computer science, and I also think that it's much less valuable in the long term to learn how to program than it is to learn computer science.

#

thank you for coming to my TED talk.

sage jasper
#

holy jesus batman

#

(i'm reading)

pure heron
#

Ask fewer questions @misty dirge

desert patio
#

how could i write paragraphs like that when answering questions

pure heron
#

actually... written communication skills are another thing that tends to be much stronger in people who've got the university education than in those who are self-taught. Which also matters quite a lot now that nearly every job has some remote component.

stone juniper
pure heron
misty dirge
pure heron
#

πŸ™‚

misty dirge
#

That said, I wish you had written all that in one message so I could pin it

#

😠

pure heron
#

I'm pretty sure it would have gone over my message size limit, heh

misty dirge
pure heron
#

it's quite likely that people who were less... scholastically motivated in high school are less likely to go on to uni, and so the self-educated developer cohort might be, on average, worse students, in addition to having fewer years of schooling. So that's probably one factor. But I also think that having a few university level English classes under your belt also gives you a better grounding in English composition.

#

so yeah - probably a combination of selection bias and other factors.

sand bramble
#

I dropped out of high school after two years of being an active truant. Hated it. Couldn't focus (was also unmedicated at the time) and such. But now I'm doing very well with my degree path. For me it was a matter of finding the right way for me to learn.

pure heron
sand bramble
#

I dropped out in 2012 and have been working odd labor/retail jobs. Construction, Target, etc. I'm going for a degree hoping to get a job in a related field, because I got bored and wanted to challenge myself, and to eventually bring in more financial stability for my wife and 5 kids :p

#

Oh, I'm 27 now.

pure heron
#

got it. I'm glad things are going better for you this time around!

sand bramble
#

3.7 gpa so far and maintaining my job and family life hah. My life is hectic!

oak breach
pure heron
#

learning and growing up, or underestimating? πŸ˜„

oak breach
#

underestimating πŸ₯΄

pure heron
#

at the risk of veering into #career-advice territory again: someone who is 18 and thinks they can compete for a job that typically hires 22 year old college graduates is like someone who is 14 and thinks they can compete for a job that typically hires 18 year old high school graduates.

sand bramble
#
"Self-taught programmers often hit a ceiling they struggle to advance past because of a lack of grounding in theory"
#

Me me me me

#

Up until the structure of my degree program

silent goblet
#

I can't imagine a mediocre Russian university providing a solid foundation in English writing skills

pure heron
sand bramble
#

Submit final assignment in wrong format (instructor couldn't copy my code)

#

Instructor is a cool dude and tells me to resubmit in the right format for a full grade

#

I gotta say, I enjoy the leniency that some instructors give.

misty dirge
#

I think it's a sad reflection on the state of education that people are often worried that after paying thousands of dollars for a course, all their work will go to waste over tiny mistakes like that.

sand bramble
#

I think so too. I was genuinely worried before I saw his input on my submission. As one of my friends puts it, "instructors usually have their own thing going on and don't really care if its a little messed up" but on the flipside to that, I have seen my fair share of "horror stories" about very strict instructors.

#

Surprisingly, my Python class used direct submissions, and the HTML class I'm starting recommends some sort of version control. I thought for sure I'd be using git for the Python course. Wronggggg.

silent goblet
pure heron
# silent goblet one would hope πŸ™‚

Well, fair enough. My perspective on English composition skills benefiting from uni may be limited to what I'm most familiar with, unis in countries where English is the dominant language

ebon light
#

whats the difference between python command prompt and pycharm

stone juniper
silent goblet
weak mortar
#

how do you teach someone Classes

#

like when is it necessary, etc

misty dirge
weak mortar
#

OOP in general

misty dirge
weak mortar
#

state?

vale current
# weak mortar state?

State is sort of the like the "memory" of something. Methods on a class have state, since they can function differently based on the current state of an object, and work on the state

weak mortar
#

is it like.. having infinite buckets that you can fill with stuff..

misty dirge
#

no?

vale current
#

Think of the "condition" of an object

stone juniper
weak mortar
#

object is an instance of a class.. yeah I get the CS definitions.. and I know how to write a class..

#

I'm trying to dumb it down to understand it at the core level.. teach me like im 3

stone juniper
#

again, that's not what this channel is for

weak mortar
#

it says practices of teaching though? did I get something wrong

stone juniper
#

yes, for discussion about how to teach, not for teaching

upper flint
#

Think more like "How to Teach" than "Teach Subject x"

weak mortar
#

sad face

vale current
#

I've pinged you in pygen with a hopefully fine explanation :P @weak mortar

misty dirge
noble aurora
#

although it does raise a good question, when should classes and oop be introduced

#

in relation to lists, dicts, loops, etc

ripe folio
#

Java be like: when writing your first Hello World program

misty dirge
#

Anyone: When should I learn about OOP?
Java: Yes.

Anyway, I don't think beginners find the container types all that mystical, even though they exemplify a bunch of aspects of OOP. And you can do pretty much whatever you want with just the basic container types and functions. So I don't think OOP needs to be introduced explicitly until the learner is ready to do something of sufficient complexity that it would actually benefit from an OOP solution in a real situation. I think most attempts to teach OOP to beginners are contrived and end up communicating "OOP is how you make your code more esoteric".

vale current
#

OOP could be introduced when a beginner starts using a lot of globals to share data between functions

stone juniper
#

i think having beginners write their own container class would be better than the cat/dog/animal stuff

misty dirge
#

as a somewhat-relevant aside, I think implementing a (doubly) liked list is a great way to learn OOP in a context that actually makes sense, and you get to learn a lot of dunder methods. though some learners like to push back against having to implement things that already exist.

#

When I was the TA for an nlp class last year, I made a Python guide for all the students who hadn't used Python before, and in one part I wrote "Here are the standard library modules that you can use to avoid re-inventing the wheel, except for the wheel-reinvention that is the point of the assignments."

sand bramble
#

Why no Pope

sand bramble
misty dirge
sand bramble
#

That's fair, I go by Simplicity on most chats, but I had a friends daughter once call me Simpy, so I use that too.

misty dirge
#

simpy. that's a python package.

sand bramble
#

Lol

#

So maybe I won't use simpy here πŸ˜„

sand bramble
misty dirge
#

anyway, without going any further off-topic, implementing a doubly linked list involves implementing add, iadd, {get,set,del}item, iter, reverse, and probably several others

sand bramble
#

I bookmark and eventually read everything python-related that I find right now. Hyperfixating and all.

misty dirge
sand bramble
#

I just got found a copy. Now I'm excited hah I was looking for a new book to check out.

#

Started reading it like "ooh, shiny!"

silent goblet
misty dirge
silent goblet
#

on a sequence, __getitem__ is expected to be a O(1) operation, I think

#

For example, the default sequence iterator (based on __getitem__ and __len__) kinda assumes that, otherwise it is O(N^2)

#

Well, to be fair, collections.deque does have these methods

misty dirge
#

why quadratic? in either case, I didn't say it was efficient, only that it should be implemented if one is to implement a DLL for educational purposes.

silent goblet
misty dirge
#

implementing add, iadd, {get,set,del}item, iter, reverse, and probably several others

#

I said iter.

silent goblet
#

I'm not saying that iteration has to be quadratic

#

I said that in the context that in Python, I would be surprised to see a __getitem__ that wasn't constant

#

anyway, that's kinda offtopic here

misty dirge
#

you can't have O(1) {get,set,del}item for a linked list, no.

pure heron
misty dirge
#

isn't deque a linked list of arrays?

pure heron
#

Yes

pure heron
# misty dirge why? it's a list and should have the same API as a list.

list is a dynamic array, and it's interface is full of methods that make sense on a dynamic array. If you implement a linked list, implementing the list methods that perform well on a dynamic array but poorly on a linked list seems like a bad idea... Though perhaps it's still a useful teaching exercise.

misty dirge
#

though (for doubly linked lists in particular) it would probably be good for the learner to implement it such that it iterates from the tail when the desired element is closer to the end.

#

to learn about optimization, or something.

#

(and yes, I know that would still be O(n) 😠 )

stone juniper
pure heron
#

True enough.

peak beacon
#

at least deletion is a lot faster in a linkedlist. It really helps when you need to remove all elements matching a predicate.

pure heron
#

Removing all items matching a predicate from a linked list is linear time.
Copying all items not matching a predicate from one dynamic array into another is also linear time.

#

Something like ```py
my_list = [e for e in my_list if not pred(e)]

blazing ginkgo
#

What are good books, articles and talks on programming (preferably language agnostic)?

jolly night
#

@blazing ginkgo can you say more about why you want language-agnostic?

upper flint
misty dirge
blazing ginkgo
#

already familiar with pragprog, but thanks. I meant to say I'm looking for high-level stuff instead of stuff that's about using a feature or library of a specific language. Safe parallelization. good architecture, especially in case of programs that don't receive user input during runtime. what problem domains OOP, functional programming, procedural, etc. are good for. (as opposed to stuff like guides on using numpy or information on good python 3rd party modules)

#

I.e. writing better code in general as opposed to writing better python (which is good, but not what I'm looking for currently)

misty dirge
#

I hope you get the information that you're looking for, but it's out-of-scope for the server, so more relevant discussion gets priority for this channel.

blazing ginkgo
#

Okay. Is there a server it would be in scope for?

sand bramble
#

Might b something there for you?

#

be*

blazing ginkgo
#

Should be. Thanks

silent goblet
marble cape
#

Hello everyone

#

New on this platform,

#

Trying to up my knowledge on Python.

#

Please I needs clearity on this; What is the difference between objects and values using the terms β€œequivalent” and β€œidentical”?

pine quartz
# marble cape Please I needs clearity on this; What is the difference between objects and valu...

This isn't the right channel for this, the channel is more about discussing how the best way to teach things would be.

But to answer the question, imagine you had say two bank note in front of you with the same value. They're equal to each other, but still physically two different objects - you could check serial numbers. Similarly in Python, you could have two lists with the same contents, but they're not actually the same list object.

marble cape
#

@pine quartz Thank you.

So, that is what it means by equivalent and identical.

Like say two like objects that is of one source.?

misty dirge
#

@marble cape your question is off-topic for this channel, so you'll have to go to a help channel and try there. See #β“ο½œhow-to-get-help.

sand bramble
#

The instructor for one of my current classes is pursuing her PhD through online courses. I feel like that'd be challenging!

lusty geyser
#

Hey all

#

Question for you

#

I have to do a 5 minute presentation on something relating to computer science. Honestly, its giving me more trouble than I care to admit

#

I think, what about five minutes on how to think about learning to code

#

Tips and tricks to make the process easier. Maybe discuss, based on input from people who actually teach the stuff, how the process of learning it usually looks

#

Ways to leverage that process, pitfalls to avoid

#

Thoughts?

misty dirge
#

The most common pitfall that beginners fall into, I think, is the xy problem.

  1. User wants to do X.
  2. User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
  3. User doesn't know how to do Y either.
  4. User asks for help with Y.
  5. Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
  6. After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.
    The whole process stems from step two. Often, beginners become addicted to the idea that the solution has to look a certain way. I suppose because they imagine an incomplete solution that uses some of the tools that they know, when a better solution involves tools that they don't know that they don't know.

Remember that the slow mode is intended to encourage one to say everything they have to say in one message.

lusty geyser
#

I thought it was just to prevent spamming. I'll adjust my writing style accordingly

misty dirge
pure heron
#

They're often "here's a cool tool, here's 3 things it can do for you, check out $resource for more information" or things like that. 5 minutes might be enough time for something like "how to interpret a Python traceback", or "how to use get started with using a debugger"

lusty geyser
stone juniper
#

otoh its hard to get bored in 5 minutes

misty dirge
#

I just switched to this channel and I'm already bored. Someone do a little dance or something!

noble aurora
#

πŸ’ƒ

sand bramble
#

Ooh lala.

dim scarab
lusty geyser
#

😐 I just don't understand it, and compression has never been anything that's interested me

silent goblet
pure fog
#

or just do a quick overview of basic regex syntax with some examples

misty dirge
#

I can see that filling the five minutes very easily

lusty geyser
#

😐 I just need to find a way from keeping it from being boring

misty dirge
lusty geyser
#

"There is no spoon"

fleet pulsar
#

Pull a hekerman and extract a bunch of IPs from a file

#

That should involve quite a few regex rules

lusty geyser
#

Thing is, I can teach about regex just fine. But I get the impression this project is more about presentation skills than it is research

#

So instead of a lesson, I need to be aiming for more of a show

lusty geyser
#

dies of death

#

I want this project behind me so badly <_<

sand bramble
#

I understand the idea behind a discussion forum in online courses, but why, oh why, must I have to respond to people?! All I do is regurgitate what they said in their original post anyway...

#

(Rhetorical question, just venting!)

misty dirge
sand bramble
#

I've had /one/ class so far that actually used the forum discussion for peer review on assignments, and that was sort of cool. Beyond that, though... Not very enriching at all. It seems like it's more so to emulate the classroom environment to me.

That being said, I'm in A.S. classes, so it's not very deep. So far, anyway.

misty dirge
#

I did take a course on Asian American literature (I am a white American with only European heritage), and there were some very interesting discussions in that course, but that's obviously not STEM. (Unless you count the discussions about "benevolent racism" where we assume that all Asians are naturally good at STEM.)

sand bramble
#

I bet. I remember some of the conversations I had when I took two years of Japanese. That was 10 years ago, though.

nova heath
misty dirge
#

I'm trying to write a tag someone requested to address Python's accused slowness, and I think the most difficult part will be to ELI5 the concept of CPU-bound operations in as few words as possible.

vale current
#

eli5?

desert patio
#

isn't it just "the computer processor is the only thing used when doing operations"

desert patio
vale current
#

ahh

#

well, CPU bound operations are tasks that depend on the processor

fallow terrace
#

CPU bound operations are limited by what the computer can do, Python has no influence on their speeds.

misty dirge
#

Just to be clear, by tag, I'm referring to those embedded messages from @worldly dew that we can bring up with a command. They need to be brief and be accessible for young readers who might not have very much experience or native English proficiency.

vale current
#

A CPU bound program is something which's speed depends on the processors speed, the faster the processor is, the faster the task.

#

hm, maybe that could be worded better

misty dirge
#

I think we need to banish "processor" from our vocabulary to accomplish this.

vale current
#

right

#

what about just "computer", like how dawn had it

#

A CPU bound program will go as fast as the computer does, the faster computer you have, the faster the task is

noble aurora
#

the process is waiting for the CPU to finish doing something

misty dirge
#

Thanks for the response so far. I'll write a first draft in a bit here.

pure heron
green warren
#

Python is also great for prototyping algorithms, even if you plan to rewrite them in a faster language afterwards. Time complexity scaling is universal, what you gain by rewriting in something like C++ is a constant factor.

#

And development speed is super important in the real world. Definitely don't want to waste your time writing something in a complex language like C++ only to throw it away because it's based on wrong ideas.

misty dirge
#

@zealous portal I deleted your message, since it was off topic. Please refer to channel descriptions.

zealous portal
vale current
misty dirge
misty dirge
vale current
#

You could write about profiling

#

Or well, not about it, and rather list it

misty dirge
#

it's a related idea, but tags need to be narrowly focused

#

the tag is intended to address "bruh python so slow just use java"

#

or "I heard python is slow, why should I learn it?"

#

on that note, are there any libraries outside the data science sub-ecosystem that rely heavily on C extensions?

vale current
silent goblet
#

aiohttp, asyncpg

#

ncurses 😎

pure fog
sand bramble
#

@misty dirge how goes the tag writing? Curious to read it whenever you're done.

misty dirge
sand bramble
#

That's fair. I have a list of "didn't end up getting to it yet" haha.

fallen shell
#

Anyone know what the best platforms are for building courses? I want to be able to embed interactive code snippets and I found https://www.slip.so/ and it looks really good but doesn't seem to be being maintained anymore :/

misty dirge
#

@proper moth please respect channel topics (this is a discussion channel, not a help channel), and please do not ping random people looking for help. This is a warning. See #β“ο½œhow-to-get-help.

misty dirge
vale current
#

tkinter, pyqt? Theres also the ones that fix listed

misty dirge
#

which of those are specifically for making CPU-bound operations faster? I see aiohttp and asyncpg and think that these are network-related and thus not CPU bound.

oak breach
#

wouldnt numpy/scipy cover most cpu bound operations

misty dirge
#

it may be that data science really is the one place that involves huge cpu bound operations tangerine_think

oak breach
#

yeah how often do you have cpu bound operations as the bottleneck outside data science

#

or well other sciency simulation stuff

silent goblet
#

Parsing HTTP does take time

#

there's no point in making a C extension except if you're accessing something low-level or speeding up CPU-bound work

silent goblet
sand bramble
#

I'm lacking the motivation to do my coursework whoo... Time to look at my student debt. That usually does the trick

misty dirge
fallow terrace
#

This might not be on topic for this channel, I'm not sure.

Whenever I hear an explanation of the purpose of a function (and I'm guilty of this), I always hear it as (some variation of) "functions are used to avoid repeating the same code multiple times." Maybe it's just me, but I use it far more for readability, even if that code only shows up once. Because of that, I'm having trouble grasping why that is (or seems to be, anyway) the go-to explanation.

Is that due to a misunderstanding on my part (that is, it's not really explained like that for the most part), am I the only one who uses functions like that, or is there a better way to teach that?

noble aurora
#

i like "naming a block of code"

vale current
# fallow terrace This might not be on topic for this channel, I'm not sure. Whenever I hear an e...

I've always used functions in a similar fashion as well. I'll typically use functions when I don't want to clutter a block of code with a "section" of code which does some task, and rather, stick it into some function, even if it won't be used multiple times. That's partly for readability, and also so that when a problem arises, I can figure out what specific function doing a task might be causing the problem, rather than looking in a large block of code which does several things. Imo functions could be better explained as a tool which allows you to group a block of code which does some task, regardless of how many times the code inside the function is reused. This could also include the avoiding repetition part

fallow terrace
fallow terrace
#

not really related, but I wish courses focused more on language idioms, e.g. when to put something into a function or whatever, not just style and all that

green warren
#

I think if you feel the urge to write some lines of comments to give your code "sections", it's time to break it up for sure.

#

But in general, a function should do "one thing". If you can't describe in one sentence what it does, then it's too long.

#

(And this includes the main() function)

fallow terrace
green warren
#

It can, yeah. I mean, having different levels of abstraction allows you to pack more meaning into a sentence

sand bramble
pure heron
#

instead of explaining what a function is, we explain some of the things that functions are used for, because what a function is isn't something beginners would be able to wrap their heads around

#

Wikipedia says:

In computer programming, a subroutine is a sequence of program instructions that performs a specific task, packaged as a unit.
Which is entirely true, but not helpful to teach, I think πŸ˜„

vale current
#

automate the boring stuff describes it as sort of a "program within a program"

pure heron
#

which is true - subroutines have historically also been called subprograms - but I don't think that definition helps you understand functions

#

I think we need to give concrete examples for that, and reusability is the simplest concrete example

weak mortar
pure fog
#

are "subroutine" and "procedure" synonymous?

#

in my mind they are, but i might be wrong

pure heron
#

I'd agree that they are. There are languages where there are different types of functions, where you'd have to be more precise, but in the general software development lexicon I'd say they're interchangeable.

torpid prawn
#

In software engineering, SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible, and maintainable. The principles are a subset of many principles promoted by American software engineer and instructor Robert C. Martin, first introduced in his 2000 paper Design Principles and Design P...

misty dirge
#

my understanding is that "subroutine" and "procedure" can both refer to function that has side effects and which don't return anything. though "subroutine" begs the question of what what routine it's the subroutine of.

weak mortar
#

CAN SOMEONE HELP ME WITH A PYTHON PROGRAM TO TURN ON MY CAPSLOCK.

misty dirge
weak mortar
#

this was a copied questionπŸ˜…

#

someone asked me so I added it up here

misty dirge
#

Not sure I follow. This channel isn't supposed to be a repository of unusual questions.

weak mortar
#

ok tx

noble crest
#

Good afternoon everyone. I am new to docker and kubernetes, Could anyone suggest me few resources for beginner level?

stone juniper
subtle owl
silent goblet
#

You can't make a piece of code only have one reason to change unless you can see into the future

#

For example, almost every function could be changed due to new legal requirements, to improve performance, to reflect a change in the code style etc.

fleet pulsar
#

The definition is pretty vague, yeah

#

But the point is, don't give a single unit of code (class/function/etc) too much things to do, with the extreme being a god entity that manages everything that's going on. Logging, maintaining a connection to a message queue and operating on a database should be managed by three different entities; those entities, however, can be orchestrated by a different entity

silent goblet
#

right, so code should have high cohesion

fleet pulsar
#

Seems so, yeah, although I'm not familiar enough with cohesion to certainly say if it relates to SRP

green warren
torpid prawn
#

i think its good from a teaching standpoint, since its focused on the design. sometimes beginners just a need a framework to think about these concepts - at least i know it helps me.

torpid prawn
#

i mean our prof also went over various software architectures and the best way to design/document them, but then told us you will almost never see this type of documentation in the wild

#

outside of like big tech companies πŸ’€

#

idk how much of that is true Oopsies

gleaming anvil
#

I think the translation from such an abstract concept like the SOLID principles to practical application (what arguments go into this function? Should this variable be a class attribute or be in a global/local scope) takes a lot of experience. I don’t think I figured it out at all until after about a year of professional coding, and years later I still have β€œAHA!” moments where I suddenly understand a better way of drawing the concrete boundaries of β€œthis code goes here” to better fit the SOLID principles and how that causes better behavior of the various interfaces in/around the code

fleet pulsar
#

Ultimately, it boils down to managing abstractions properly, because at one point or another you'll have to break the principle

#

Most practically useful programs do more than one thing, i.e. a webserver may access a database and handle various requests

#

It takes a good amount of practice to figure out the details, and it varies from project to project, but usually you just want to sort of "delay" mixing responsibilities together until main

#

Functional languages, such as Haskell, show this [delaying things until main, I'm aware that pure vs impure is not the same as SRP] fairly well with the distinction between pure functions and IO

misty dirge
#

Is there any practical application to learning big theta and big omega? I think learning about time complexity is very useful, but it seems most CS students come away thinking "big o is for the worst case, big theta is the average case, and big omega is the best case", and that's not right.

orchid thistle
#

i think in general schools tend to focus more on knowledge of specific information (because that's easy to test) but really it's more important to understand the actual ideas than to know which greek letters people use to express specific permutations of those ideas
so i'd say that ideally what should be taught is just the basic essence of the concept - describe roughly how the amount of time/space something takes, as a formula in terms of the size of the input, and use that as a guide on how fast something is
(example of this point: i don't actually know what exactly big theta and big omega are supposed to mean, but show me two algorithms to compute something and i can still describe how long they take and tell you which one i think is probably faster)

noble aurora
stone juniper
#

best way to clarify would be to teach asymptotics before adding the context of time functions, but I think this raises the question of whether complexity classes are even relevant to day-to-day programming

#

being able to analyze a program to determine that it's n^3 is helpful, but only in the context of benchmarking it, not in the context of proving that it's big theta of n^4

pure heron
# silent goblet Either the definition of SRP is too vague to be of any use, or I just was never ...

I feel that way about nearly every one of the SOLID principles. Liskov substitution principle is the only one that I regularly keep in mind when designing classes. Open/closed principle is often outright bad advice, dependency inversion principle needs tons of human judgment about where you should be flexible and where you shouldn't, and the interface segregation principle just seems obvious to me.

silent goblet
#

I guess the idea that code should be closed for modification is kinda strange.

pure heron
#

right, as is the idea of code being open for extension by default

#

most classes aren't, and shouldn't be, designed to be subclassed

silent goblet
#

hm

#

I guess the same goes for the phrase "program to an interface, not an implementation"

#

some people (I've seen this in C# I think) make an interface for every god damn class somehow!

orchid thistle
#

i think the phrase is meant to be "program to an interface" rather than "program to an interface" - "don't rely on weird details of the code that might change", not "write an interface for every class"

silent goblet
#

I guess the right version is "program to an interface, not an implementation, where appropriate (apply your judgement)", which doesn't really say anything

pure heron
#

right. That's what I meant about knowing where you should be flexible - like, maybe allowing your business logic classes to work with different database providers makes sense, and you should use an interface for talking to the database. But, allowing your business logic classes to work with, say, different calendar systems probably makes no sense whatsoever.

#

We're probably not gonna switch from Gregorian to Julian or Mayan any time soon...

silent goblet
pure heron
#

sure.

silent goblet
#

so what you make an interface does depend on the application as well

#

so speaking of #pedagogy... should Clean Code and Clean Architecture be among the recommended books to new learners?

#

(well, not new, but with sufficient knowledge to read them)

pure heron
stone juniper
#

What people in industry call big oh is what people in academia would call big theta
wait...

#

wow you're right

pure heron
#

Using the academic definitions, quick sort is O(n log n), but it's also O(n^2) and O(20^n).

stone juniper
#

i guess i never noticed bc its big omega most of the time

noble aurora
#

hm, not 20*n

orchid thistle
#

O(20*n)
...you sure about that? since that's the same as O(n)

pure heron
#

typo πŸ™‚

orchid thistle
#

ok 20^n makes more sense

noble aurora
#

ah

pure heron
orchid thistle
#

O(20 xor n)

noble aurora
#

it's actually really annoying, "is this convo mathy enough to use ^ for exping?" comes up too often

pure heron
#

but, yeah - if you ask someone in industry whether quick sort is O(20^n), they'll say "no, it's O(n log n)". In my experience no one in industry ever refers to big theta or big omega by name, and when they say "big oh" they mean "big theta", 100% of the time.

oak breach
fleet apexBOT
stone juniper
noble aurora
#

that wouldn't fix anything though, unless you also add that to Python

stone juniper
#

thats phase 2

pure fog
sand bramble
#

I will one day understand math >_>

dense stirrup
#

Hey, i have been learning coding since september. I'm still struggelig. I can all the syntax and what they do, but when i get a problem and i need a solution i dont know what to do, and im stuck

stone juniper
dense stirrup
#

sorry

short oyster
#

Anybody recall the website which has samples of programs for every major programming language?

pure heron
#

Rosetta code?

burnt night
#

hi

#

I'm here to learn English

#

what are you doing

stone juniper
bold root
#

Can I become a programming pedagog?

orchid thistle
#

i don't think "pedagog" is a word
this channel is for discussion of how to teach programming

silent goblet
# orchid thistle i don't think "pedagog" is a word this channel is for discussion of how to teach...

Wiktionary says it's an alternative (presumably "correct"?) spelling of pedagogue, kinda like dialog and dialogue
https://en.wiktionary.org/wiki/pedagog

  1. A teacher or instructor of children; one whose occupation is to teach the young.
  2. A pedant; one who by teaching has become overly formal or pedantic in his or her ways; one who has the manner of a teacher.
  3. (historical, Ancient Greece) A slave who led the master's children to school, and had the charge of them generally.
fleet pulsar
#

pedagog window

silent goblet
gleaming anvil
#

it's a choose-your-own-adventure meme

weak mortar
#

why do people in the know-how insist on using jupyter notebooks for learning python? they're horrendous

silent goblet
#

I agree, it's not a very good idea

#

who recommends that?

weak mortar
#

I'm helping out a user on a help channel that's following a tutorial that's using notebooks

#

and I'm never sure if its their code or the notebooks fault

misty dirge
#

@weak mortar @silent goblet data science instructors usually teach jupyter notebooks as the default assumption. I figure they do this for the positive feedback loop of seeing the result of ones code in real time, and while there's something to be said for keeping things engaging when someone is learning a new, difficult skillset, I think the costs outweigh the benefits.

weak mortar
#

agreed

misty dirge
#

In particular, beginners aren't really prepared to deal with non-linear execution. frankly, no one is, because that kind of pushes the limits of the human brain.

weak mortar
#

I agree, but it's not just human brains. sometimes even notebooks crash because of that

#

also, it's not easy to share the 'whole' code from notebooks. especially for beginners

#

notebooks have their place, but not for learning, imho

misty dirge
#

I use them at work to make demos for non-technical people. and sometimes I use them for experimental stuff, without the pretense that any of it can ever be reproduced.

weak mortar
#

those are the use cases I'd recommend them for :)

misty dirge
#

I wouldn't even recommend them for those use cases, just to stick it to the man, you know?

weak mortar
#

I don't :D

#

I mean, you're not a beginner, you know the limits of notebooks

misty dirge
#

I'm not a beginner? that's the nicest thing anyone has ever said to me.

weak mortar
#

without the pretense that any of it can ever be reproduced

#

I'm not following you

#

you seem to be aware of what notebooks can and can't do

misty dirge
#

I'm also aware of my awareness. meta-awareness.

weak mortar
#

not sure what sticking it to the man has to do with it

misty dirge
weak mortar
#

ah, sorry

#

I've missed that. it's been a long day

misty dirge
#

that's okay. it probably depended on some cultural context that we don't share.

neon pasture
#

I find notebooks really nice for experimenting, it's like a more usable repl. But while I do think teaching in a repl makes sense, a notebook is a tad overkill.

green warren
#

Coming from Mathematica notebooks, I'm used to the pitfalls of nonlinear execution

silent goblet
#

I'm usually okay with IPython just for experimenting with stuff (as in, the in-terminal thingy, not Jupyter)

weak mortar
#

notebooks are great for experimenting, imo

#

but yeah, ipython is the bomb

misty dirge
green warren
#

Ah

#

So like the interpreter itself

misty dirge
#

jupyter notebooks are basically a beefed-up IPython repl

silent goblet
misty dirge
weak mortar
#

beefed-up repl with alzheimers

green warren
silent goblet
#

idk, I haven't tried

#

unfortunately I can't buy MS Word right now, so I have to stick with inferior editors such as VSCode

weak mortar
#

^ is trolling

weak mortar
misty dirge
#

no they're serious. MS word is a great IDE because you can make the important parts of your code bigger and set your own color scheme (manually) /s

silent goblet
#

I legit can't buy word tho πŸ˜”

weak mortar
green warren
#

You're misunderstanding me. The question is about how to get autocomplete in Jupyter

weak mortar
#

ah

#

I've no idea

misty dirge
#

there's a jupyter notebook thingy in pycharm

green warren
#

If there is one thing I can't stand, it's editing any sort of document in a web browser

weak mortar
#

so don't ;)

green warren
#

There is VS Code integration. I haven't tried it yet, although my colleague uses it so maybe I'll ask him

weak mortar
#

?

weak mortar
#

Hello

white bough
#

We probably need a bot command to the talk β€žwhy notebooks are badβ€œ and β€žwhy notebooks are still badβ€œ

#

https://youtu.be/7jiPeIFXb6U

Sorry got the name wrong

I have been using and teaching Python for many years. I wrote a best-selling book about learning data science. And here’s my confession: I don’t like notebooks. (There are dozens of us!) I’ll explain why I find notebooks difficult, show how they frustrate my preferred pedagogy, demonstrate how I prefer to work, and discuss what Jupyter could do ...

β–Ά Play video
misty dirge
white bough
#

My suggestion, was not serious, I just thought that this talk could help in this discussion, cause all the points that were brought up and more (but split between 20 messages) are in it and it could maybe interest someone. Especially someone that would start teaching via notebooks.

I just wrapped it in a bad joke πŸ˜‰

Edit: regarding target audiance, check the video to see at which conference it was held πŸ˜‰

misty dirge
#

check the video to see at which conference it was held
surprised they approved that talk.

white bough
#

The presentor was actually asked by them to do it after posting on twitter that he hates notebooks.

He explains it in the beginning

misty dirge
#

also someone just said "pedagogical" in the call I'm on. that's so serendipitous.

vale current
#

Blasphemous

sand bramble
misty dirge
sand bramble
#

Introduction to Algorithms, 3rd edition (mit press)

misty dirge
sand bramble
#

Hit me up with some book/article recommendations, please?

misty dirge
orchid thistle
#

...ok googling for "classical algorithms" the first result is a wikipedia page using "classical" in the context of quantum computing, so that doesn't sound right - what are "classical algorithms"?

sand bramble
#

Data Science

misty dirge
misty dirge
# sand bramble Data Science

I wouldn't really jump into that at this stage in your education. Data science is a career direction unto itself and requires a lot of math to make meaningful contributions.

sand bramble
#

I'm more so curious to see if I can currently grasp the content. Get my feet wet type of thing. I don't expect to fully understand any of it yet. I also have a ton of books saved on my laptop for "when I get to that topic in my education"

Edit: there's also the fact that I don't really know what I want to do career-wise yet, so I'm hoping that I'll find something early on that interests me so that I know what to focus on. :)

pure fog
#

it's more like applied statistics and probability. signal processing can be relevant in some subfields, like audio processing. the fact that "machine learning" is covered at all by computer science departments is more of an historical accident than anything.

#

programming is a necessary part of data science because we need computers to do data science

maiden turret
#

usually it's just import module use its method to get the computer to consolidate the data and spit out parameter values

pure fog
#

that's a different issue. data scientists just aren't good programmers usually

#

nor do data science libraries tend to use a lot of abstraction or functional programming concepts

worn kayak
#

Heyo, I've been in this server for a while but haven't really been active.

Anyway, I haven't really worked on any personal python projects but was hoping for some recommendations for a beginner (well semi-beginner, I've kinda did a bit of OOP with python but a lot of my learning has been kinda fragmented if that makes sense)

Also would like to start some more practical/real world projects this year too, e.g. thinking about getting a Raspberry Pi at some point.

misty dirge
worn kayak
torpid prawn
torpid prawn
dusty aurora
#

data nice and CLEAN 😑

edgy tree
#

any1 here codes css & Html

civic marsh
torpid prawn
#

i believe kids would benefit from more programming being taught in secondary school

#

even if they never end up using programming directly. the type of problem-solving ability sticks with them i believe

tawny comet
#

though not everyone like programming

green warren
#

It can be very simple programming. When I was a kid, they had us play around with turtle graphics in Logo.

silent goblet
#

We had some QBASIC at school, it was pretty nice drawing shapes and stuff

pure fog
#

it was a great experience, lots of fun and we all learned a lot

#

but this was an AP course (not sure about equivalents outside the US) and we only spent serious time on it in the last ~6 weeks between the AP exam and the end of school

#

also most of the course was graduating seniors so there was an extra sense of freedom for both the teacher and the students

#

so i am not sure how repeatable or transferable that experience was. but the teacher was excellent, i was lucky to have mostly very good teachers at my public schools

granite garden
#

you guys did arduinos and coding in physics? lucky

misty dirge
#

@teal vine this channel is for the discussion of programming education, not programming help

kind elk
#

I'm starting computer science at university today, any advice for me? ahah

misty dirge
#

congratulations btw! I hope this will be an enriching experience for you.

kind elk
#

Well, Introduction to programming, math, algebra are the main 3

#

I've been programmign for a while tho

misty dirge
# kind elk Well, Introduction to programming, math, algebra are the main 3

the difficulty of the introductory course will probably depend on how much prior experience you have. mine spent like two weeks on Java for loop syntax -_-

I would keep in mind that all learning is ultimately self-learning. what you're paying for is curation (the university decides how and in what order the information is presented) and the accreditation (the university is certified as upholding a certain standard of education, and by giving you the degree, experts are certifying that you have met that standard).

#

I would also keep in mind that computer science is about theoretical math. as you get deeper into the degree, you'll be taking courses that don't immediately have anything to do with programming. your degree program is not a trade school for programmers.

kind elk
#

Yeah math is my main concern

#

Im not bad at it, I just dont enjoy it

misty dirge
#

it's the computer's job to do the calculations. when it comes to math, it's more important that you're able to reason through the problem.

#

the math that you learn will also be less number-crunchy at times. you'll probably learn set theory, which is a way of modeling collections of things, and graph theory, which is a way of modeling the relationships between things.

kind elk
#

I've quit aerospace engineering, studied it for bout 2 years. U think its gonna be differ from what I've learnt?

misty dirge
kind elk
#

2/4 math and all algebras

misty dirge
#

I'm in a meeting now. but I imagine that it's going to be quite different, though the gen ed requirements might be similar.

kind elk
#

Makes sense

#

Thanks

misty dirge
#

@kind elk I would also read godlygeek's comment (and the ones after it) in the pins for this channel.

torpid prawn
tawny comet
#

Agree

pure fog
# torpid prawn thats pretty dope

it was fun! my partner and i made a "safe" out of lego and a cardboard box, you had to punch in a number combination on a digit pad, and it would open the box w/ a relay and a motor if you got it right. it was super janky but it was fun, very satisfying

#

another group took on the challenge of wiring up a multi-segment led display, which looked intimidating. the teacher had to give them special help writing all the code to map the segments. it was one pin per segment i think, so it was a lot of wires on that breadboard

runic hull
#

My school teaches Scratch in 12th grade (17/18 year olds!)

upper flint
#

Hello, this channel is for discussing how to teach programming concepts, not showcasing projects. Thanks

gray thicket
#

can someone pls help me with python im new

stone juniper
misty dirge
#

Please refer to the description of the channel and Scofflaw's message.

sweet dove
#

I am going to start teaching tomorrow and im going to need some of the most vile disgusting code I can get, I have a few examples already, but if anyone has something id love too see it

misty dirge
#

@sweet dove disgusting in what way? What are the learning goals for the lecture?

sweet dove
#

not realy a lecture

#

just need an example of unreadable code that runs

misty dirge
#

Unreadable as in unpleasant to read or exceptionally difficult to understand?

sweet dove
#

I need some of both

silent goblet
#

what is the theme of the lecture?

#

And what is the audience?

sweet dove
#

there was one student that said any code that runs is good code

#

I told him ill give an example next time, and I want a good one

silent goblet
sweet dove
#

oh that looks good ty

misty dirge
#

!e

import string; print(''.join((z := ' ' + string.ascii_lowercase + '.,')[z.index(i)-2] for i in 'yj.bkubgxgt.vjkpibjgtgbuqbygktf'))
worldly dewBOT
#

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

why is everything here so weird
misty dirge
#

@sweet dove there you go

pure heron
worldly dewBOT
#

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

001 | 0
002 | 32
misty dirge
#

@pure heron what have you done

pure heron
#

made integer addition subtract

misty dirge
#

!warn @pure heron trying to destroy the very fabric of Python

pure heron
#

what if your keyboard doesn't have a - key 🀷

misty dirge
#

!e

result = 3 + (2).__neg__()
print(result)
worldly dewBOT
#

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

1
misty dirge
#

easy.

pure heron
#

look, you have your way, and I have mine. They're equally good, since all code that runs is good code. πŸ˜„

#

!e I'd also suggest something like: ```py
print(True << True << True << True << True << True | True << True | True << True << True << True)

worldly dewBOT
#

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

42
silent goblet
stone juniper
worldly dewBOT
#

@stone juniper :white_check_mark: Your eval job has completed with return code 0.

1
stone juniper
#

easy

silent goblet
stone juniper
#

hey im just offering solutions

pure heron
misty dirge
#

!otn a you don't know my life

worldly dewBOT
#

:ok_hand: Added you-don’t-know-my-life to the names list.

misty dirge
#

On one hand, beginners sometimes ask questions that are very narrowly focused and which would benefit from additional context (this often coincides with the xy problem). On the other, they sometimes ask questions that are so broad ("how do I do this very general thing") that potential answerers don't really have an entry point to assist. We all have a sense for what the happy medium is, but how could we describe it? Is it possible to teach someone how to ask good questions, or is that something that can really only be learned from experience?

sand bramble
#

I think a little bit of both. I've learned from some experience asking bad questions and getting bad answers, asking bad questions and getting NO answers, and I've also learned through being taught (don't ask to ask, etc.).. I also have "taught myself" by watching and lurking during the great conversations I see here from time to time. I've found that, the more detailed my questions, the better the answers I get.

That being said, I also think I still ask bad questions. It's an endless pursuit to get better at!

pure fog
#

it's just the nature of things. until people stop being born and/or people stop deciding to try programming (or stop needing to learn programming), there will always be newbies. and with newbies come bad questions.

#

some people lurk and figure it out, some people don't. some people lurk and still don't figure it out. other (fewer) people don't lurk and get it right anyway.

misty dirge
#

but do you think that asking good questions is something that can be taught explicitly? and not just taught as in "conveyed" but conveyed in such a way that it's understood by the intended audience.

pure fog
#

i think understanding is more a matter of desire than ability, for a lot of people

#

you can lead a horse to water, but you can't make it drink

#

we have a whole damn guide to asking good questions. most people respond well when you explain how to ask good questions. they just don't want to or don't know how to use their observation and critical thinking skills.

#

or if you are talking more broadly beyond "help me with homework plz", then i think both

#

if someone is at the point where they want to actually learn how to ask good questions, then yes it can be taught

#

keeping in mind that there is no unambiguous way to ask good questions; there are only best practices, which might vary across communities. as the old saying goes, "lurk moar"

oak breach
#

can't count the number of times i've fixed my own problem just trying to get a MWE

pure fog
#

after doing that 2 or 3 times, i realized that there is huge educational value in being forced to express yourself coherently

pure heron
green warren
#

I start basically every project or programming task by writing down, on paper, in words (not pseudocode!) what exact problem needs to be solved, and how exactly I am going to solve it.

#

I feel like if you can't express these things in words, you have no business starting to write code.

native hearth
#

I dont think this is a programming specific issue
Its just people not knowing how to ask questions in general which is itself mind-boggling
Dont they teach this skill in school?

noble aurora
#

i definitely learned it in school

native hearth
#

To be fair, most beginners here are middle/high school kids so i guess theyre still learning how to ask proper questions

#

But i've noticed this in grown adults holding down full time jobs and i wish i could hold a seminar on how to ask a good question without looking like the asshole

cosmic aspen
native hearth
#

We're a small startup, management is pretty much the two founders
Everyone else (7-8 people) has worked there for years and im 6 months in
Theres no positive outcome from this, i'll just be seen as antisocial

#

Right now i just put up with it and try to suggest that they better describe their issue

cosmic aspen
#

If you are able to describe the problem to either of the two and get their backing then you may just get that question asking seminar

livid kindle
#

Additionally, if any member of the team tries to get help outside of it by, say mailing lists, IRC channels, etc, it'll be beneficial. Most often question that require someone ask several times back to just understand an issue are ignored.

green warren
#

It is true that the vast majority of people do not know how to communicate effectively, whether asking questions or answering them.

#

Or even writing academic papers, by people whose main job it is to do that.

silent goblet
#

One side-effect of poor communication seems to be poor documentation, or otherwise writing code others can understand

crude juniper
cosmic aspen
native hearth
#

Theres more people in the company, these are the ones i interact with however and theyre not at all technical people, theyre in sales and operations but that getting offtopic

#

The point i was trying to make is that its not just programmers with difficulties in asking question, its a broader issue

green warren
#

of course

#

I kinda think the skill of being able to ask good questions is a bit orthogonal to technical skills like programming and math

tidal orchid
# weak mortar wtf

\u005f is the unicode sequence for _
other than that, it's just 3 + (2).__neg__() which is the same as 3 + (-2) or 3 -2

weak mortar
#

ohh

#

ok it isnt too confusing now lol

#

thanks

misty dirge
tardy rose
#

what exactly do we do in this channel

misty dirge
subtle owl
#

I am curious to hear what type of exercises or practices would people recommend when it comes to critical / computational thinking.
Meaning things like (copy/pasted from a blog):

  • Decomposition – the process of breaking down a complex problem into smaller parts that are more manageable, and helps us see problems as less overwhelming.
  • Abstraction – identifying common features, recognizing patterns, and filtering out what we don’t need.
  • Algorithmic Thinking – designing a set of steps to accomplish a specific task.
  • Debugging and Evaluation – testing and refining a potential solution, and ensuring it’s the best fit for the problem.
oak breach
#

i think making simple games checks most of those boxes

#

one of my first non-trivial projects was making scrabble and it really was a great learning experience

subtle owl
#

Interesting. And what about something embedded in the work stream of an engineer. Like let's say you were trying to help an engineer develop some more muscle in these areas

#

Like some of the practices I have been working on relate to:

  • Including the five Ws in the preparation of their work
  • Providing diagrams with the proposed changes, areas of impact and the nature of the changes
  • Taking inspiration from the completed staff work practice so they can think through more their ideas prior to coming with questions
  • Presenting hypothesis and assumptions when confronted to a problem and a plan to validate them. Taking a more science and fact based approach rather than the current approach of asking senior engineers like they are stack overflow
ripe folio
#

Ah, do you want this work to be somewhat serious, or- can it be more in the "fun" category (like what hsp suggested, games)?

subtle owl
#

In theory, all ideas are on the table, but in practice it would be much easier if it could be integrated in the work environment.
The target would be an engineer on a team. So while they can always practice on a side, having something integrated in their work enable them to set more quantifiable goals and include it in an ongoing practice and coaching.

green warren
#

Given that this is in a work context, one question I would ask is does this person feel comfortable spending time not literally writing code? I think some people feel they are going to be judged for not constantly typing all day, or at least personally feel like they are not really working if they are not producing lines of code.