#pedagogy
1 messages · Page 13 of 1
Oh there is no problem doing non-coding tasks.
We view software engineering as more than just writing code. I think here it's more due to being their very first job and being too used to finding all the answers on a platter from stack overflow. So they need more help to nudge them to think through things more
Real problem-solving skills are hard to come by and kind of hard to teach, the only real idea I have is to assign progressively larger problems to tackle, but you probably already know that.
What do they do when they get stuck and the answer isn't on Stack Overflow?
they just ask the other engineers, which in turns antagonize them (or they are too nice) because the question is very simple since it comes down to just looking where is a function called.
@vernal garnet your question was off-topic for this channel. See #❓|how-to-get-help
Thank you
umm what is a subset
set inside another set. Can be a proper subset or just subset.
a subset isn't a set inside of another set, at least not the normal definition. if all the elements of a set A are in set B, then A is a subset of B. if they're not equal, then A is a proper subset of B
so guys after i finish learning basics of python
i just start learning Libraries?
yes and no, but mostly no. you should learn how to do different things (build a website or a Discord bot), and learn how to use the libraries as they relate to what you're trying to do.
True statement
find small projects, then find larger projects
and if you choose a good variety of projects, you'll be forced to learn the libraries of Python
if you do enough projects, you'll learn those libraries pretty well
what's the most used ones
it depends on what you want to do. I'm most familiar with data science, and pretty much everyone in the data science space uses numpy, pandas, and sklearn to some extent. the ecosystem for web development is completely different.
nice to know that i have to choose my path then
before digging deeper in python
You could try some game development. It's fun and a good intro to control flow and logic
pygame, tkinter for those
I would like to get involved into the data sciences field, any recommendation?
try #career-advice
Thanks
@weak mortar I had to remove your messages, as they were off-topic.
@weak mortar this channel is for the discussion of teaching programming. If you want to use different commands, please use #bot-commands.
Do you think CTF type exercises are applicable for learning different aspects in programming and software development?
what are CFT type exercises?
Capture the flag
how could capture the flag and programming be related?
it's a cybersec exercise where you have to find hidden security flaws
As hsp said , it's a very common hacking exercise and competition.
It's pretty successful with cyber students and even in high schools.
@zenith smelt @rotund belfry this channel is for discussing the methods and practices of teaching. You're welcome to participate, but please respond to a message or introduce a discussion topic.
i understand, I'll try to interact as much as I can.
I don't think they're very relevant outside of security specifically
but yes i think anything that forces you to get "hands on" and write real problem-solving code, in a less-controlled environment, is good for really learning to program
this channel is for discussion about how to teach computer science, but you can open your own help channel from #❓|how-to-get-help
well in my case the first steps is making a terrain to test the IA its mean to be some "place" where the IA can learn im using genetic algoritm to get the succes of a task (follow a ball)
Thanks!
But I am not sure to follow how that relates to the question.
(still sounds interesting though as I am also interested in genetic algorithms in general)
Not Python-specific, but I've got a programming question.
I learned Python and Golang over the past 5 months, and I've build some intermediate things like a Flappy Bird game and an AI to play it, a sorting algorithm visualizer, and some CLI tools. Lately I've wanted to take my skills to the next level and make things like emulators, libraries, and maybe even a programming language (These would be in Golang of course). But I don't know how to move on from being intermediate. I don't know what resources I need or what I need to practice and learn. What should I do?
note that this channel is about teaching programming.
but to address the question, you can start practicing library development by splitting your existing applications into "library + frontend". so your cli tools could be refactored as some library that implements whatever the tool's functionality is, with a cli "shell" around it. and you'd refactor your tests accordingly. you can also try to contribute to established open-source projects, usually they have several small bugs/features that are good for first-time contributors to work on
Sorry, didn't know what channel to put this in
Have any good open source projects for new contributers to start with?
maybe pick a project that's already related to a field that you are interested in. or maybe even a library you used in your past projects
admittedly i don't know what channel this would go in either. #python-discussion moves too fast
maybe we can justify it in that you are asking a question about "how to teach (myself) programming beyond the intermediate level?" 🙂
I'll start looking for some open-source projects to contribute to. Thank you!
I have Python in my class as a computer scientist and I am failing.
Now I will have holiday of 2 weeks and need to work on my python skills.
How did you guys got good with python?
Watching tutorials or combining it with a own project?
I think that building out a project is one of the best ways to learn, since it combines the "theory" of reading documentation / tutorials / lessons with the "practice" of writing / debugging / running the code
Should I combine it with a tutorial or should I just head to building a project and keep researching on my way about the code I want to implement?
Try both! Following a tutorial is a good guide, but then try to do the same thing from scratch, without using the tutorial (only documentation / implementation details you find on your own)
imo reading documentation is "practice" and is a skill that needs to be learned. same with deciphering error messages and debugging
Yeah thats a good point. I guess my separation was split along reading / writing code which isn't the same as learning / practicing
yeah valid
Hey guys, this program enables me to create a Customers Table and a Products Table. How can I implement a "Buy" function that makes the user select a Client then Products and sends this data to a "Total Sales" table ? I'm using Tkinter and MySQL
Code here : https://pastebin.com/bpciapwe any help would be amazing 🙂
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@weak mortar #databases would be the appropriate channel to ask in.
Or maybe #user-interfaces. You could also claim a help channel. See #❓|how-to-get-help for instructions on claiming a help channel.
Topic: How do you explain the concept of state? I developed my understanding of it gradually, and I think if I were to try to explain it to my former self, I would have misunderstood the explanation but thought that I hadn't.
well, I guess I would call state as sort of the "memory" or "condition" of something. Methods on a class have state, since they can function differently depending on different data set on its attributes
String methods (or any method free of randomization and involving only immutable types) are stateless, though
hm, thats true
if I had to come up with an example from scratch (unrelated to a problem they are already trying to solve) I would probably just use a list or typical RPG stuff (such as your character's items) for example
state never really seemed to be a difficult thing for people to pick up though? at least from what I've seem
possibly a hot take I guess:
it is fine to misunderstand it conceptually at first as long as you understand it well enough to make use of it
*and make sense of what's happening in your program
i think having an understanding that's "good enough" but actually missing something significant has the potential to cause problems in situations where that understanding isn't good enough
although i guess you can't dive right into how names and values work before teaching literally anything at all so you do need a certain amount of simplified models in order to teach things in an order that makes sense
especially since a lot of people probably wouldn't think to go back and reinspect their models of the basics of how python works
I've never had to try to explain state before. This is tougher than I expected. Here's a swing at it: your program's state is every piece of information that could change the outcome of a future operation.
alright, first imagine a tape extending forever in both directions...
I've never actually explicitly learned what "state" was, it's kinda just everywhere in languages like python, so you have to know sorta what it is
seriously though, those little robot programming games are a good way to grok state
i guess i wouldn't even try to teach state in the context of python
wdym?
to introduce the concept, i mean
beginners already have trouble seeing the semantics behind the syntax, i think just imagining a simple machine is a much more intuitive way of understanding state than looking at source code and from there it should be fairly easy to extend the idea to any procedure
even that doesn't really cover it, I think... That covers memory, but memory isn't the sum total of a program's state
that was just a joke about Turing machines, because you have to explicitly define their states
oh - I thought it was glib but semi-serious, since that's an adequate (if not ideal) way of explaining the state of an algorithm
but it doesn't scale up to a full networked program running on a multitasking desktop OS
in particular, it doesn't scale up to more than one thread
it kind of does
- the machine itself can be in various states
- when you think about it, the symbols on the tape and the current position of the machine also determine its behavior
- now extend that to everything being kept track of everywhere that might affect the program
I suppose tapes could cover memory even across processes, but a Turing machine only has one instruction pointer, and you need multiple instruction pointers when you talk about parallelism
well that's just a great opportunity to show them a bijection from the naturals to finite tuples of the naturals
unless you extend your model to include the operating system and its scheduler, and the other machine, and its operating system, and its scheduler, I guess.
You mean like 1 -> (1,)?
I think he meant that tuple[int, int] is isomorphic to int and such
wait how
wild
Lmao like this I hab code in my Python lib
ok but tuple[Real, Real] -> Real is wilder
@noble aurora and you can apply this multiple times to show that you can get a bijection to any finite length of tuples, and once more to show that you can get all of them at once
right
which is just to say that multiple states are just one state in disguise
naturally
can we make threads for different topics so I can see where the conversation came from?
the thread rollout is something we've been discussing internally. I'll bring this suggestion to the rest of the staff.
ok!
@wheat schooner @maiden tree this is a discussion channel; please conduct help in a help channel (see #❓|how-to-get-help) or a topical channel (like #databases)
would you all say teaching name mangling as a way to make attributes "private" is a good thing in order to avoid confusion?
for example, in my python class, we were learning about _ vs __ for attribute name prefixes, and the teacher said that __ was better for making attributes "private", even though most people use _ for signifying that an attribute/variable shouldn't be touched and __ is mostly used for preventing inheritance collision
I would only teach a single leading underscore for "private" attributes/methods. the effect of name mangling is only realized if you make a subclass, and even if you are, the need for name mangling is only present if you plan to have a particularly complicated class hierarchy. And at that point, you should probably just use java.
(usually I wouldn't say that someone should use java, but if someone insists on having such obfuscated behavior, I don't want them adding it to our ecosystem 😄 )
There's plenty of deep class hierarchies in Python, like what the io module has (and therefore what open returns)
lest we get into a debate about whether or not name mangling is a good language feature, I don't think it's worth going into for beginners.
Double leading underscore name mangling is only useful in one really narrow circumstance:
- You own a class, and
- There are subclasses of that class that you don't own and don't know the privates of, and
- You want to add new private attribute or a new private method to your base class without it colliding with a private name chosen by an existing subclass
Would you agree, then, that double leading underscores should not be covered in intro to programming curriculum?
(changed from only to not because I changed what came after it and didn't fix the whole message
)
I wouldn't teach it to beginners, no. Point 2 in particular means that name mangling is only useful for library code. For application code, you know all the subclasses that exist, and can check what privates they have and choose a name that doesn't already exist in any subclass.
@waxen fox are you satisfied in our treatment of your question?
I like your point about its potential usefulness in library code.
yep!
I agree, I hate seeing name mangling used anywhere. They have one user, which is to handle two classes needing to name the same attribute differently without collision.
Sadly, I've seen it used where they should've been internal.
The less people who know about name mangling, the better.
There is no name mangling in ba sing se.
Any hints on where or how to Dive in into python source wide?
I mean, i fought my way alone with SQL Spend Like hundrets of hours because i Had a Task ans Goal in my Profession. I reached the Goal
Same with SAS, Goal, Task, was existing, so i worked ans worked on it
agreed; I'm not sure why they chose two leading underscores for name mangling either, given one leading underscore was used for showing that an attribute/variable is protected, people would assume since it mangles the name and has leading underscores, it makes attributes private.
you're saying that these people think there are specific protected and private access modifiers that are language features in Python? because "protected" is a whole separate thing in Java.
more so that people will assume the mangling is for making a variable private because both the convention PEP8 defines for attributes that shouldn't be touched but can technically be touched (single leading underscores) and name mangling use leading underscores, sort of categorizing them into one
idk if I'm making sense tho 🥴
protected variables are a specific thing in Java that doesn't have an analogue in Python's psuedo-private system.
i thought they use the term "protected" in PEP8 for single leading underscores?
maybe. perhaps we should make a PEP to make the nomenclature more consistent: PEP 9002.
a PEP for the PEP
The lack of access specifiers is a serious annoyance I have with the language
update: I came across this explanation in a tutorial, and it makes a lot of sense.
A variable that you can’t vary doesn’t make much sense
Why not? The name is taken frome mathematics, where it indicates something immutable and rebindable – just the same as your ‘bindings’.
The ‘vary’ comes from the fact that a variable may refer to an expression of varying or indeterminate value, likey = f(x).
"variables are labels attached to data"
the name is entirely vestigial and borrowed from math
i suppose that learning programming was easier for me because i did know math, so i already had intuition for variables and functions that wasn't hard to adapt
this is very good too
it "varies" because you don't necessarily know what it points to
also it's worth considering the difference between an "immutable variable" ("immutable binding") and an "immutable data structure"
and yes i am big -1 on teaching double underscore attributes
heck i am -1 on teaching private/protected attributes at all. it's the kind of thing where if you teach it too early it becomes a point of confusion and unnecessary cognitive noise, but if you teach it later it's almost trivial
people who teach "getter/setter" OOP in python are really doing their students a disservice
I'm not really a fan of getters/setters either. If a user can freely get/set a member variable via trivial getter/setter methods, then that member variable is not involved in any class invariants, and may as well be public.
What do you mean by class invariant?
I mean, if it's important how the value of that member relates to anything else about the class's state.
I'm beginning to think that "classes" are a kind of inherently confusing idea anyway, and that one should really focus on interfaces. The reason you bundle a bunch of stuff together into a class is because you want to do something, and you want to abstract that process away and create something out of it that is more convenient to use and think about.
And then the question of "how to access data members" becomes a bit nonsensical, because that was never the goal in the first place. You provide inputs and receive outputs.
as much as I hate arguments from compromise, I think it really is a case of "it depends". Classes make a lot of sense in the case of discord.py, and many of the classes there have both methods and attributes.
this is the "original" intent of OO programming: all communication between objects is a "message" that is "passed"
"give me your value for x" is as much a message as "compute this thing please, with these inputs"
so in a language where that design is carried out, then of course you need getters and setters, because the notion of a public attribute doesn't even exist
in python it's completely the opposite: objects are basically glorified hash tables, and methods are just funky single-dispatch functions. so in that context, it makes total sense to have publicly-accessible attributes, and it makes no sense to have getters and setters. = is a getter and setter
I personally like getters and setters in the form of properties purely for documentation
I wish data descriptors showed type hints like methods
well you can type-hint instance and class attributes, that's what i do
i agree that support for data descriptors would be really really valuable (and it's frustrating that it's not a thing)
I feel like I bring this up with you a lot, but it doesn't show up in help() feel like I'm like one of few people to use it. Probably bc of my job
i don't remember talking about this (different username?) but i agree with you that it should be better in both of those ways
@green warren @misty dirge in general, i like to say that classes have 3 purposes. i used to say 2, but i thought of a 3rd one:
-
grouping related pieces of data together, e.g. an
AppSettingsclass that contains all the configuration data for your app, or aPoint3Dcartesian coordinate in a simulation -
encapsulating local mutable state, e.g. storing login information in a discord client, or some handle to an external resource like a file or network socket, or implementing a state machine (this one can be done without classes too, but it's a very different programming style)
-
implementing single-dispatch polymorphism in languages that don't have function overloading, allowing end-users to customize behavior directly or providing them with hooks that allow them to easily do so (e.g. by subclassing or implementing a protocol/interface)
how often do you use data descriptors and help()? mucking through unfamiliar django codebases?
I employ data descriptors myself regularly
I'm a big fan of descriptor protocol in general. Recents have been a lazy property that works with __slots__. functools.cached_property doesn't. Another is an instance state based dispatching system for methods
@pure fog here is an example of state based dispatch I shared on reddit https://gist.github.com/Delengowski/48f3aa87536caaaf037c4f1116f85dfc
cool, not something i personally need but i see why you'd want it
apparently (as i just learned in #type-hinting ), mypy does support descriptors now, even if you can't explicitly annotate them yet
so you can annotate the return value from __get__ and mypy has at least some support for using that
I know that the PEP8 reccomended formatting for python variables is to use snake format (eg. my_var). But a lot of the code I read for integration/data-science projects uses variables in camelCase. Is this actually a problem, should I just do a quick “replace all” and change the variable names, or is the effect negligible.
It has the effect of making the author look inexperienced. If someone writes code that doesn't follow extremely common Python idioms, it strongly suggests they haven't read enough Python code to actually become familiar with the language.
Yeah that’s fair enough, it’s strange because the files I usually find this error in is made by people who clearly have a very good proficiency. I would agree that conventions are essential in python for readability and integration purposes. It’s definitely something that needs to be emphasised in the learning stage
camelCase (with initial lowercase) looks so awful, I don't use it for anything in any language. snake_case for variables and methods and namespaces, UpperCamelCase for the names of classes.
Support from who?
a lot of data science code is egregious, both stylistically and comprehensibility.
But have you seen physicist code?
Oh yes. Many of them go on to become data scientists after they learn to code better
from type checkers. but apparently it has more support than i realized
this, bigtime. not following the style guide in any language is a sign that the programmer isn't interested in writing idiomatic code, it's a smell for "this is going to hurt" when reading it (and possibly a warning sign for bad/weird/unconventional API designs)
lol when I was interviewing for my job they asked me to write some pretty basic code on whiteboard. As the guy revealed me later they were afraid that my code would be completely incomprehensible and they wanted to check that I am able to solve a trivial issue with similarly trivial and clear code
very often in physics you don't care about how the code is written you only care that it runs few times. Also the very common pitfall is this: oh this will be a one-off code, I'll never use it again so why bother
(I think that's a common pitfall all around though, not just physicists specific)
this is a nontrivial issue in hiring and yes you need to check for it. you can't have people writing "scientist code"
yeah and I think what is even more difficult is to decide whether this person can learn on the job to write proper code or not..
if they've gone through learning all the fancy shmancy sciency things, a little bit of coding style and convention cant be that hard
depends on how stubborn they are, and how strong your leadership is
exactly. But the question is, whether they are willing or not. I think anyone can learn that but it might require some effort on the onboarding side to convey the why... The mindset should switch from the one you had in academic env to a more practical one, and that could get tricky
it depends a lot on whether the engineering leadership is willing to tell someone with 10 years exp and a phd "no, and i mean no"
if you aren't comfortable enforcing code style conventions then don't hire people who write bad code. otherwise you can hire them but you have to make it very clear that they are expected to improve their code quality up to some kind of basic industry standard (not that industry standard is any good anyway)
i.e. in my PhD years I probably wasted close to 1 million cpu hours and I had no reservations or regrets about that cause it's something "free of cost". And the mindset was "well, let's run this and if it crashes I'll deal with it later". Not something I'd ever do now I think 🙂
oof
for what it's worth, i don't quite understand how scientists/researchers got in that mindset. even when i was first learning to program in school (for social science), i didn't understand why people were so resistant to writing readable code
it always seemed like this kind of "punchcard cosplay", like if your code was hard to read it meant that you were the academic equivalent of a 1337 h4x0r because that's how the OGs did it
take some goddamn pride in your work. i too make plenty of compromises under time pressure and knowing that my code is "disposable", but there's a limit below which you're just making a huge mess for no extra benefit
lot of them (us, in a way 😁 ) are told stuff like "you are a researcher, not a programmer so you must focus on producing new and interesting results, your phd is in physics and not in writing code". that kind of things
sure, but like... you need the code to do the physics. it makes no sense to me
I might be exaggerating here and oversimplifying but that's the gist of it.
no i know that's actually how people think. "it does't matter" + "i can't be bothered"
i just never understood it
The flipside of this is that nobody in science publishes their code, only the results they got from running the code.
The code does not earn them anything toward their next academic job. Publications do.
So it's not just that somebody can't be bothered, but the entire incentive structure encourages you to write quick and dirty code that gets the job done, and move on.
I haven't given anyone a literal whiteboard coding test, but I do ask them questions about coding practices and structures.
quick and dirty code is buggy code. the problem is really that academia encourages quantity over correctness/quality
and you should be required to publish your code, data, etc. or at least make them available for inspection (eg. you can't really "publish" LHC data)
Large collaborations like the ones looking at LHC data probably have pretty decent code, actually. "Scientist code" is really more of a problem with one-off projects
true. my point was just that sometimes the data is really huge
Some do publish though. Like I was working and making contributions to Quantum Espresso (you can find main repo on gitlab). And it's big enough so that me saying I contributed has pretty much 0 doxing risk 😂
But many won't publish. Or will publish later when they did what they wanted as monopolist
We also usually publish calculation parameters and sometimes even straight up input files. So it's not that bad everywhere
quantum espresso is like when i make espresso at home, and one shot comes out great, and the next shot tastes like shit even though i used the exact same recipe?
Yes
I literally wrote a computer science algorithm paper and didn't publish the code. The published work has only pseudocode.
why not? 😠
I didn't think it was well written, and wanted the paper to focus on the actual algorithm
my work often involves reproducing the results of papers. though I've found that often, even when there's code for it on github, I'm no better able to comprehend it than from the specification in the paper.
Yeah, I did actually include a link to it on GitHub, it just doesn't literally appear in the journal
And it's written in Mathematica (or I guess they're calling it Wolfram Language now)
Good evening
Can someone explain to me how a recursive function works?, question in the help-burrito Help Channel
hello there nice people :) i just wakted to ask of your oppinion. what do you think. should i remove a person from github project if he is no longer working on it ?
programming a n! function in recrusive way. pretty sure you will get the concept of recrusive function when finishing the excersize :)
This channel is for conversations about how to teach programming. Try asking in #python-discussion
I found myself digging into the source code written for papers or wishing there was such code.
Sometimes, there are some ambiguities the authors haven't thought about.
Also there is no such thing as shame for the code, especially when it comes to papers
how recent is that name change? one of my coworkers likes to use mathematica
The name was changed a few years ago
that explains it
i imagine that most people still call it mathematica
Everyone still calls it Mathematica
I'm gonna call it cupcake
Cupcake Language
clang for short
What it changed its name? Lmao
Wolfram Language 
what is a good project to help teach a low intermediate student
I think the appropriate project depends on what functionality you want them to learn
I try to look for projects which are basically about what the person knows + skills I want then to acquire.
That enables them to not have to deal with too many unknown at once and to build on what they have learned so far
do you have some go-to projects?
I don't have any specific go-to project in mind.
In general, the mentee would either already be passionate about something or it would happen in the context of work where the projects are already set.
I would recommend to look at what is the person passionate about first, and then looking at a clone of a popular product by default.
Is it ok at ask questions as a student here?
The solution is not to ask to ask, but just to ask. Someone who is idling on the channel and only every now and then glances what's going on is unlikely to answer to your "asking to ask" question, but your actual problem description may pique their interest and get them to answer.
I wanted to ask...
I want to be a proper programmer. But currently I am just writing code that works.
It's like the difference between knowing how to cook vs being a proper chef
I want to be a proper chef
(I forgot to send)
sure, so what's the question? What's stopping you?
What's the path, how do I get started in being a proper programmer (and not someone who just knows how to write code)?
(I already know intermediate python)
There is no specific path. It's part of the craftmanship.
Learn about the patterns, the language, when to apply which technique or not and practice
Also confront ideas and keep an open mind as people come from different background and had to deal with different constraints
What is Patterns?
What I need to learn more:
The language (tool)
Techniques (mindset?)
There also many books about improving the craftmanship from different angles. From "clean code" to "righint software" to "design patterns" from the GoF to "the art of scalability".
And that's not even talking about the leadership related books
patterns as in "design patterns"
https://www.amazon.com/Head-First-Design-Patterns-Object-Oriented-dp-149207800X/dp/149207800X is a good intro to design patterns
Ahh thanks
https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 is the classic that I still use as a reference
So when making programs I have to think like a programmer, I have to apply techniques and practices
What questions should I ask myself to know that "I know and understand my software that I made (website, api or anything)"?
Are you able to explain it to someone else?
I can explain the general idea.
But in-depth I can't
being able to explain and teach it is a good test for whether or not you understand something
But I if I don't want to rely on other people? I don't have friends and getting decent and actually helpful feedback on discord is kinda hard
you don't need other people.
Think about it like writing a blog post (or two) about explaining it
It forces you to think about the concepts you need to go over, the ideas, the best way to go about it and how they fit together.
Personally, I have a private blog to write down my ideas
Thanks!
Is the advice "just keep writing code" really helpful I keep getting this in response to "how do I get better" 
"how do i get better" is a really vague question, "practice" is a really vague answer
Obviously if you keep writing bad code you wont get better, you should be more detailed in your questions if you want more targeted answers
Then what should I know as a backend developer who will use Django as a backend framework
presumably, django
Thats not any more detailed than "how do i get better" tbh and answering that goes beyond the scope of the channel
It's like the difference between knowing how to cook vs being a proper chef
The difference is if someone is paying you to do it as a career. There isn't necessarily underlying knowledge that fundamentally legitimizes your programming ability.
How do athletes get better? How does a mathematician get better? How do musicians get better? Practice.
Think more about deliberate practice.
For instance, if you have some problems with DP, then you want to practice more DP. Practicing randomly would help you with DP only by luck if it relates to it.
Similarly, if you want to learn more about packaging your software, then practicing packaging your projects would yield more results than doing some leetcode
And one important thing is to also setup the criteria for success. "Getting better" can means a lot of different things depending on who you ask and where they are in their journey
I personnaly get on personnal projects, I try to make stuff that university wouldnt' ask me to make and I basically discover new aspect of programming every day
@eager coral This is not the right channel for that. #python-discussion or off topic would be better places.
i think so, although i think it should be "keep writing code, and keep reading other people's code"
I regret not taking my undergraduate programming classes more seriously and am definitely paying the price now at my current internship. I have been reviewing concepts and doing practice coding tasks while working on my current project but I feel as if I am never going to be as good had I taken my courses more seriously. What can I do to make this process more bearable? EDIT: sorry if this isn't the right channel to post this, leave a reply and I'll remove from the channel thanks
its ok. Definitely study the recommended textbooks from ur programming classes and fill the gaps in your knowledge. Rewatch lectures as well. I kind of dislike when students say cs theory is not important for industry which is simply not true
@bleak drum if this is your first time writing large programs outside of your assignments, it might be that you'd have ended up feeling caught off guard regardless. Programming in real world circumstances isn't always the same as school assignments that have a narrow learning objective
How much longer does the internship go on for? And how far into the curriculum are you?
I have a question yall. What do you really need to know, to "know" a programming language?
Cause of course your not going to go super-advanced in all languages.
ping me @split ice
it's not about what you know, it's about how deeply ingrained in your brain it is
it's a matter of achieving fluency with syntax, idioms, and standard libraries
get a good pen and a notebook and take a lot of notes
i'm serious. draw flowcharts and activity diagrams. write out pseudocode. put line numbers and write your comments on those line numbers
if you're really struggling, drop into the debugger and poke around to see the current state of the application. and of course do not afraid to ask for help, that's what internships are for
You can say that you "know" a programming language if you can write code in it without having to refer to a reference for how the language itself works. If you don't know how a given expression is being evaluated, you probably don't really "know" that language beyond a cursory understanding of how programming languages work in general.
fair enough
But of course you have to still search up some syntax here and there of course
your not going to know everything, that goes for anyone
ty
syntax? probably not, unless you're switching between languages
i can't remember the last time i had to look up python syntax
What I mean by that is let’s say your trying to figure out something in python for example that doesn’t exist that you don’t know about
So of course your going to search it up
Your not going to know every little piece and syntax in python (ex)
Manifestly, of course
I’m referring to advanced syntax that is not beginner based
Something that doesn’t just come off the top of your head
i think i know every piece of syntax of python now
star unpacking in subscripts, starred try{-except}[-finally]/try-finally
and this ```py
[a, *[b, c], d] = 1, 2, 3, 4
a, b, c, d
(1, 2, 3, 4)
and this ```py
for i in 1,2,3:
print(i)
python does leave room for some unintuitive expressions though, this tripped me up a bit when I first saw it ```py
my_list = [True, False]
print(1 == 1 in my_list)
print(2 == 2 in my_list)
Hi and welcome aboard!
However your question has nothing to do with the topic of this channel. You may want to check #❓|how-to-get-help to increase the odds of getting some help
Note also that we won't help you cheat your exams or tests
it's not a test
just saying it in case. I can't read dutch
oh oke
heyy i was wondering anyone know if u rlly need a diploma from school to be a software engineer u can self teach too right
try #career-advice
if you're a young person with no professional experience, the self-taught route isn't really a viable option for most types of developer positions. there's no way for potential employers to verify that a self-taught person actually knows what they claim to know unless they have tangible experience doing it, but tangible experience is difficult to obtain without a degree.
a computer science degree will pay for itself, so if you think you're up to being a developer and can get student loans, it's a worthwhile investment.
what about online courses
if they're from an accredited institution, that's fine, though they won't carry as much weight as a degree.
true but a company would hire someone without a degree but can show hes rlly good then some dum dum who got a degree but is pretty bad
"a company might hire someone with a degree who is incompetent, therefore a degree will not necessarily increase my chances of getting hired" -- is that what you're saying?
not exactly more like if u can somehow show ur experience that ur just as good as someone with an degree maby better u will have equal chances
if you can show that you have experience, there are companies that will accept that without a degree. but it's usually only professional experience that companies will recognize. that is to say, it's very difficult to break in without a degree.
the thing is that the probability of someone with a relevant degree being incompetent is low, and the probability of someone without a degree begin incompetent is higher
economists call this "signaling" - it's very difficult to observe actual skill on the job market, so candidates must signal their skill with easier-to-observe attributes like "i have a degree in CS"
so you are working against the fact that you lack a strong signal that the market has come to expect, and you must find a way to make up for it. the signal is very strong and due to automated resume scanning it might be difficult to get past it. but i think this is #career-advice talk, no?
Those with CS degrees (and anyone else who wants to participate), how did you feel about how the curriculum was broken down into courses? Were there any courses that you feel were too narrow in scope, or which were too broad in scope? Did the order in which you were required to take the courses make sense?
I thought the theory of computation course that I took was pretty weird. a lot of what we learned (like the pumping lemma or cantor's diagonal method) I felt was just there to fill up the time so that it could stand alone as a course. and then the programming language theory course that came later didn't do very much to relate that material to the theory of computation course, even though the two are pretty interrelated.
lot of the courses i took were too board in scope. like there's just too much to cover even the upper level cs courses. only few courses like OS, DSA we dove deep. There is just not enough time so it felt like surface level knowledge even tho the courses were tough
Interesting. What was the title of a course that you felt was especially broad, and what was covered in it?
I found computer networks (iso model, protocols, network security etc) and programming langs course too broad. for programming langs stuff that was covered was (comparison bw imperative, oop, functional, and logic langs, control structs, binding, scoping) basically formal description of all types of comp languages.
but ig thats what undergrad education is for. to give a good overall foundation for cs. if u wanna learn deeply abt specific area then u can do masters or phd
Did you have to relearn courses that you already knew?
Is this the channel for learners?
no, this channel is for talking about teaching programming
I took an advanced programming class that pretty much made sure we understoof classes to a decent extent in C++ in the first half after a semseter of super basic python, basic java, and a semester of basic data structures. The other half of the advanced programming class was just projects that had to use 3 or more languages for the most part. Learned a lot in that class
but most classes are what you make of them from my experience
do i ask for ask for help in this server
You can. #❓|how-to-get-help explains our help rooms.
Can anyone recommend a solid way of learning/growing with Python? I got introduced to programming through some university courses and had a pretty fun time. Now that I'm no longer in those courses, I am looking for a way to become stronger, knowledgeable, confident in Python to the point of finding a job/career with it. I downloaded some apps (DataCamp, Codecademy Go, Mimo), I know of a few YT tutorials and websites, but the experience feels shallow. I guess I need to start working on projects to test my understanding, creativity, and problem solving? (I'm not saying I know everything at this point, far from it.)
Learn by doing. Once you've learned something, you should do something to apply what you've learned. Otherwise, the information probably won't stick.
It's also worth noting that there's a point at which you're no longer learning Python itself, but learning how to do certain things, and learning how to use tools that happen to exist in Python to accomplish those things.
i am also a beginner and i do that after every new thing i learn i make few projects combained with the other things i have learned before and it really helps
I'm just so confused as to what to do and what to believe in. Do this, do that, don't do that, this won't work, first you need this... I wish there was a more straightforward path. I feel like there's too much risk, too much investment for an iffy outcome. Is it just me?
What risk is there that you see?
Sounds like this should move to #career-advice
@tired quiver
I'm just so confused as to what to do and what to believe in. Do this, do that, don't do that, this won't work, first you need this
Dont't just do what somebody (or some tutorial) tells you to do, try to understand why you need to do that.
Do this (not only in programming, but in everyday life) and you'll know what to do on your own.
@tribal breach see #data-science-and-ml
Hello, Python community. How would you recommend an absolute beginner start to learn Python? I have familiarity with Linux and a working knowledge of how computers function, but other than that, I'm an absolute beginner. Where should I begin?
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Keep in mind that this channel is for discussing the methods and practices of teaching.
I'm creating this project https://github.com/jwlei/YOLOv5_DeerDetection/tree/master/DeerDetection
And I was just wondering if I actually write readable code, I've been trying to format it as best I could
Consider using a linter, e.g flake8
it'll point out any code that might not follow pep8, as well as other conventions and the like
Hi everyone, I’m new here and to programming and would be happy if someone could help me out from the very beginning
@ionic lagoon That's not really on topic for this channel. Perhaps claim a help channel: #❓|how-to-get-help
@candid tide Also consider claiming a help channel or asking in #python-discussion
.topic
Suggest more topics here!
randomly swings in That the name of an object/variable has anything at all to do with the contents!
relatedly, I think beginners tend to conflate objects and variables. I encountered someone recently who thought that creating a class created a "new type of variable". I've also encountered people who thought that creating additional variables for the same object creates copies.
It's probably one of the largest obstacles that I see someone have to get over in early programming. One of my teammates still struggles with the abstract concept that just because he named something a list, that it doesn't assert or promise that's what is in the variable.
I wonder if some of the challenge comes from the dichotomy of "a program only does what you tell it" and "don't blindly trust what's in that variable you created".
(clarity that this teammate in question is an app engineer, a product owner mindset, and not an experience coder)
I was about to ask, because it's disconcerting that someone with that misconception would have made it that far without having been corrected.
do they have experience with a statically typed language with compile time checking?
He is leveling up wonderfully well considering he threw himself into the deep end without checking the current. He's mind is sharp, he spots bugs in code on an end-user level long before I do. Programming concepts though seem to just trip him up hard, especially around variables and their contents.
He has far more experience in networking, network typography, and network operations. To my knowledge, he had never done more than a few simple powershell scripts before offering to work on smaller automation stories for us.
python doesn't copy unless you explicitly tell it so
Beginners tend to focus on the syntax of the program:
"What should I write?"
"Do I need to add a new variable?"
"What syntax do I need to solve this?"
when they should be thinking about the semantics, since those are the terms in which the problem is solved.
It is understandable, given that the syntax is what they see in front of them and what they do when coding. I think that making them write pseudocode helps train them to see the semantics behind what they're writing. Another is giving them incomplete solutions so they see that the right answer is not a magic key that solves the problem; it's built of steps which operate on the objects created in previous steps.
...or thinking that the difference between
["a", "b", "c"] and "".join(["a", "b", "c"]) is the brackets you see when you print them
someone who isn't me (but I don't remember who) pointed out that beginner assignments are centered on taking inputs and printing out the right thing, and that this might be why beginners tend to conceptualize everything as strings (even if they don't think of it that way) rather than as data.
hm that might've been me lol
then you certainly deserve a cookie. 🍪
that somehow isn't me when i began python
probably because i first learned lua from roblox
roblox lua tutorials aren't focused on input-output, they're more focused on syntax and memory (storage)
Is it possible to draw sketches without using the sketchpy lib class?
this channel is for discussion about how to teach computer science, but you can open your own help channel from #❓|how-to-get-help
this one isn't really too big of a deal but i suppose it could still count as a misconception -- that int, str, range, etc are all functions
Perhaps return VS print?
Everythings an object,
I would say that in a python context int, str are classes and range is something I would describe as a function.
If we were pedantic we can say that they are all functions as they are written in C and therefore cant be classes.
But yeah, the repr of int,str will tell you they are types and the repr of range should tell you it is a builtin.
Could you argue that anything that is callable is a function?
range is also a type
Avery was making that argument
but yeah, it doesn't really matter
And it makes sense
We could go to the other extrem and say that they are all classes(objects) as even a function is just a class with a __call__.
a function is not a class
depends on if you mean "function" or function, imo
a function is an instance of the function class
Wait range is a type? Hm never noticed, sorry for that confusion
there is a particular type named function and its properties are 100% objective
there is also the english word "function" which is a property of us and not of the language
FunctionType, yeah?
yep ```py
import types
types.FunctionType
<class 'function'>```
Yes, but if you have a callable object, couldn't you consider it a function
i wouldn't really describe range as a function; more so an iterator
but to a beginner the word iterator is confusing
a range object is iterable, but not an iterator ```py
next(range(5))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'range' object is not an iterator```
You'd need to call iter on it to get an iterator
oh
til then
not really, no. Functions in python do a couple more things than just be callable (e.g. they have name, a code, any number of user-defined attributes, ...)
Just wanted to say that a function is nothing really special, and can have attributes set like an instance of an custom class and all the other stuff.
The main difference seems to be that the class of any function is builtin and writting def …, just creates an instance of it.
Which makes me wonder, what happens if you set an attribute via
def something():
…
something.__class__.random_attribute = 7
imo i would say that functions are callable but not every callable object is a function, i'm probably wrong on that tho
Hm, I see
Although you can use a generic callable wherever you'd typically see a function, right?
>>> something.__class__.random_attribute = 7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'function'```
Its confusing semantics and in the end, a function is just an instance of an special class, thats what I wanted to say, everythings an object
Everything in Python is an object, including functions and types. Honestly this might be confusing to someone learning OO.
99% of the time, yes
Oh I should have guessed that, thank you though!
the most common example is a bound method, which is a different, ale quite cool, object
But going back to the base question, ala confusion, I actually thought range returns you an iterator, so what something actually returns can be confusing too
it would just be something.random_attributes iirc
yeah, range is a bit odd, since it's a special object which is not a generator, not an iterator, not a list, ...
Immutable sequence 😩
ye, it is closest to a tuple
Ok didn‘t think something basic and used everyday could still confuse me, but nice suprise
Wait is enumerate() actually behaving the same way as range?
enumerate objects are iterators
honestly, pretending that range is not a sequence and just an opaque magic iterable is probably the best you can do.
Ok, then I am not lost completely, thank you
not like you are going to put a range object into much of anything other than a for loop for quite some time.
Slice?
...?
This may exceed the channels goal, but as I am now curious any reason for the weirdness of range?
well suppose you have range(1_000_000_000)
how do you propose representing that as a non-special type in a way that makes sense?
neither of those things really matter IMO.
Was an answer to what you would put a a range object other than a for loop. But I am now not even sure if this is possible.
That revelation kind of made me question everything. 😅
Going back to the actual bot made question:
Something that just recently caused me problems again, actually because I wanted to explain it to someone and forgot the „weirdness“ is:
Class attributes and non-slotted classes
You can get the value of the class attribute from an instance by doing inst.the_class_attribute, but if you want to change it by doing
inst.the_class_attribute= 14
You will actually create a new instance attribute with the name the_class_attribute and not change the class attribute.
You actually have to set it on the class.
The confusing stuff can come from the way getting and setting seem to handle completely different.
They actually do not really as getting the class attribute first looks up the name on the instance and if it does not exist it goes to the class.
This can be used for nice things as a special way for default attributes, but can also be a huge footgun.
Do you guys offer help for assignments? I'm boutta fail at this rate ;oooo
this channel is for discussion about how to teach computer science, but you can open your own help channel from #❓|how-to-get-help
rule 8 is relevant though
if yes then i have no simple way of distinguishing functions from non-function callables
perhaps ```py
from types import FunctionType
def foo:
...
isinstance(foo, FunctionType)
disadvantages of saying anything that is callable is a function:
- beginners will say everything callable is a function
class A:
...
A()
```"it's a function"
2. arguments that don't even have a point
1. ```py
raise ValueError(7)
```"it's a function"
well according to english terms those are functions
but you still have to separate their terms in programming
This fails for methods
Hmm
What should a student do if he is in a big coding momentum but also need to do other homework.
I kinda want to solve this without losing momentum
!e ```py
class Foo:
def bar(self): ...
f = Foo()
print(type(f.bar))
@vale current :white_check_mark: Your eval job has completed with return code 0.
<class 'method'>
Yes
if method or is a function
Anyone know where i can find info on usage of this type of syntax in python? Im only asking here because i cant figure out how to search for it specifically.
message = client.messages \
.create(body="Internet Gas Gauge in AZ report delivered to email",
from_='+1520 INSERT TWILIO FROM NUMBER',
to='+1 INSERT SMS DESTINATION NUMBER')
what i mean is the \ then new line .method call. I am a student and have never seen this used before.
this syntax element is called "line continuation", you are continuing the line onto the next line
that said, this channel is about teaching python, not learning it. but maybe we can use your post as a starting point for discussion on arcane syntax elements and documentation/teaching thereof 😉
note that you can also wrap the expression in parentheses, then you don't need the \:
message = (
client.messages
.create(
body="Internet Gas Gauge in AZ report delivered to email",
from_='+1520 INSERT TWILIO FROM NUMBER',
to='+1 INSERT SMS DESTINATION NUMBER'
)
)
Oops! Sorry for that then, but thank you for your reply! I appreciate it!
this discord is an amazing bit of programming pedagogy. just the vast number of people is enough to make it great. i'm really happy to have found it and thankful that people made it.
If your message was deleted, please keep in mind that this channel is for the discussion of teaching. Please keep it on topic.
.topic
Suggest more topics here!
Ooh! That's such a good topic
At the end of it all, I think a good project is one that keeps the beginner motivated - that's all!
It should have a scope that meets the beginners expectations, and be at a level that they are kept motivated working on it.
If the project is too hard they will loose motivation, and like-wise if it doesn't challenge them.
I really like your answer!
I feel like the real question is "how do you find a project for a beginner". lots of people in the "I went through a tutorial; now what" phase
Slap them with a !projects
Lots of people dont even want to try those out either, at that point im not sure what else to suggest
Yeah but what makes !projects good projects for beginners?
Most of them are fairly simple and possibly actually useful
Examples like madlibs, blog, game of life, etc
Theres also a bunch of links to other repos suggesting projects like build your own x
If not projects like these, what would you suggest
!projects
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
I generally don't like long, barely-curated lists of stuff. especially lists of lists
the variance in difficulty of these projects is pretty high
Maybe its time for pydis to curate a list itself and add it to the site
i feel like something beginners don't tend to properly get is that errors are actually meaningful
like, it's not just a random set of rules, you get an error if you told python to do something meaningless
so they get an error and ask "how do i fix this", but the answer will always be "you asked for something that doesn't make sense and have to reconsider what you're actually asking python to do", not "oh just do this and this and the error will magically be fixed because python just sometimes decides it doesn't like you"
sometimes I think technology just doesn't like me
So you're saying that restarting my computer won't solve any code errors? 🤯
Yeah, things like "How do I fix this error" always catch my eye. Makes me want to say "The error looks perfect to me, it's told you your code is wrong"
oh that's a good response, i might use that
Literally so goddamn true, I work as a teacher on the side and sometimes my students frustrate me sooooo much bc they hinder themselves so much, its like they'll be building a complicated lil algorithm that actually unironically impresses me and makes me think they are getting the hang of this so well, and then they hit ONE error and instantly come to me w/o even reading or trying to decipher the error on their own, like half the time literally all i do is ask them to read the error and tell me what it means and then its always like "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOH wait nvm OmegaLul", like you literally know how to do this homie just put some effor into it, I aint always finna be there for your ass
what could be a good project idea but nothing 2 complicated still learning
What do you know already
well a bit of apis i just finished a dc bot
ik a bit i think
but id also like it to be a bit of a challenge so i learn
You could create/use a database and create a lil rest api to interface w it mayb create some website w it
I'm pretty sure I (and probably you) have used this...if slightly modified!
!mute 436089796318724106 "6 hours" You've used up your mod attention budget for the day.
:incoming_envelope: :ok_hand: applied mute to @pearl orbit until <t:1651376733:f> (5 hours and 59 minutes).
Sorry @winter spear didn't mean to delete your comments as well.
U r good
We get mod attention budgets? :P
Spend yours wisely 😄
that is extremely vague. you're pretty much always learning, and "complicated" is very different for different people.
yea my comunication skills are as good as my python skills so u see bad bad
but if you meant it that way, one of my go-to suggestions for beginners is creating Conway's Game of Life (whether that's in the terminal or a GUI or whatever)
There are quite a few different ways that you could implement it (which is just like anything else tbf), which I find quite nice
Sharks and Fishes is my go-to - a very similar idea.
(as in - it's a cellular automaton)
@iron cobalt @amber root @hexed sun please keep your comments relevant to the channel topic
I've had that page there for seven years, and have gotten very few suggestions for additions or improvements. 😦
Hey there. I'm currently looking for ideas to design a 3-6 hours long beginner to intermediate python task so that students can work with e.g. numpy, pandas and maybe "intersect" some data to look for corellations.
I'm currently looking for datasets that would suit my need. I thought about using large bird occurences and UFO sightings and have a dataset for the latter. However, I have a hard time being creative to find specific tasks the students can look for.
Is anyone interested in giving me advice or trying to think through some possible tasks in that context? The datasets don't have to be final, I'm currently skimming kaggle to see what I can find.
@odd mirage numpy and pandas have a lot of functionality, so you might first decide what things you want them to be able to do, and work backwards to a dataset that would facilitate those operations
@empty niche I removed your message because it was off topic. See #❓|how-to-get-help
I'm mentoring someone in programming but I feel like it's been tough going. They've been wanting to bite off some intermediate/advanced projects without knowing a lot of the basics. I recommend more basic resources to fill in the gaps but the mentee seems to not take a lot of interest. So lots of wheel spinning. What to do in this situation?
Ideally I suppose I'd find some intro to programming that is both fun/engaging and thorough with the concepts. But I have no sense of the former tbh -- I guess "kids these days" like YouTube videos but I tend to avoid them when searching for resources
When I was learning to program, the "boring" bits didn't seem boring to me (e.g. I remember thinking pointers were mysterious, but cool). So it's hard for me to get in the same frame of mind as someone who doesn't see it that way
What kind of resources and stuff have you had them do so far?
Courses and written guides? Leetcode/hackerrank and other problems? Walk-through tutorials? Online talks?
I've sent them https://automatetheboringstuff.com/ for some things
I think they're still struggling with some of the basics like variables, basic types, control flow so it's tough to move ahead to anything else
Perhaps they need some intro resource that is more project-oriented. "Here's how to build something cool (a game, say) and along the way you'll learn everything you need"
Yes-yes.. yes! I love projects. I think that they're singlehandedly the most motivating way to learn. The goal is to find something that they can reasonably complete with their current knowledge (I am including "things they're struggling on" as current knowledge) and have them go through it. Afterwards, it should hopefully be such an open-ended project that they can always improve it. Since the project is built on knowledge they knew about, they should be able to keep working on it past its original goal (or put the goal at a subset of the finished project).
Everything they learn should contribute to the project. After every new concept they should be left with a motivated feeling of "I can apply this to my project" - the same way an artist feels like they can use new techniques on their new/working paintings - so that they are more excited to learn.
What the project is about is not very important. Try to match it with other interests or something that they are curious about. Depending on age, you may want to prioritize making it something they can show off: someone a bit younger usually appreciates showing of their work to someone they care about, while someone more mature and older can take pride in having made what they did (without needing to show it to someone else). This means that for someone younger you'll especially want something pretty interactive, while for someone older it is fine to create a program that only makes sense to other programmers (Python modules, web APIs, general computations, etc.)
I think finding something interactive is beneficial for everyone, but more-so a younger learner.
A nice typical project could be a username generator or password generator. That will have some loops and different types. As you go along they learn about making the program better with classes, adding save-ability as the learn about I/O, and making it prettier if you teach them about TUIs.
Yeah I think the challenge is to make it simple to make a super-barebones version, and then add more functionality as you learn more
Like a text adventure game could start with just input() and print() and expand from there
I like that, have them start it as moving a character on grid in their console.
It'll bring them up to lists and dictionaries to store information. Later you can convert this to classes and show a good example of why they're necessary.
The game can easily scale up to become more advanced. Another idea is having them learn about text processing by adding levels loaded from text files.
That seems like a cool idea. If you or anyone knows of any existing resources that do something like this (and by "like this" I'm casting a very big net around all beginner projects), I'd be grateful. In this case it's not worth it for me to make a custom curriculum
It's more informal, like I want to be able to recommend them helpful resources but it's just for fun in my own time, not something I'm paid to do/in any official capacity
There are so many low-quality tutorial sites etc out there, so I feel like one thing I can do as a more experienced developer is help separate out the wheat from the chaff
also adding to this:
b = 7
a = b # is not the copy
a += b # is the "copy" (a + b)
if it makes you feel better, this is probably a good learning experience in and of itself
i think a lot of young people who write code fall into a category of "intelligent and eager/impatient" - they need to learn how to think with intention, and to rely less on their natural intelligence to carry them through problem solving
It is like Kahneman's System 1 and System 2 idea
maybe, yeah
rather than seeing "error" and instinctively reacting "idk", you have to force yourself to read the error
it might also be a kind of psychological avoidance mechanism - you don't want to examine your own apparent mistake
Yeah that's a common theme of debugging too
indeed, and reading docs: don't skim, read carefully
You thought it would work, and now it doesn't, so you were wrong somehow... so somehow you have to go back through all of your steps and question every assumption
i think the idea that "you have made implicit assumptions which need to be questioned" is somewhat advanced
learning to identify and quickly narrow down those assumptions is definitely a skill that comes with practice and experience (and advice/help from others)
but first you need to just read the damn text and stop to think about it for a second!
Yeah your brain is definitely the best debugging tool
Sometimes I see beginners do something like:
# assume a is defined
b = a.foo()
c = b.bar() # this line errors, maybe a type error
And once they insert a print(b) it all clicks into place
They assumed it had one value but it has a different one, so they need to look at foo() and not bar()
And then the next logical question is "okay so what code do I write next??"
it's probably important to have some kind of mental model of "expression evaluation"
you basically have to be able to follow the evaluation graph backwards from the location of the error until either you find the problem or you reach the end of your code (and then need to backtrack to another branch of the evaluation graph)
yeah I think the backwards bit is what's so challenging
Your code runs forwards but you have to piece together what went wrong backwards...
a thing that really works is asking them to "act like the computer"
We don't provide help on exams
!rule 8
8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.
ok sry
Hello, I usually work with R/Rstudio and I struggle to switch to Python. I mostly do data analysis. Does anyone knows a good transition method ?
Hi, I'm trying to create a fun quiz for my students who have 0 experience of coding, so any suggestions? :)
This is great book https://wesmckinney.com/book/
What is the quiz intended to be about?
Could be the basics of Python. Any topic
you can ask them to write a function that takes a list of ints and returns the maximum element using a loop, and ask them to spot syntax errors in some basic code.
Good idea actually, thanks
@analog glen be sure to DM @viscid mural if you are concerned about a scam
I think a lot of modern computing is filled with inscrutable (or worse, misleading) errors. it's also really unclear what the traceback is for when you first start. so most people, especially the tech savvy ones, have learned to ignore the contents of errors
I think a common thing when I'm helping someone less tech savvy (my parents) is I found out they went down some pointless rabbit hole for 2 hours because they were misled by an error message
i don't think tech savvy people ignore the contents of errors. I think it's that they've learned to identify the likely useful information in the error.
I agree. I usually call this the "salient part" of the message.
Thank you I'll give it a try 🙂
I'm not sure this truly belongs here; I'm sure it can be leveraged for pedagogical purposes, though:
(Cunningham's Law)
i like this
I reckon it can be used as simply as asking if the questioner meant something utterly ridiculous, and letting them answer their own question in the process. (I'm not sure I don't already use a mild form of this sometimes }:) )
I think there is a discussion to be had about how to write good error messages ☝️
i wanna know how to do that
Will you help? Help me write a function that will reverse the sentence. Example: Hello world people. Very good. Conclusion: people world hello. Good very.
I think this is similar to how people often think docs are bad: it comes down to guessing what people already know, and what they need to know. Those guesses are often wrong.
you could write error messages that solve the problem themselves, some people still wouldnt read them
how many people in pygen post error messages that explain exactly what the issue is and sometimes even how to solve it, asking for help
Yeah exactly
Do you all think error messages should be technical?
The problem with non-technical error messages is that they aren't specific. The problem with technical error messages is that general user doesn't always know the distinctions made by the technical language and often bewilders rather than helps. I wonder if there is a usecase for having "simplified" or "technical" versions of error messages, selectable by some setting!
Potentially the problem then is that users hitting the simplified errors will report them anyway, but no longer include the detail needed to solve the issue.
Maybe we shouldn't rely on users to report the issues.
When some error occurs, a message is displayed and a log is created.
that's pretty much how Rain World modding works except we don't have anything to display a message so if an error occurs the game will just stop working
but it generates a lot of rather technical information about what's going on into log files
i think for RW it's a pretty reasonable approach because nobody ever has any non-technical information about what went wrong that could reasonably be presented
although if random users try to read the logs they generally end up extracting worse information than if they had completely guessed
that's the general problem: information is useful if you know what you're doing, but detrimental if you don't know what you're doing and don't know that
I think more reasonable would be to give some feedback to the user :D.
Even "the game stopped working" is better than nothing.
that's not even intentional, it's just that once an error happens the game is usually in an invalid state now and will keep trying to update itself and not getting anywhere so nothing ends up happening
That seems like a bug :D.
no it's just how rain world is written
there is no error handling anywhere, other than Unity catching exceptions which doesn't actually stop the game
"no error handling anywhere" looks like a bug to me :D.
i think this is the main problem with errors
to deal with non-trivial errors you need technical information, but if you can't deal with technical information then you'll get confused
well if there are no errors then you don't need any error handling
once an error happens the game is usually in an invalid state
pretty hard to not have errors
well yes, once an error happens more errors will happen
but if you just never encounter an error in the first place, then the game runs fine
"dress for the slide, not the ride" as they say
This is why users get confused - domain-specific terminology! I was trying to work out why you'd dress differently to go down a slide than to get to the park to go on the slide ;P (I assume it's from dirtbiking or some such?)
Yes, it's a saying among motorcycle riders :D.
And that's why we should have different messajes depending on the audience: normal users get something generic so they know it's something they can do better (or not), and we log the tech details so the devs can fix the issue.
hi i had a question is there any way to compile pyhton code to an executable like c++ ?
i found an alternative called nutika (i was wondering if such applications are actually useful in real life applications)
this channel is for discussion about how to teach computer science, but you can open your own help channel from #❓|how-to-get-help
Anyone know the specific legals behind showing a Udemy course to a small class of students? I'm just wondering if my teacher can do so without getting into trouble since I couldn't find anything mentioning this online...
is there a reason you care if your teacher doing this is legal or not?
Not really
I'm just wondering
He hasn't actually done it; but could he do it?
As a student, when you enroll in a course or other content, whether it’s free or paid content, you are getting a license from Udemy to view the content via the Udemy platform and Services, and Udemy is the licensor of record. Content is licensed, and not sold, to you. This license does not give you any right to resell the content in any manner (including by sharing account information with a purchaser or illegally downloading the content and sharing it on torrent sites).
showing the content in another course could be construed as reselling the content, I guess.
In legal, more complete terms, Udemy grants you (as a student) a limited, non-exclusive, non-transferable license to access and view the content for which you have paid all required fees, solely for your personal, non-commercial, educational purposes through the Services, in accordance with these Terms and any conditions or restrictions associated with the particular content or feature of our Services. All other uses are expressly prohibited. You may not reproduce, redistribute, transmit, assign, sell, broadcast, rent, share, lend, modify, adapt, edit, create derivative works of, sublicense, or otherwise transfer or use any content unless we give you explicit permission to do so in a written agreement signed by a Udemy authorized representative. This also applies to content you can access via any of our APIs.
that probably prohibits it as well.
I am now Stelercus, Esq.
"Esquire" is a title that lawyers sometimes put after their names.
:D
Alright, thank you!
Can I ask why?
Just generally wondering
because I read a terms of service and gave my uninformed opinion.
Like, literally no specifics
no, I was asking happyalt, why the want to know
I already asked that further up
Well, what do you expect?
I meant to say nvm right after that, but I was timedout :)
@somber rain if you're trying to start a udemy resale pyramid scheme, you have to pay the two of us off now to keep us quiet.
Lmao no no
:D
HappyAlt, I expect you can get in trouble if you sell existing lessons for money
if you do it for free, I'd think there wouldn't be a problem
I'm not planning on selling any lessons
I was just thinking of gifting my teacher a udemy course so he can (possibly, if legal (which I now know is not)) show it to the rest of the class too
that sounds great
he doesn't need to show the video to pass it on
he can learn from the course and pass it on
Yup
it's a shame though... the animations in the course very very helpful in explaining what was going on
dude/dudette you actually worrying about gifting a professor a course and them getting in trouble if they share it?
respect
but don't worry, it's not the end :)
ty, but pretty sure I'm just covering my own butt too :)
unless you are from usa and you or the professor copies everything. you should be fine :)
- Not from the USA
- Professor will definitely copy everything
Lmao this is high-school, not even Uni or something
The only reason I want to gift them a python course in the first place is because the guy makes us do everything in VB.NET
I feel you
And I don't wanna make a Textbox to get input and a label to display output just to do:
a = 7
print(a)
I don't agree with you here necessarily :)
How so?
why don't you want to do this this way?
Because we've made the exact same 2 or 3 programs for the past three years
I've literally just taken my past year's submissions and submitted them to him again, just to get full marks
(but shhh on that)
I don't think you've been honest about yout situatio/position :)
Well, to be frank, and with all due respect, I asked him a year ago why didn't just make a function out of something (can't remember what), and he said he "didn't wanna lose people". So, he spent the next 2 minutes copy-pasting the same lines of code and changing up a character here and there to make it work
And I was wondering: if he's afraid to lose people because functions might look scary or something VB (or whatever else), why doesn't he do them in a language most people consider to be more syntactically pleasing... like Python
:)
☆ Subscribe Severina YouTube channel ► https://goo.gl/QNLWsB ↩︎
☆iTunes ► https://itunes.apple.com/nz/album/halo/1451079817
➤ Instagram: https://instagram.com/severina
➤ Facebook: https://facebook.com/severina/
➤ Twitter: https://twitter.com/severina________
➤ Site: http://www.severina.com
➤ Shop: soon
➣Download:
iTu...
sorry, I can't help you with your situation
I also don't think you've been completely honest
anyway goodluck :)
That's alright... Although, I'm confused by what you mean that I haven't been completely honest... Do you think I'm going to re-sell the course or something?
nah, you were saying you like your professor and your wanna buy him something
it's clear you don't think much off him
maybe you guys should move to an off topic channel
Good idea
yep
@weak mortar #ot1-perplexing-regexing
@whole nebula hey this is the wrong channel, feel free to ask in #python-discussion or #❓|how-to-get-help
Is it safe to say that it will generally take time for a person to practically solve Hackerrank/Leetcode problems even if they have a CS degree? Because you generally don't learn to approach these sort of problems in college. I am getting back to programming after about 3 and a half years.
Is there a specific learning method which focuses more on problem solving than SE done in the industry?
if you've taken an algos/data structs course, you'll probably be able to better understand the question in formal terms. but I'm not really sure how one gets better at answering them in general.
I took both Data Stuctures and Algorithm Analysis/Design
That too from Pakistan's only good theoretical comp scientist, well he is the only and taught a lot of CS students
But I am not going to say I am good at Algos, I feel rusty
I can't figure out a learning path to be precise
My current learning path is
- CS61a from Berkeley to refresh Python quickly
- Python training at work for 2 months, I requested to move to technical side from management after 2 years
there's always the fully general approaches: do the thing a lot, look at things made by people who are better at doing it than you
also break down what exactly the thing is into smaller things that you can look at individually
This is my focus and objective right now. You can say I have some PTSD from working at a startup, and it left me scared and paralysed to even attempt breaking down a programming problem
But yeah makes sense
I just kind of need validation as to if I am on the right learning path
...i meant that as an approach for getting better at things rather than advice on problem solving but now that i think about it it does actually work on both of them
Yeah it does, Feynman made it popular and now Elon has made it mainstream. The First Principles method
You keep breaking down a problem to the most fundamental facts which you know hold true
And then you build up your solution from the very bottom
Excellent way of learning
...fundamental facts? huh
what i was going for was either of:
- generally breaking down a task into smaller tasks, that aren't necessarily fundamental but that are easier to address than the entire task
- taking a programming problem and breaking it down into primitive operations
i guess breaking things down into parts really is a very generally useful concept
Hmm yeah, I have been doing that, but I feel that I have to ask someone if I am right rather than watching the code run successfully. To know that my solution is elegant and simple.
It's just that I had a very bad experience when I got my first job and started working in React. There was no leadership or mentors. React also didn't make it easy.
The learning was without any goal or objective in mind. I didn't people to talk to either. I really am enjoying my time here because people actually care about each other.
simplicity/elegance is a bit difficult to check
i guess one thing you could try looking at is, how similar is the code to the initial idea you had of what you want to do
if you have a problem that's just "do this, that, and then this other thing" and you can translate that directly into code, then that's probably a pretty good way of doing it
although i guess in that case it's less of a "problem" and more just a specification
if you have something where it's properly difficult to work out what you're even meant to do ("here's a graph with a million nodes, check if there's an eulerian cycle") then it is pretty difficult to tell whether there's a better way than what you've come up with
Or how different it is as you go along and learn new, more efficient ways of solving
Yeah my heart wants to solve these kinds of problems as a fantasy but my mind wants me to focus on the fundamentals
This all makes sense
I am glad I asked my question here, I was a bit nervous
oh i just remembered another approach that sometimes works
if you want to write a program to solve a problem, think about how you would do it manually on paper
it's not a perfect analogy because computers are way way bigger but ultimately the idea of imperative computation is the same whether it's a human following a series of steps or a computer following a series of steps
Yeah makes sense, okay I will always keep paper right next to me
Thanks @orchid thistle
you don't need actual paper, just the idea of paper
although i guess you could solve an actual instance of the problem by hand if that helps with working out how you would do it
I prefer paper, I like to feel and create not just do it in my head
fair enough
This will be my next goal after I learn to break down the basic problems because you can't just go and code a seriously hard problem without having an idea how to approach
if you ever wanna search a python object in the API docs, add "docs" after your search if it isn't there already
without "docs"
with "docs"
Pydocs SEO might be the biggest pain point when teaching someone python
Constantly tell them to look things up, do your own research, try things to see what they do, etc
But when they do try to google things, first result is that shit w3schools site
My usual trick is to add site:python.org. docs is definitely a shorter solution :)
Guys can anyone help me understand Microservices so it sticks in my head. I need to memorise it tomorrow to explain in a job interview. Anyone have a good way of putting it ? And how it differed from macros/monolithic systems?
It's even worse in countries where english is not that widespread
Imagine having about 3 russian sites about w3schools-tier of bad pop up BEFORE w3schools BEFORE the actual docs
Why does w3schools suck?
It has incomplete, out of date, sometimes just wrong info
Can you give me an example?
stolen from a staff thread for bashing w3
!e max(5, 10, 15)
point is that it's not an example of what the sentence right above says
is the SEO better for docs for other languages?
Very quick (1 search lmao) google says yes
bc i agree, it's quite annoying that i have to go out of my way to find what i would normally expect to be result #1
Lmao
Imagine being a beginner trying to find things by yourself
Maybe a site which filters and searches the docs for you would be cool
No wonder they dont read docs
There is a readthedocs site that tried to replicate the Python docs, and be "a better source of documentation"...but I can't tell if it was abandoned, or is just poor ;)
hey guys, im learning django and in a tutorial the guy said templates arent used anymore, but on the other tutorial, half of it is spent on templates
what do you think?
I think you're looking for #web-development :D
sorry mate, my bad
Guys can anyone help me with an interview question?
Why is assuring system security a more challenging problem than assuring system safety?
you might ask in #cybersecurity. evidently, they expect you to know a technical distinction between security and safety.
not for C/C++ or Java
is there a ddg "bang" for python docs?
what's that
yes, !python
that's great, i will definitely use it!
i'd love similar for other programming languages, especially those without good built-in search functionality in the docs like lua, ruby
(ruby does have a search function on the docs site, but sometimes i wonder if site:ruby.org is more useful)
is there maybe an equivalent easy way for non ddg users
i guess just appending "docs" like the user above suggested
on the page I linked above, there's a whole search area where you can search any bangs fyi
aha, very useful
...cant believe i never thought of this
I'm surprised I didn't know bangs existed before 😳 1 more reason ddg is better than google
I wonder what could be done to improve the SEO of the Python docs.
if donations will make a difference i'll donate
I suspect the PSF would sooner put donations towards having full time cpython devs or keeping the pypi up
probably 
Also at least one of the steering council members is a Google employee 🤔
is it actually a matter of $ though? or just knowing how to game SEO? (or are those 2 things the same)
and if off topic we can move
I think it's the latter but I'm not sure. Perhaps it's simple things. web.dev is complaining that there is no <meta name="description"> on docs.python.org/3/, which should be a fairly trivial fix.
Safari instead
Psf is counting donations in pat times
Part*
Ok
I dunno, I don't use Safari
Open an issue about it perhaps
Or well, mailing list stuff
we need to open a therapeutic industry for programmers facing illogical errors.
!rule 5
@brittle sand's
we don't do that here
refers to the server, not the #python-discussion channel
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
it's also off-topic to pedagogy, which is about teaching
@stiff halo please move off topic messages to off topic: #ot0-psvm’s-eternal-disapproval
Hey guys, not sure if this is the best place to ask this, but I couldn't see a better fit.
I've been working as a system / security engineer for the last 4 years, and I have constantly started beginner python courses. I have always went through the introduction to the language and some frameworks, but nothing big.
As my next step, I want to really UP my python skills and I was looking for courses that are not beginner oriented. I cannot stand going through another introduction to the language and I'd love to be able to apply what I know (not much tho, I am still learning)
So, if anybody has any courses that are fit for my needs, do share.
Thank you!
@alpine hare this channel is for teaching Python, not learning.
If you think you are beyond basics then it's time to start a project.
Oh, excuse me, I really thought teaching and learning are connected 🙂
They are, but you are at the other end :D.
Feel free to DM me if you need help with starting up, no strings attached.
As sailowcat has said, your question is off-topic for this channel.
We have a curated list of resources at https://www.pythondiscord.com/resources/ .
With that said, if you feel like you're past the beginner stage, I suggest that you start a project. It will help re-enforce what you've learned as well as provide you with a fun and interesting challenge.
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.
whats a main routine, is it suppose to call your functions?
Im working on a flowchart and need help 
This is not the topic of this channel, see #❓|how-to-get-help
ok 👍
When we use calculators like mathway, symbolab, or wolfram alpha, I have always wondered how these programs are able to show things like: Steps taken ?
How do programs do this? I just think its so cool and I wanna try to do something similar for like an independent project.
a recent episode of TalkPython is partially about this: https://talkpython.fm/episodes/show/364/symbolic-math-with-python-using-sympy
Awesome! Thanks--ill check it out
Thanks
Guys who can help me or check with me a code in C cuz im working on a school project i need to deliver by tuesday max 400 lines . Thanks
This is a Python Server, try https://discord.gg/programming
Thank you so much mate
alternatively, a c-specific server recommended by this one is https://discord.gg/gWXQJdm57f
What's wrong in the final min, max example? 
it says it takes an iterable
min and max take either an iterable or 2 or more items to sort. The prose above the example explains the first way of using min and max, but the example shows the second way.
Hi. Are you guys able to answer questions on Kademlia?
This channel is for discussion the methods and practices of teaching. If kademlia is related to that, just ask; don't ask to ask.
@woeful garden kindly remove your comment and re post it in a channel that more closely relates to it. Probably #algos-and-data-structs
Here if we write just 2 not str(2) then why it's showing errors, why can't we just push numbers
you can, it's just erroring when you try to print it out because you can't concatenate an int to a string. btw, this is the wrong channel, see #❓|how-to-get-help
@empty dragon your comment did not appear to be on-topic, so I have removed it. Please refer to the channel description.
Hey guys, how are you? I've been learning some programming languages for over half an year, mostly python, but I kinda feel like I don't know the context and processes behind at all; I feel like I'm programming only for "knowing the most languages I can". Do you recommend me any course about computing in general, like a CS course (idk) or something related?
if you're "knowing the most languages I can", it sounds like you've been going for breadth over depth. the basics of any language are going to be easy to pick up, especially if you've learned other languages. but that doesn't mean you've mastered any of them, or more importantly, know how to accomplish anything marketable in them.
you might reframe what your goal is. If you're past the point that trying to learn "python" is getting you anywhere, you should probably try to learn a specific domain of programming, like web development or backend development.
Since I would like to know more about development in general (how a whole app/web site is built) what do you think I should learn?
this channel is actually for talking about programming education itself, so you might head over to #web-development
If you guyse watch tutorials on YouTube, what do you like about them and dislike about them?
I'm also interested in learning about approaches in teaching to code for absolute beginners.
E.g. there are those robot games where you basically can control a robot but without all the overhead of a language. So you can focus on the basic "mindset" of coding before using a language. Is that a good idea?
I don't like videos because understanding code is really about going back and forth as needed while reading it carefully; it's virtually impossible to do that watching someone's video.
I do like those robot games for teaching procedural thinking to absolute beginners because
- the language they have to learn is tiny
- they get immediate visual feedback on what their code does
- they're manipulating data that is effortlessly intuitive
Videos are okay for getting a general sense for something, but with programming, you can't just passively absorb the knowledge, no matter how closely you pay attention to the video. Much like with math or a foreign natural language.
Yeah but the benefit is to have the code and an explanation. E.g. I don't see much value in a book. I once, years ago, tried an interactive thing which I guess is nice? Cant really decide.
Sure in the end it's just practicing it as always.
there's nothing preventing a book having code and an explanation
Ive probably read more than watched, so sure
Not sure I follow. Books can have code and explanations, and often do. There are entire publishing houses that just produce programming books.
for development in general, it'd be good to learn how to use git (https://git-scm.com/book/en/v2) or another SCM (but probably git 🙂 ), data structures and algorithms, testing (unit, integration, system testing), debugging techniques... probably a few other things I'm not thinking of
but that's a good start
Does anybody know a good "robot game"?
Do you think it's better to use something like Karel i.e. a robot game focused on the very basics and extra simple syntax vs. e.g. the same kind of game using something like python?
not sure what Karel refers to, do you have a link?
depending on who you're teaching, gamification may not always work
i would definitely not appreciate someone trying to teach me, a 25 yo grown man, via silly games, especially for something as inconsequential as syntax
would definitely put me off
https://github.com/fredoverflow/karel It's about teaching coding basics for people who never coded before.
right, but i think this is targeted towards people that are more like 10 or younger
There's a game called Human Resource Machine that has you programming progressively more complex programs in a limited assembly language
I, as a 35 year old grown man, enjoyed it 🙂
have you tried Exobots?
Exabots? something like that
it's great
parallel assembly to network little robots to do tasks, with leaderboards
would not recommend for beginners though, because I'm not cruel
Human Resource Machines starts out pretty beginner approachable, but the difficulty rapidly climbs. One of the later levels requires you to implement a sorting algorithm, I remember...
what? No, why do you think that? Even the children langauge scetch or what is called is used in the first week of standford. Karel is also used by several universities. I guess one doesn't spend half a year with it though but simply to get started.
you literally called it "the children language"
What? I called sketch a children language becuase it is focused on childrend, I didn't call Karel one.
i'm not familiar with copyrights rules and restrictions (there is no such rule in my country). i want to know for example if i want to create an open source translation of (https://plato.stanford.edu/contents.html) what should i do ? just write a sentence that the copyright is reserved for the main site ?
I don't find the license. I think you don't need a licence to do derivative work, but if you want to be sure write them and ask.
@tepid edge I think you are not going to have a problem if you are not making money out of it.
legally speaking, you need permission from the copyright holder of that page if you want to distribute your own translation of it
Is it impossible to learn good code by yourself?
Because I can't learn from my mistakes if no one points it out
I started learning python from yst n I’m a lil confused about variables and data bases and what brackets I should use in python
By looking at how others solved a problem you can see different ways of solving an issue, but also just asking people here if there are ways to do something better
@weak mortar this is a discussion channel. See #❓|how-to-get-help, and remember to ask your actual question, rather than asking to ask.
You can, and you'll do
all learning is self-learning, in my opinion. and a lot of mistakes will cause your program to fail, in which case Python will tell you why it failed, at least at a high level. and you can ask for code reviews here.
i feel like some people want to learn programming without doing any hard work. like they want to learn how to program and stuff, without having to do a bunch of trial and error. or perhaps they just dont realize that they cant be spoonfed all the info and know how to program. but regardless, how do you teach these people how to program?
How do I get help with Java?
i'd ask on a java server
first, don't spoonfeed them
I like to ask them questions that they have to learn to ask themselves, like "What does the error message say?", "What is on the line that it's pointing to?", "What did you change?", etc.
If it's a question that can be answered with documentation, I'll answer it and then link the relevant place in the documentation.
I also try to make them figure out exactly what question they're asking, because understanding the problem is always the first step in fixing something.
Basically: still help them but in a way that teaches them how they can help themselves
hm thanks, that makes sense. but what if they have about no programming knowledge. how do you start people off in programming?
I'm less familiar with that since most of the people I help are on this server and so probably have at least a little experience by the time they find their way here. I think structured tutorials are good. I like DSLs like those little robot games that teach people about procedural thinking. See up here for more of my thoughts on that ^
i see. thanks for the help!
We explain the fundamental concepts, with examples, that's not spoon feeding.
We still ask questions when the subject relates with knowledge they may already have or for feedback. This helps with keeping them involved.
I guess first you need to see if they want to learn, because some don't, and in that case I don't think there's something we can do.
Hello! I have a doubt. These last weeks I have been doing Python exercises in HackerRank and I have learned a lot. I checked for similar pages and I got a lot of results. I don´t want to check page by page, so I want to ask if you guys know a good page that is similar to HackerRank?
tell them that there is no alternative to working hard, and that shortcuts now will only slow them down later. if they ignore your advice, then there's nothing you can do for them and you shouldn't waste your time helping them. they'll eventually have to learn the hard way... can't save everyone from themselves all the time. some people have to figure it out on their own.
that's true for a lot of things in life, not just "school"-related things
other times, you might need to present things differently. ask them "why don't you want to work hard? how do you expect to learn otherwise?" -- that kind of thing. sometimes people just need to hear it stated a specific way before it sinks in
@pure fog I think "working hard" can have a negative connotation that doesn't necessarily apply here. Learning to program does require a lot of work, but it doesn't have to be "hard" as in "agonizing".
that's true. "requires concentrated mental effort and deliberate practice" is maybe a better expression of the idea
I will now require you to say that whole thing every time, and I'll act confused if you say "hard work".
but what about learning x the hard way
if two procedures for learning something have the same educational outcome, but one is more difficult than the other, the less difficult one is better.
i wonder if thats why the server doesnt recommend "Learn Python the hard way"
no, the problem is that the information in that book is poorly presented, and the author is condescending. and has an irrational hatred of python 3.
though with beginners, I can appreciate that it's difficult to make anything that feels worthwhile, and it's important that there's some kind of satisfaction loop.
what i described is the hard way -- the intended purpose of those books (even if they fail to achieve it) is that they require you to spend time with the code and apply your critical thinking skills from the start, rather than just delivering information to you
When learning js is it a good idea to get a good grasp of document object model
Absolutely, but that is not on topic for the channel, you can ask for more details in one of the offtopics #ot2-never-nester’s-nightmare
@cerulean bough @pure fog thanks for the help, will keep it in mind
does anyone know a good website that can give me project suggestions to work on?
!kindling
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
@spark flame @green belfry your messages are off-topic for this channel. if you want to discuss boolean logic, that would be relevant in #algos-and-data-structs
it's for the discussion of teaching itself
so mostly how to teach OOP and type theory
how do people keep their heads on top of object-oriented frameworks? Seems there's constantly more things I don't know or am missing to do what I want
Using django for my dissertation project
as opposed to functional frameworks? what other languages do you have experience with?
Front end mostly, and PHP
ah yes. internet perl. try going to #software-architecture and give an example of something you're finding confusing in django as it relates to OOP.
Hi, I learned the basics of python (and a little bit of objects programmation as well). I did a coursera class plus some courses at my uni. Now I don’t know how to continue, I want to improve my coding skills and also learn machine learning and ai but I have no idea on how to proceed, I’m a little bit overwhelmed. Do you have any advice for my situation ? 🙂
Try doing projects @dark lintel
Ok thanks ! Do you mean projects on my own or with other people ?
Do projects on your own with gradual difficulty/complexity increase
0
Studies and averages would suggest that the average attention span is productive at learning through applied study for about 15-25 minutes in one continuous go. This, of course, varies for each individual.
So how many hours should you code as a beginner? You should set aside an uninterrupted block of time, apply yourself to learning a concept in code, and stop the moment you feel like you aren't making more progress (or not picking up what you are reading/writing/listening to). Take a 10 minute break. Start again.
The total time you spend doing this is up to you.
That's one theory, anyway.
since python allows one as programmer to get away with a lot of stuff that could be considered dubious in any other language, like no type declaration and many other things... what would be the best programming language to learn to get rid of some of those bad habits that could have manifested themselves while using python?
to state my question more precisely: which language best forces you to get healthier programming habits?
Static typing isn't inherintly better, it's just harder to shoot yourself in the for
I mean that's kind of what I mean, I'm really lazy regarding any defensive programming habits or stuff like that, I thought it could be a decent idea to learn sth else that is a little more strict.
not having type declarations is not a bad habit as long as you take the proper precautions. you can use a static type checker if you want, most will have a decent type inference engine. what are the others you're thinking of?
not requiring type annotations is actually rather good for teaching, imo, because types can be a fairly complicated concept
yeah no for learning how to program it is nice, but if longer code is written or someone else needs to read the code, type declarations can help
which language best forces you to get healthier programming habits?
this question cannot be answered until you actually define what you mean by "healthy." decide which habits you think are healthy, and choose a language to teach that has those.
ehhhhhh. most editors can have some way of presenting the inferred types to you, so it's fairly easy to read.
and fyi, this channel is about teaching programming, so just programming in general is out of scope
yeah, but like, if I'm not forced to I usually just forget about it until it messes me up. another bad habit I have is sometimes space allocation or just not using the most optimal way to deal with arrays because it is sometimes shorter to write or just works, which can sometimes reduce efficiency since array concatenation etc. or copying without getting some pass by reference error can be time consuming
oh sorry, yeah what would be the better channel for sth like that then?
perhaps off topic, if you're also discussing non-python languages
but these channels have all... weird names?
!off-topic-names (these ones)
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
oh🐔
i disagree. it's very easy for someone learning python to not know what type some variable is, which is a Bad Thing. with a language like java, this problem doesn't exist, since you need to think about what type some variable should be
a common one is something like
N = input()
if N > 3:
...
this still errors, but it's hard to figure out why the error happened, even if you understand what the error is saying
hmm, that's true.
Heya, so when I write in a file with my program it replaces the last text, how can I make it so that it just goes to a new line?
This is the code: py else: print("Aircraft added successfully! Now returning!") f = open('airspace.txt', 'w') f.write(f'Callsign> {callsign}\nFlight level> {fl}\nLanding runway> {landing_runway}\nNotes> {notes}')
yeah i got an idea that's off-topic for this channel
oh crap didn't realise I was in this channel 🤣
Thanks for letting me know 
to be fair, a lot of newer statically-typed languages have good type inference, and sometimes explicitly writing too many type annotations is even considered a code smell
so i think it depends in part on what bad habit you have in mind
i think any statically typed language will help a student break the habit of writing "ridiculously polymorphic" functions
otherwise i can't think of many bad habits that are specific to python and can be unlearned with other languages
Do you have an example of a ridiculously polymorphic function?
My observation is that people who haven't wrapped their mind around types tend to have a hard time breaking things down into functions in the first place.
For what reason should it be a problem ?
Oh I see your example, ok.
Do you think that people should start with java for example for this reason ?
no
Hey guys, does anyone has ressources to start developing network scanner ? Not ressources on "Code ur python network scanner in 30mn" more something like "how do you use network protocol and the os along python to create a network scanner" ?
Oh ok
I think there's actually a similar problem in teaching math, because the types there are also implicit.
What I mean is, students get confused when they don't understand that there are different types of mathematical object (number, function, set, random variable, etc.).
interesting. the problem can't be that bad though, right? even if they're not using the correct notation, they still know what they want to do with it. you're not going to get a type error on paper. maybe i'm misunderstanding though?
Yeah I mean its more just that they fail to really understand what's going on.
That's an interesting point of view
E.g. the expression x y can mean different things depending on the types of x and y. If they're numbers, it's multiplication. If they're matrices, it's matrix multiplication. If x is a function, then it can denote function application. So we stick to conventions that make it clearer, like always giving functions names like f and g, using uppercase letters for matrices, and always wrapping the arguments in parentheses in the case of function application x(y).
I can't think of any good examples of the kind of errors students make 🤔
But I know it did cause confusion for me personally.
use a+ instead of w
Yeah, thanks it worked
hi..iam new here idk what we do in this server
I know my classmates keep mistaking expressions for equations
Hello! I've been writing Python code for a couple years now, and would actually like to find someone to review my coding practices. Does anyone know where I could find someone to do that? (paid) (Please tag me when replying)
we can't advise you on finding someone you can pay to review your code, but you can request code reviews in our help channels. see #❓|how-to-get-help
@hidden oyster yes
yes what?
He should request reviews in your help channels
I'm not looking to share any code publicly to get reviewed. This is proprietary code from my business. So ideally I find someone who can sign an NDA and invoice my business
we can't help you find that on this server. sorry.
Thats a bummer. Thank you though!
@icy marlin this is not a help channel; see #❓|how-to-get-help
no rush, but I'm still interested in your thoughts on this
I guess you can have somewhat polymorphic functions in statically typed languages too? But they aren't "ridiculous"
even in Python, the most "ridiculously polymorphic" function is still going to fail if it doesn't depend on some meaningful shared property (ie duck typing)
I don't think I've ever had a problem with writing functions which might be considered "too" polymorphic, they've typically always served the purpose of working on some a somewhat specific type of input
Examples aside, what does "ridiculously polymorphic" mean
Maybe a function which tries to adapt to every type under the sun?
so print then, first thing that comes to mind
print can actually just be typed with Any/object
I'm thinking more about functions that return different types depending on some property of input
Like this, for example
def funcy_stuff(items: list[int]):
if len(items) == 1:
return items[0] * 5
return [i * 5 for i in items]
That would be typeable, but neither statically verifiable nor obvious to the average programmer
If I pass lists of items and receive lists back, I'd be surprised when my program crashes just because the list had a length of 1 and it decided to return the item itself, without a container wrapping it
ah I see
yeah unions are kind of a nightmare. I suppose that's why most statically typed languages (that I know of) don't have them
I suppose you could do some weird stuff with type(), but that sounds like pain in a statically analyzed program
Unions as a concept are pretty good, especially tagged unions (rust enums <3), but can lead to all sorts of issues when [you assume the type, and the union itself has very loose semantics]
IMO, the problem here is specifically the function using very specific and unclear conditions to juggle around return types, input types, behavior, etc
Because really it's just two different functions packed into one because (from personal experience) someone didn't want to unpack the result when they were sure there's only one item, so they specialcased it
Two overloads (funcy_stuff(list[int]) -> list[int] && funcy_stuff(int) -> int) would be fine because you know what you're getting yourself into, but the way this example function is currently written, it's just asking for trouble
That would be the most obvious example of ridiculously polymorphic functions that python... I wouldn't say encourages, but fails to prevent
To be clear, I'm specifically referring to unions as anonymous sum types. Named ones are a different matter altogether.
Ah, fair enough
imo sum types are reasonable but "unions" as in "if an A ∪ B happens to be an A you can use it as an A" isn't really statically typed at all 
Yeah, exactly
either you say that the value does in fact have a runtime type that isn't in its static type, or you allow reinterpretations between any two types which is just weird (unsafeCoerce)
Although you can type this function as -> int | list[int] and mypy wouldn't complain, you're still changing the return type on a whim, deciding on an input's property (length of the list) rather than type
Essentially just asking for trouble and tough to debug issues
changing the return type based on the argument is fine as long as how you do that is in the signature
(i.e. if the language has proper dependent typing)
True
if not then yeah just don't do that
what do you guys do when you're trying to help someone stubborn with python
what's your go-to technique? do you reset and start from the top?
Stubborn how?
insisting on doing things a certain way, basically overcomplicating simple things they already know how to do
Can you give an example?
im asking in general really but #help-pancakes is the most recent concrete example
it worked when i reset things and took it from the top to break down the problem and explain how to solve it
but I think I felt even more frustrated than the person having the problem until I reset