#pedagogy
1 messages Β· Page 12 of 1
never used it
@pure fog thonny comes with embedded python?
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
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!
is this https://automatetheboringstuff.com/ still the go-to tutorial for complete beginners?
there are other beginner resources on our website
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
thanks, for the additional info, but it doesn't answer my question :)
would you recommend another tutorial?
There is no universal best beginner resource. You can look at those that we recommend and, from the description, decide which aligns with your teaching goal.
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
do you have one in mind from the top of your head?
@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.
omg
interesting. thanks for the info
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)
@molten star your message is off topic. Please refer to the channel description before speaking in a channel for the first time. Thanks!
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)?
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:
- 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.)
- 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.
I see
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.
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
sure, but beginners aren't likely to think about how lists and dicts have persistent state and hidden implementations.
you don't think they ever wonder how a list or dict works? I've definitely seen beginners here ask those questions.
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.
Prior to OOP this was how people learned to code ... basic was the entrypoint of many back then to software development and it was fun
Beginners nowadays probably learn scratch or Python first ...yeah teach logic first then how to compose blocks or units of logic in a function or code block or procedure before teaching inheritance and OOP
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
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.
This is a product of the way curriculums are designed...since for the curriculum designers they have a defined learning objective....eg learn if statement then have a small project to test if the student knows if statement....so the small and useless projects
yes
mhm. it's from some msft curriculum.
msft? microsoft..?
Yeah seen them lol
having an assignment that's intended only to teach if statements is fine. but the examples need to be not bad.
Maybe if the exercises arent mechanical and give the students some leeway to be a bit creative...yes
yeah
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.
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
Slightly unrelated, but i feel type hints should be taught fairly early on
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
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.
they aren't (not to me, anyway)
my wording was just bad
It doesn't change how the code is written, that's true, but it can change workflow and all that fun stuff. And the exposure is still good imo.
Hey guys, do any of you know any good refresher courses for python covering everything from loops to classes? Preferably resources that are free
there's a resources page on our website that can be filtered for only courses and free items, but your question is off-topic for this channel.
this technically does have uses cases, fwiw
you might want to try importing something and instead of a sad error message for the user you could output a nice error message
I don't deny that.
My problem is that students aren't introduced to those real world use cases.
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
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".
yeah, the most basic stuff like int(input())
true, but my examples still stand, I think - for network requests, you can retry. For saving a file, you can prompt the user for a new path and try again, or whatever.
mm. In that case I'd probably prefer students check isdigit() instead - int() is an example of something where you can know in advance whether it will succeed in advance or not
yeah, and explaining "end of file" to beginners who don't realize that stdin is a file seems... not fun.
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
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.
sure, but it's pretty hard to simulate tbh
maybe on Windows >_>
"just fill in the 500GB you have left but make sure to leave about 7MB of free space"
permissions are easy to simulate
permissions - yes
though granted, you could check those in advance.
yeah we're not going to explain TOCTOU before try-except
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
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
explaining a multithreaded/multiprocess issue seems pretty hard to someone who hasn't heard about try-except yet @pure heron
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"
"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?"
hmm
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.
I guess
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
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.
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)
what are those two acronyms?
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
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.
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
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.
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.
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
that's broadly true, I'd say.
how do you square that with this?
I'm just wrong, as @fleet pulsar pointed out - validating that a string is a valid int isn't as easy as I thought π
you could do it with re, I suppose, but at that point...
if set(s) <= set("0123456789") π₯΄
Should they be introduced to tools like mypy too then π€
Although that might be overkill
imo no, the benefit of typehints for beginners is just to get them to think about the underlying objects and what type they are
leading or trailing + or - π
really I think it's r"^[-+]?[0-9]+$" that users would typically want to validate against - but, that's not great.
i agree with this
don't forget hex and octal!
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
!e
print(int("0o10"))
@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'
is there a way to make it work?
ast.literal_eval and then isinstance(x, int) ig
i mean nothing is going to work with int, right?
No, you're right, I'm wrong, again π
tbh i was a bit surprised it didnt
!e print(int("1_0_0"))
@pure heron :white_check_mark: Your eval job has completed with return code 0.
100
That works, though, and someone performing input validation likely wouldn't expect it to
Hello everyone, I have a question about Python. How can I fix it?
Pass 0 as base
!e ```py
strings = [
"0b111",
"0o111",
"0x111",
"111"
]
for s in strings:
print(int(s, base=0))
@fleet pulsar :white_check_mark: Your eval job has completed with return code 0.
001 | 7
002 | 73
003 | 273
004 | 111
So unless you explicitly enable inferring the base from the string, it assumes decimal
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||
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
EAFP actually doesn't need to be implemented with exceptions, by the way
For example, in Rust it's done with Result or Option
you will find some python APIs which do it with None as well
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
Try-except has zero overhead if no exception is thrown
since python3.11 π
like what?
hmmm, maybe Mapping.get
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.
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
I think we're getting out of #pedagogy and into #software-architecture
which might be partly my fault but let's try to get back on topic
--remove by myself, this is really more something for other channels.--
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
--remove by myself, this is really more something for other channels.--
I was always under the impression that a try block adds no overhead
It currently adds some overhead, but less than in most languages.
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.
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"
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.
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
(not interface as in the java sense, more like "in a public API")
That sounds like a misuse to me. You could say "implement x in my code", but "into" is out of place there. I think this is the kind of thing that happens when people are trying to learn new terminology, though. People get the impression that they have to say something using the fancy new words.
How much programming related discourse do you engage in outside of this server?
none, really
Anyway, I suppose any time you're writing code, you're also implementing something.
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.
If you can assess their target and where they are at, then the answer should be natural?
I've never heard the word implement used in such a specific manner in my career, I've definitely heard people use it as a synonym for "use" many times
As a synonym for use? Not even write/make?
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
this usage of "implement" is consistent with my usage. they have an idea of what the plotting library is intended to do and create something that fulfills the requirement/specification.
not sure what you mean by "in this page" though.
like, they are importing matplotlib.pyplot.hist to make a histogram on some dashboard
obviously real life is usually harder than that
wait what? this is the worst thing I've ever heard.
this channel is for discussion about how to teach computer science, but you can open your own help channel from #βο½how-to-get-help
thank
this is a contrived example. The point is I hear the word implement most frequently in the context "I'm going to implement {existing tool} to solve {my problem}". Near complete synonym with the word "use" in this context
right, it's the usage that I dislike, not the example.
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
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
ah, sorry, I misunderstood. I thought it was about imports
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.
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% :)
"I like coffee that's really light" serves them the lightest roast "THIS IS BLACK. WHERE IS THE MILK????!"
now I'm triggered 
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?
"light milk" is the classic: light in color due to a lot of milk, or not a lot of milk? it's kind of a lesson in teaching people the importance of using precise language
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
You may have noticed that the majority of people are terrible communicators
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
I totally resonate with this btw, honestly a surprisingly large part of my job is sitting in meetings b/w people with different skillsets/backgrounds and translating terms b/w the two sides, then getting them to standardize on one or the other.
pedantry can be both a blessing and a curse
i don't think it's fair to conflate "precision" and "pedantry"
but yes i agree with the point
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
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...
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
what a classic
!otn a precision is pedantry
:ok_hand: Added precision-is-pedantry to the names list.
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
big data is not specific enough for you?
which one is that?
Ag-tech. This is getting pretty far from pedagogy tho
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.
sometimes the best way to do your job is to educate the people around you
PMs, internal stakeholders, etc.
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.
sure, but I sense that most python beginners think they need to create an exe to legitimize what they've created
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
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.
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
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
I think in that situation all you should do is just point at the error message
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
We often overlook this as experts so end users accuse us sometimes of lacking empathy..
and if you're new to rust it can be so infuriating
like "I HAVE NO IDEA WHY YOU WANT THAT"
"but why do I need to insert indirection π©"
I think the key is to remember that not everyone is like us and help educate end users... or make the app bullet proof which is impossible in many cases or impractical
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
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"
I agree, for sure, like understanding what caused the error and what to look for in the code I understand people have troubles with.
Sometimes people copy-paste code and get a SyntaxError about the indention and immediately just say "there is an error" instead of reading the error and saying "There's something wrong with the indentation" - that's the (frustrating) difference.
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.
yeah for sure. I think there's usually a productive conversation to have with novices around being respectful of the mentor's time
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.
ya for sure, I do the same thing
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
What are people's opinions on the current Humble Bundle programming bundle of books
yes. i almost always take the "socratic" approach here: "did you read the error message? what do you think it means?"
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"
I've just said "Ok"; they're not asking me anything - they're just stating something π.
I follow it up with some variant of "If there's anything you need help with please ask.", but still π¬ π
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
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!
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
did your computer experience catastrophic existence failure?
(that's where it suddenly completely fails to exist, leaving behind no trace of its former existence.)
I would check the publication dates of the books to confirm that they contain up-to-date information. Humble Bundle books tend to be older. Also, the books in this bundle seem to cover a lot of topics, and even though the cost per book is quite low, ones money would probably be better spent buying fewer books (paying more per book) that relate more closely to ones immediate learning goals.
"in the absence of further information, i must assume that your computer has left for another dimension and that you cannot be helped. i am sorry for your loss."
!otn a catastrophic existence failure
:ok_hand: Added catastrophic-existence-failure to the names list.
as funny as this is, the tricky reality is that beginners don't necessarily know what is informative when their code has unexpected behavior.
indeed. which is why i try to also follow up with something like:
please post your code and the full error output, including the "traceback" part. this information is necessary in order for someone to help you figure out the problem.
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
In case of a CatastrophicExistenceFailure , please consult your nearest copy of the HitchHiker's Guide
what no. you weren't supposed to know I was referencing something. I wanted people to think I came up with that.
iykyk π©
I'm just giving some topical debugging support is all
Do you think this comparison helps explain for/else? https://gist.github.com/nedbat/faa2a05722462d02dc24d5572c918dcd
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
the two else's do the same thing, so I hoped it would make the connection
why do you say "in some sense"?
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
but that's exactly what makes it make sense: the else is the alternative if none of the ifs are taken.
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
yeah, i can't think of a reason to use for/else without if
are you envisioning this as a kind of "lifting" the else from the if up to the level of the loop?
i'm not sure what lifting means. I just wanted a parallel that would help people grok for/else
do you find that you have trouble explaining it as "else is triggered when the loop ends early for some reason"?
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
Are you explaining it to someone who already knows another programming language? If so, I'd explain it using a sentinel. If not, I wouldn't explain it at all π
the way I think about it is that a for/else loop is a for loop that is looking for something (as opposed to a normal for-loop which is usually doing something in parallel to the items in the list), so the else makes sense in that context because it's the case where the loop didn't find what it was looking for
i'm explaining it to python programmers
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
I'm considering a tweet π
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")
but that's unsatisfying: there's no else in the second code
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
but that's the point: in my code, it's exactly "else"
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
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
it is easy to extend it in your imagination though, whereas yours is only mnemonically helpful if you think about else being analogous to if not, which is tenuous
... is it?
mentally mapping "else" to "if not found" doesn't seem unreasonable to me.
i'd rather map it to "else" π
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"
lmao
that's actually not bad, tbh. just need to abstract a little.. "ended loop normally"
more seriously - I think you're trying to show a good justification for why it's "else", and I think that's ultimately futile, since I don't think there is a good justification for that. It isn't a good word for what it does, and trying to contrive some code where "else" means the same thing doesn't seem to lead to any great insight, at least that I can see
I almost wish it had been ```py
for x in it:
...
not break:
...
ok, we differ on this. This was a huge help to me understanding it.
i think this is what i was trying to say as well
it kind of just "is what it is", and the choice of else versus jaiolwuvhawliufbnalwe is kind of arbitrary
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.
But we're getting into #internals-and-peps and language bikeshedding at that point π
this is a good idea. food for thought if anyone is writing custom DSLs for something
!otn a else vs jaiolwuvhawliufbnalwe
:ok_hand: Added else-vs-jaiolwuvhawliufbnalwe to the names list.
looks like an irish word kinda
π i would have just gone with jaiolwuvhawliufbnalwe as the channel name
I wanted to make it slightly more obvious what the use case was.
I do not like that example
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.
An empty iterable would not cause any breaks so why wouldnt you expect else to be hit
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.
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
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.
you've got it backwards. else runs when the loop ends normally, i.e. when we don't break early
imo for-else is a... useless feature
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.
it can in some cases save you from a flag variable that shows you found something
yeah but i would find the flag variable more readable
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.
also if you have one for...else and a nested for...else, making both flag vars gets messy
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
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
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
I'm quite aware of how it works but I'm saying as a novice programmer who is learning python for first, that is what I assumed when reading it for the first time, and that's with my start being in C albeit not very high level C. It's completely non obvious that it's supposed to be like the final else of a switch in C imo
Yeah definitely, and I usually feel like there's a better way if I do ```py
my_list = []
for ...:
# do something else here
my_list.append(something)
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
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
I didn't know how to use a debugger for quite a while
ive still never used a debugger for like actual debugging
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
A list comprehension is just a for loop arranged in another order. Sometimes people write out the traditional loop for readability as well
!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.
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.
If a for loop is needed for anything complicated enough to the point where even experienced programmers can unintentionally alter the state to the point where they donβt know theyβve created a bug, then it stands to reason then that a list comprehension is not capable of solving that to begin with
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
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.
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.
hi everybody somone can call with me now for help me of the combobox ?
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
I find that if a looping structure seems complicated, there's probably a more elegant way to do it with generators
on the other hand, sometimes loops are a great "escape hatch" where the functional-style version would be convoluted or messy
No.
Unlimited functions.
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.
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.
Computer science is mathematics. But I think hardly anyone does it. Software engineering/design is a different thing.
i think it makes more sense in programs where CS and CE (Computer Engineering) are blended together more, since CE inevitably takes a lot of EE classes.
otherwise, it does feel like the odd one out at times tbh

I just feel a need to say, at first I read this channel name as programming-propaganda
Remember, stick the to party line- the GIL means all python code is thread-safe. Anyone who says otherwise is a rustacean in disguise
i don't see how a false statement can be the party line π
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?
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.
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.
Ask fewer questions @misty dirge
how could i write paragraphs like that when answering questions
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.
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
because CS starts becoming useful for higher level positions?
yes, more senior jobs are much more likely to actually require that theoretical knowledge than more junior jobs, is what I meant by that.
No. I try to ask a few when I introduce a topic so that as many people as possible can find something to latch onto.
π
I'm pretty sure it would have gone over my message size limit, heh
do you think this might be another instance of selection bias?
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.
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.
How old are you now? What did you do between dropping out and now? What made you decide to go for a degree?
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.
got it. I'm glad things are going better for you this time around!
3.7 gpa so far and maintaining my job and family life hah. My life is hectic!
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.
oh hey this is where i am rn
learning and growing up, or underestimating? π
underestimating π₯΄
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.
"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
I guess it depends on what kind of universities you have access to
I can't imagine a mediocre Russian university providing a solid foundation in English writing skills
How about Russian writing skills?
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.
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.
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.
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
whats the difference between python command prompt and pycharm
this channel is for discussion about how to teach computer science, but you can open your own help channel from #βο½how-to-get-help
Maybe it's different in other countries, but here it's easy to get into a university, but it's very hard to get into a good university.
similar in north america
just classes in python, or OOP in general?
OOP in general
the "main point" of OOP is to have state in maintainable parts. does that much make sense to you?
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
is it like.. having infinite buckets that you can fill with stuff..
no?
Think of the "condition" of an object
this isn't really on topic anymore, if you want to learn about OOP try #software-architecture
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
again, that's not what this channel is for
it says practices of teaching though? did I get something wrong
yes, for discussion about how to teach, not for teaching
Think more like "How to Teach" than "Teach Subject x"
sad face
I've pinged you in pygen with a hopefully fine explanation :P @weak mortar
we have plenty of channels for learning; this one is set aside for discussion.
although it does raise a good question, when should classes and oop be introduced
in relation to lists, dicts, loops, etc
Java be like: when writing your first Hello World program
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".
OOP could be introduced when a beginner starts using a lot of globals to share data between functions
i think having beginners write their own container class would be better than the cat/dog/animal stuff
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."
Why no Pope
As someone who is /still/ unfamiliar with most dunders, this interests me. I enjoy the language but feel like I still am yet to nail the fundamentals lol.
I switch between myself and my two alter egos (the pope and Britney)
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.
simpy. that's a python package.
Is there a chance you still have this guide?
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
I bookmark and eventually read everything python-related that I find right now. Hyperfixating and all.
if you really want to deepen your understanding of the language, you should probably pick up a copy of Fluent Python.
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!"
{get, set, del}item sounds like a crime with a linked list π
why? it's a list and should have the same API as a list.
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
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.
why quadratic
Because the default iterator (if you don't provide__iter__) will first call__getitem__with 0, then with 1, then with 2, etc.
implementing add, iadd, {get,set,del}item, iter, reverse, and probably several others
I said iter.
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
you can't have O(1) {get,set,del}item for a linked list, no.
Fortunately for those learners, Python doesn't have any built in linked list class
isn't deque a linked list of arrays?
Yes
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.
I'm familiar with the cost/benefit of linked lists. the whole thing is only a teaching exercise.
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) π )
if you wanted them to understand why the same methods on different data structures have different asymptotics, it'd be a great learning exercise
True enough.
at least deletion is a lot faster in a linkedlist. It really helps when you need to remove all elements matching a predicate.
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)]
What are good books, articles and talks on programming (preferably language agnostic)?
@blazing ginkgo can you say more about why you want language-agnostic?
Pragmatic Programmer comes to mind, but only because I remember it being language agnostic. I'm sure if you elaborate on why, Ned can give some more recommendations
I think this is like asking "what are good books, articles, and talks on math". Programming is a large domain--what is your reason for asking?
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)
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.
Okay. Is there a server it would be in scope for?
Should be. Thanks
Removing in-place in a dynamic array is also linear time
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β?
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.
@pine quartz Thank you.
So, that is what it means by equivalent and identical.
Like say two like objects that is of one source.?
@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.
The instructor for one of my current classes is pursuing her PhD through online courses. I feel like that'd be challenging!
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?
The most common pitfall that beginners fall into, I think, is the xy problem.
- User wants to do X.
- 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.
- User doesn't know how to do Y either.
- User asks for help with Y.
- Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
- 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.
I thought it was just to prevent spamming. I'll adjust my writing style accordingly
It can also be used to encourage slower and more well-thought-out responses. That's how we use it in #career-advice. And to keep messages "wide" instead of "long" so that more messages are on the screen at a time.
5 minutes goes by incredibly quickly... Watch some conference lightning talks to see how quickly that window will be up. To make it work, you need to pick a very narrow topic, or commit to giving the barest ten thousand foot overview of your topic
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"
Well this is exactly why I'm having trouble. Five minutes is barely enough time to introduce a tool, let alone come to any useful conclusions.
I'm pondering doing a quick intro to regex but I'm not sure how to make that engaging. Its a great tool but its a bit boring
otoh its hard to get bored in 5 minutes
I just switched to this channel and I'm already bored. Someone do a little dance or something!
π
Ooh lala.
Huffman trees and text compression doesn't work for you?
The concept should be wrappable in 5 mins; important, and simple enough
π I just don't understand it, and compression has never been anything that's interested me
All possible ways to exit vim
i think regex is a good idea. you could motivate it by working some kind of example where ad-hoc parsing/pattern-matching gets increasingly convoluted, and then you solve it with regex
or just do a quick overview of basic regex syntax with some examples
I can see that filling the five minutes very easily
π I just need to find a way from keeping it from being boring
make the strings you're trying to parse exciting
"There is no spoon"
Pull a hekerman and extract a bunch of IPs from a file
That should involve quite a few regex rules
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
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!)
I never found discussion forum assignments very enriching. It might be that they're more interesting in graduate level courses, since you'll probably have more diversity in the knowledge backgrounds of the students.
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.
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.)
I bet. I remember some of the conversations I had when I took two years of Japanese. That was 10 years ago, though.
Never had good experiences with it either, people just parrot off each other usually
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.
eli5?
isn't it just "the computer processor is the only thing used when doing operations"
quick google search lead to "Explain Like I'm 5"
CPU bound operations are limited by what the computer can do, Python has no influence on their speeds.
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.
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
I think we need to banish "processor" from our vocabulary to accomplish this.
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
the process is waiting for the CPU to finish doing something
Thanks for the response so far. I'll write a first draft in a bit here.
I always go with "Most real world programs spend most of their time waiting for things like database queries or API requests. Python can wait as fast as any other language."
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.
I like that π
@zealous portal I deleted your message, since it was off topic. Please refer to channel descriptions.
can u ping me there in that channel
You can ask questions related to python in #python-discussion or in a help channel
I think we're miscommunicating. Every channel has a description, so please read it before commenting in a channel for the first time, so you know it's the right one. If you have any questions, ask in #community-meta.
I plan to mention development speed as well, probably wrt pypi and the open source ecosystem
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?
Right, I'm saying something along the lines of "there are also ways you can speed up code when needed, through the use of profilers to isolate the problem, or through tools like pypi or numba"
PIL/Pillow
aiohttp, asyncpg
ncurses π
anything that's a wrapper for a C library, and stuff based on GObject and Qt
@misty dirge how goes the tag writing? Curious to read it whenever you're done.
didn't end up getting to it quite yet.
That's fair. I have a list of "didn't end up getting to it yet" haha.
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 :/
@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.
well, this just moves the question: I don't know what libraries outside of data science wrap a C library π
tkinter, pyqt? Theres also the ones that fix listed
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.
wouldnt numpy/scipy cover most cpu bound operations
it may be that data science really is the one place that involves huge cpu bound operations 
yeah how often do you have cpu bound operations as the bottleneck outside data science
or well other sciency simulation stuff
The fact that they are network-related doesn't mean that they don't do CPU-bound work.
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
e.g. if your HTTP parsing function takes 1ms, you're limited to 1000 requests per second at most. And that's not the only function that will run on each request.
I'm lacking the motivation to do my coursework whoo... Time to look at my student debt. That usually does the trick
which courses are you taking that make you feel unmotivated? of the courses I resented, it was sometimes due to lack of perspective.
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?
i like "naming a block of code"
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
I like that. Nice and straightforward.
That's not a bad explanation.
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
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)
Does "orchestrate everything" count? :p
It can, yeah. I mean, having different levels of abstraction allows you to pack more meaning into a sentence
I'm currently in an HTML class, and a Written Communications class. Both are boring (but easy)
that might be a white lie - reusability and parameterization aren't the only reasons why you'd make a function, but they're the easiest to explain to beginners who haven't yet needed to deal with organizing large amounts of code, and who have a loose grasp on the importance of naming things well
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 π
automate the boring stuff describes it as sort of a "program within a program"
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
Sad
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.
single-responsibility principle. funny enough we went over that today in my swe class 
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...
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.
CAN SOMEONE HELP ME WITH A PYTHON PROGRAM TO TURN ON MY CAPSLOCK.
It's already on. Also, this channel is for discussion; take a look at #βο½how-to-get-help
Not sure I follow. This channel isn't supposed to be a repository of unusual questions.
ok tx
Good afternoon everyone. I am new to docker and kubernetes, Could anyone suggest me few resources for beginner level?
this channel is for discussion about how to teach computer science, but you can check out #tools-and-devops
lmao, they also asked on #career-advice
Either the definition of SRP is too vague to be of any use, or I just was never able to understand it
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.
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
Seems so, yeah, although I'm not familiar enough with cohesion to certainly say if it relates to SRP
Yes indeed! I'm constantly thinking about SOLID these days
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.
most def true. i think the SRP is good from a design perspective, so that one is coming from that approach, at least initially. but just like design IRL, things can change when implemented.
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 
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
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
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.
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)
I think the mixup comes from hearing "lower bound" and thinking it means best case, same with "upper bound" for big Omega and big O
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
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.
Open/closed principle is often outright bad advice
why so?
I guess the idea that code should be closed for modification is kinda strange.
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
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!
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"
I guess the right version is "program to an interface, not an implementation, where appropriate (apply your judgement)", which doesn't really say anything
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...
...unless you're making a program tailored to different cultures, which might have different calendars
sure.
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)
If the complexity of a function is O(x), then its growth rate past some point is <= x
If the complexity of a function is Ξ©(x), then its growth rate past some point is >= x
If the complexity of a function is Ξ(x), then its growth rate past some point is == x within some constant factor
What people in industry call big oh is what people in academia would call big theta
What people in industry call big oh is what people in academia would call big theta
wait...
wow you're right
Using the academic definitions, quick sort is O(n log n), but it's also O(n^2) and O(20^n).
i guess i never noticed bc its big omega most of the time
hm, not 20*n
O(20*n)
...you sure about that? since that's the same as O(n)
typo π
ok 20^n makes more sense
ah
I waffled between ^ and ** for exponent notation, and I wound up with * accidentally, hehe
O(20 xor n)
it's actually really annoying, "is this convo mathy enough to use ^ for exping?" comes up too often
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.
.latex thats why you use $\mathcal{O}(20^n)$ instead
exactly why β should be added to the standard keyboard layout
that wouldn't fix anything though, unless you also add that to Python
thats phase 2
I don't think so
It may not be possible for us to ever reach empirical definitions of "good code" or "clean code", which means that any one person's opinions about another person's opinions about "clean code" are necessarily highly subjective. I cannot review Robert C. Martin's 2008 book Clean Co...
https://python-patterns.guide/ however i think this is a really interesting resource. not quite the same kind of resource though.
I will one day understand math >_>
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
this channel is for discussion about how to teach computer science, but you can open your own help channel from #βο½how-to-get-help
sorry
Anybody recall the website which has samples of programs for every major programming language?
TwilioQuest
Maybe
this channel is for discussion about how to teach computer science, but you may be looking for #ot0-psvmβs-eternal-disapproval
Can I become a programming pedagog?
i don't think "pedagog" is a word
this channel is for discussion of how to teach programming
Wiktionary says it's an alternative (presumably "correct"?) spelling of pedagogue, kinda like dialog and dialogue
https://en.wiktionary.org/wiki/pedagog
- A teacher or instructor of children; one whose occupation is to teach the young.
- 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.
- (historical, Ancient Greece) A slave who led the master's children to school, and had the charge of them generally.
pedagog window
which of the definitions π€
it's a choose-your-own-adventure meme
why do people in the know-how insist on using jupyter notebooks for learning python? they're horrendous
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
@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.
agreed
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.
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
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.
those are the use cases I'd recommend them for :)
I wouldn't even recommend them for those use cases, just to stick it to the man, you know?
I'm not a beginner? that's the nicest thing anyone has ever said to me.
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
I'm also aware of my awareness. meta-awareness.
not sure what sticking it to the man has to do with it
:D
I was making the facetious remark that because jupyter is so overused, I won't even recommend it for appropriate uses, as if that would make an impression on a stakeholder in notebooks' proliferation.
that's okay. it probably depended on some cultural context that we don't share.
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.
Coming from Mathematica notebooks, I'm used to the pitfalls of nonlinear execution
I'm usually okay with IPython just for experimenting with stuff (as in, the in-terminal thingy, not Jupyter)
What's a repl?
read evaluate print loop
jupyter notebooks are basically a beefed-up IPython repl
If it's something more involved, I might also need some special dependencies... So I just make a new virtual environment somewhere in /tmp and just my normal editor. There's no autocompletion or type checking in Jupyter π
what you call "the interpreter itself" is a repl that comes with python.
beefed-up repl with alzheimers
word
The lack of autocomplete is a major annoyance. I haven't yet tried Jupyter integration with an IDE, does that help?
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
^ is trolling
you don't need jupyter for autocompletion
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
I legit can't buy word tho π
for autocompletion, you need to configure you code editor/ide
:D :P
You're misunderstanding me. The question is about how to get autocomplete in Jupyter
there's a jupyter notebook thingy in pycharm
If there is one thing I can't stand, it's editing any sort of document in a web browser
so don't ;)
Not in community edition π
There is VS Code integration. I haven't tried it yet, although my colleague uses it so maybe I'll ask him
maybe something like this:
https://github.com/kiteco/jupyterlab-kite
?
Hello
We probably need a bot command to the talk βwhy notebooks are badβ and βwhy notebooks are still badβ
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 ...
I don't think anyone is ever going to click through to a talk because they saw it in a tag. At least not the target audience. The unfortunate reality is that beginners, by the same token, aren't prepared to understand why notebooks are complicating their understanding.
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 π
check the video to see at which conference it was held
surprised they approved that talk.
The presentor was actually asked by them to do it after posting on twitter that he hates notebooks.
He explains it in the beginning
oh hey, this guy wrote the data science book I recommend to beginners
also someone just said "pedagogical" in the call I'm on. that's so serendipitous.
Blasphemous
I'm already reading a 1313-paged book on algos, and I'm still curious.
by "algos", do you mean algorithms and data structures? like graph traversal algorithms?
Introduction to Algorithms, 3rd edition (mit press)
the "classical algorithms" that CS students learn isn't the same as the algorithms used for machine learning.
Hit me up with some book/article recommendations, please?
for data science or for classical algos?
...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"?
Data Science
what I was intending to refer to are sorting algorithms and graph algorithms like BFS/DFS, Dijkstra's, and Kruskal's.
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.
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. :)
data science isn't really related to computer science or programming, nor is it related to "algorithms" in the computer science sense
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
true . i've never seen anyone use advanced programming techniques like higher order functions in data science
usually it's just import module use its method to get the computer to consolidate the data and spit out parameter values
i wouldn't consider that "computer science" either tbh
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
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.
This isn't really what this channel is for, but there's project ideas here: https://nedbatchelder.com/text/kindling.html
New programmers often need small projects to work on as they hone their skills. This is a list of project ideas that beginners can tackle.
Thank youu, also which channel should I have mentioned this in for future reference?
#python-discussion or a help channel (see #βο½how-to-get-help)
yes its mostly bc stats departments all around the country are too traditional in their approach and teach the same methods with the same datasets (i.e. iris) so computer science depts picked up the slack, at least this is what new-age statisticians who go on podcasts think

what salt rock lamp said. if however you are still interested, you can check out #data-science-and-ml and hang out there 
- joma tech
kaggle dataset GOOD π‘
data nice and CLEAN π‘
any1 here codes css & Html
If you consider JSX/TSX and css frameworks then sure
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
though not everyone like programming
It can be very simple programming. When I was a kid, they had us play around with turtle graphics in Logo.
We had some QBASIC at school, it was pretty nice drawing shapes and stuff
one of my first intros to programming was programming an arduino in my e&m physics class in high school
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
you guys did arduinos and coding in physics? lucky
@teal vine this channel is for the discussion of programming education, not programming help
I'm starting computer science at university today, any advice for me? ahah
what courses will you be taking this semester?
congratulations btw! I hope this will be an enriching experience for you.
Well, Introduction to programming, math, algebra are the main 3
I've been programmign for a while tho
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.
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.
I've quit aerospace engineering, studied it for bout 2 years. U think its gonna be differ from what I've learnt?
I know nothing about aerospace engineering. did you already take all the calculus requirements for that degree?
2/4 math and all algebras
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 I would also read godlygeek's comment (and the ones after it) in the pins for this channel.
thats pretty dope

not everyone likes math but i believe programming can give you the ability to break bigger problems down into simpler ones that are easier to tackle
Agree
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
My school teaches Scratch in 12th grade (17/18 year olds!)
Hello, this channel is for discussing how to teach programming concepts, not showcasing projects. Thanks
can someone pls help me with python im new
this channel is for discussion about how to teach computer science, but you can open your own help channel from #βο½how-to-get-help
Please refer to the description of the channel and Scofflaw's message.
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
@sweet dove disgusting in what way? What are the learning goals for the lecture?
Unreadable as in unpleasant to read or exceptionally difficult to understand?
I need some of both
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
This method from the stdlib
https://github.com/python/cpython/blob/main/Lib/configparser.py#L1002-L1122
also, have you seen #esoteric-python?
oh that looks good ty
!e
import string; print(''.join((z := ' ' + string.ascii_lowercase + '.,')[z.index(i)-2] for i in 'yj.bkubgxgt.vjkpibjgtgbuqbygktf'))
@misty dirge :white_check_mark: Your eval job has completed with return code 0.
why is everything here so weird
@sweet dove there you go
oh my thats great lol
!e ```py
import ctypes as c
c.POINTER(c.c_void_p).from_address(id(int)+96)[0] = c.POINTER(c.c_void_p).from_address(id(int)+96)[1]
a = 1
b = 1
c = 42
d = 10
print(a + b)
print(c + d)
@pure heron :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 32
@pure heron what have you done
made integer addition subtract
!warn @pure heron trying to destroy the very fabric of Python
what if your keyboard doesn't have a - key π€·
!e
result = 3 + (2).__neg__()
print(result)
@misty dirge :white_check_mark: Your eval job has completed with return code 0.
1
easy.
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)
@pure heron :white_check_mark: Your eval job has completed with return code 0.
42
how do you type _ tho?
oh baby
!e
result = eval("3 + (2).\u005f\u005fneg\u005f\u005f()")
print(result)
@stone juniper :white_check_mark: Your eval job has completed with return code 0.
1
easy
in that case you can just type -, right? π€
hey im just offering solutions
You don't know me! You don't know my life!
!otn a you don't know my life
:ok_hand: Added you-donβt-know-my-life to the names list.
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?
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!
i've come to feel like there is a literally never-ending wave of people who have no idea how to ask good questions, and there will never be an end to people asking hard/impossible-to-answer questions
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.
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.
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"
can't count the number of times i've fixed my own problem just trying to get a MWE
this, 100x
after doing that 2 or 3 times, i realized that there is huge educational value in being forced to express yourself coherently

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.
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?
i definitely learned it in school
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
Yep
I still think you can conduct that seminar ... i have seen management impose weird teambuilding exercises on their employees...
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
Then it has to be the two founders that push it...
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
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.
"years" and it's still that small? Wow. But sounds vaguely familiar π
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.
One side-effect of poor communication seems to be poor documentation, or otherwise writing code others can understand
If we can frame the right problem, and the issue half the work is done. And then take the available clues, search for resources and keep digging in until you find the answer..
Yes it is used to work in 6 person startup that never grew and existed like that for years until it was killed by the US housing bubble
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
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
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
I think you have to call __neg__ though
what exactly do we do in this channel
talk how to teach programming. see my message in the pins.
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.
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
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
Ah, do you want this work to be somewhat serious, or- can it be more in the "fun" category (like what hsp suggested, games)?
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.
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.