#pedagogy

1 messages · Page 13 of 1

green warren
#

And these people will tend to dive into code without really analyzing the problem first. It could be a personal thing, like they feel they need to prove something, or it could be from poor management at their previous job.

subtle owl
#

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

green warren
#

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?

subtle owl
misty dirge
slender gale
#

umm what is a subset

alpine bear
noble aurora
#

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

weak mortar
#

so guys after i finish learning basics of python
i just start learning Libraries?

misty dirge
valid trail
#

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

weak mortar
#

what's the most used ones

misty dirge
# weak mortar 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.

weak mortar
valid trail
#

pygame, tkinter for those

oak turtle
oak turtle
misty dirge
#

@weak mortar I had to remove your messages, as they were off-topic.

fallow terrace
#

@weak mortar this channel is for the discussion of teaching programming. If you want to use different commands, please use #bot-commands.

muted scarab
#

Do you think CTF type exercises are applicable for learning different aspects in programming and software development?

muted scarab
misty dirge
#

how could capture the flag and programming be related?

oak breach
#

it's a cybersec exercise where you have to find hidden security flaws

muted scarab
misty dirge
#

@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.

zenith smelt
#

i understand, I'll try to interact as much as I can.

pure fog
#

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

stone juniper
#

this channel is for discussion about how to teach computer science, but you can open your own help channel from #❓|how-to-get-help

bitter sinew
#

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)

subtle owl
weak mortar
#

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?

pure fog
# weak mortar Not Python-specific, but I've got a programming question. I learned Python and ...

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

weak mortar
pure fog
#

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?" 🙂

weak mortar
#

I'll start looking for some open-source projects to contribute to. Thank you!

indigo pendant
#

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?

upper flint
#

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

indigo pendant
upper flint
#

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)

pure fog
upper flint
#

Yeah thats a good point. I guess my separation was split along reading / writing code which isn't the same as learning / practicing

pure fog
#

yeah valid

weak mortar
#

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

wooden grove
#

@weak mortar #databases would be the appropriate channel to ask in.

misty dirge
#

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.

vale current
#

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

misty dirge
#

String methods (or any method free of randomization and involving only immutable types) are stateless, though

vale current
#

hm, thats true

tidal orchid
#

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

orchid thistle
#

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

orchid thistle
pure heron
#

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.

stone juniper
#

alright, first imagine a tape extending forever in both directions...

noble aurora
#

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

stone juniper
#

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

noble aurora
#

wdym?

stone juniper
#

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

pure heron
stone juniper
#

that was just a joke about Turing machines, because you have to explicitly define their states

pure heron
#

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

stone juniper
#

it kind of does

  1. the machine itself can be in various states
  2. when you think about it, the symbols on the tape and the current position of the machine also determine its behavior
  3. now extend that to everything being kept track of everywhere that might affect the program
pure heron
#

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

stone juniper
#

well that's just a great opportunity to show them a bijection from the naturals to finite tuples of the naturals

pure heron
silent goblet
noble aurora
#

wait how

silent goblet
noble aurora
#

wild

cosmic aspen
#

Lmao like this I hab code in my Python lib

oak breach
#

ok but tuple[Real, Real] -> Real is wilder

stone juniper
noble aurora
#

right

stone juniper
#

which is just to say that multiple states are just one state in disguise

noble aurora
#

naturally

tough hollow
misty dirge
tough hollow
#

ok!

misty dirge
#

@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)

waxen fox
#

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

misty dirge
#

(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 😄 )

pure heron
#

There's plenty of deep class hierarchies in Python, like what the io module has (and therefore what open returns)

misty dirge
#

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.

pure heron
#

Double leading underscore name mangling is only useful in one really narrow circumstance:

  1. You own a class, and
  2. There are subclasses of that class that you don't own and don't know the privates of, and
  3. 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
misty dirge
#

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 sadcat2)

pure heron
#

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.

misty dirge
#

@waxen fox are you satisfied in our treatment of your question?

#

I like your point about its potential usefulness in library code.

ripe folio
#

The less people who know about name mangling, the better.

misty dirge
#

There is no name mangling in ba sing se.

weak mortar
#

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

waxen fox
misty dirge
waxen fox
#

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 🥴

misty dirge
#

protected variables are a specific thing in Java that doesn't have an analogue in Python's psuedo-private system.

waxen fox
#

i thought they use the term "protected" in PEP8 for single leading underscores?

misty dirge
#

maybe. perhaps we should make a PEP to make the nomenclature more consistent: PEP 9002.

waxen fox
#

a PEP for the PEP

green warren
#

The lack of access specifiers is a serious annoyance I have with the language

fallow terrace
#

update: I came across this explanation in a tutorial, and it makes a lot of sense.

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, like  y = f(x).

pure fog
#

"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

pure fog
#

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

green warren
#

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.

misty dirge
#

What do you mean by class invariant?

green warren
#

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.

misty dirge
#

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.

pure fog
#

"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

winter spear
#

I personally like getters and setters in the form of properties purely for documentation

#

I wish data descriptors showed type hints like methods

pure fog
#

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)

winter spear
#

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

pure fog
#

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:

  1. grouping related pieces of data together, e.g. an AppSettings class that contains all the configuration data for your app, or a Point3D cartesian coordinate in a simulation

  2. 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)

  3. 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)

pure fog
winter spear
#

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
#

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

dreamy sparrow
#

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.

pure heron
dreamy sparrow
#

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

green warren
#

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.

misty dirge
native hearth
#

But have you seen physicist code?

green warren
pure fog
pure fog
rotund vortex
# native hearth But have you seen physicist code?

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)

pure fog
rotund vortex
#

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..

native hearth
#

if they've gone through learning all the fancy shmancy sciency things, a little bit of coding style and convention cant be that hard

pure fog
#

depends on how stubborn they are, and how strong your leadership is

rotund vortex
#

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

pure fog
#

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)

rotund vortex
#

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 🙂

pure fog
#

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

rotund vortex
#

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

pure fog
#

sure, but like... you need the code to do the physics. it makes no sense to me

rotund vortex
#

I might be exaggerating here and oversimplifying but that's the gist of it.

pure fog
#

no i know that's actually how people think. "it does't matter" + "i can't be bothered"

#

i just never understood it

green warren
#

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.

pure fog
#

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)

green warren
#

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

pure fog
#

true. my point was just that sometimes the data is really huge

rotund vortex
#

We also usually publish calculation parameters and sometimes even straight up input files. So it's not that bad everywhere

pure fog
#

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?

rotund vortex
#

Yes

green warren
#

I literally wrote a computer science algorithm paper and didn't publish the code. The published work has only pseudocode.

green warren
#

I didn't think it was well written, and wanted the paper to focus on the actual algorithm

misty dirge
#

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.

green warren
#

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)

acoustic prawn
#

Good evening

#

Can someone explain to me how a recursive function works?, question in the help-burrito Help Channel

jagged heron
#

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 ?

jagged heron
pure heron
subtle owl
misty dirge
green warren
#

The name was changed a few years ago

misty dirge
#

that explains it

pure fog
#

i imagine that most people still call it mathematica

green warren
#

Everyone still calls it Mathematica

misty dirge
#

I'm gonna call it cupcake

green warren
#

Cupcake Language

stone juniper
#

clang for short

cosmic aspen
neat canopy
#

what is a good project to help teach a low intermediate student

wispy comet
#

I think the appropriate project depends on what functionality you want them to learn

subtle owl
sage jasper
subtle owl
#

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.

shell mesa
#

Is it ok at ask questions as a student here?

subtle owl
# shell mesa 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. 
shell mesa
#

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)

subtle owl
shell mesa
#

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)

subtle owl
#

Also confront ideas and keep an open mind as people come from different background and had to deal with different constraints

shell mesa
subtle owl
#

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

subtle owl
shell mesa
#

Ahh thanks

subtle owl
shell mesa
#

So when making programs I have to think like a programmer, I have to apply techniques and practices

shell mesa
#

What questions should I ask myself to know that "I know and understand my software that I made (website, api or anything)"?

subtle owl
shell mesa
#

I can explain the general idea.

But in-depth I can't

subtle owl
shell mesa
subtle owl
#

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

shell mesa
#

Thanks!

languid yacht
#

Is the advice "just keep writing code" really helpful I keep getting this in response to "how do I get better" pithink

native hearth
#

"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

languid yacht
#

Then what should I know as a backend developer who will use Django as a backend framework

noble aurora
#

presumably, django

native hearth
#

Thats not any more detailed than "how do i get better" tbh and answering that goes beyond the scope of the channel

misty dirge
vale belfry
subtle owl
#

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

vagrant crater
misty dirge
#

@weak mortar your comment was off-topic for this channel. See #networks

fallow terrace
#

@eager coral This is not the right channel for that. #python-discussion or off topic would be better places.

pure fog
bleak drum
#

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

weak mortar
misty dirge
#

@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?

split ice
#

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

pure fog
#

it's a matter of achieving fluency with syntax, idioms, and standard libraries

pure fog
#

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

misty dirge
split ice
#

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

pure fog
#

i can't remember the last time i had to look up python syntax

split ice
#

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

desert patio
#

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)

cerulean nebula
#

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)

wise basalt
#

can someone help me with a school exercise from python

#

it's in dutch tho

subtle owl
subtle owl
wise basalt
#

it's not a test

subtle owl
wise basalt
#

oh oke

weak mortar
#

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

misty dirge
misty dirge
# weak mortar heyy i was wondering anyone know if u rlly need a diploma from school to be a so...

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.

weak mortar
#

what about online courses

misty dirge
weak mortar
#

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

misty dirge
weak mortar
#

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

misty dirge
#

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.

pure fog
#

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?

misty dirge
#

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.

weak mortar
misty dirge
weak mortar
#

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

summer helm
zinc wedge
#

Is this the channel for learners?

fallow terrace
arctic wren
#

but most classes are what you make of them from my experience

jagged wolf
#

do i ask for ask for help in this server

lunar wave
tired quiver
#

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.)

misty dirge
#

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.

main bane
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... 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?

lunar wave
#

What risk is there that you see?

misty dirge
cerulean bough
#

@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.

misty dirge
weak mortar
#

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?

worldly dewBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

misty dirge
#

Keep in mind that this channel is for discussing the methods and practices of teaching.

ionic lagoon
vale current
#

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

candid tide
#

Hi everyone, I’m new here and to programming and would be happy if someone could help me out from the very beginning

wooden grove
#

@ionic lagoon That's not really on topic for this channel. Perhaps claim a help channel: #❓|how-to-get-help

#

.topic

fleet apexBOT
#
**What are the most common difficulties/misconceptions students encounter while learning to program?**

Suggest more topics here!

lunar wave
# fleet apex

randomly swings in That the name of an object/variable has anything at all to do with the contents!

misty dirge
lunar wave
#

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)

misty dirge
#

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?

lunar wave
#

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.

lunar wave
desert patio
# fleet apex

python doesn't copy unless you explicitly tell it so

stone juniper
#

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

misty dirge
#

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.

stone juniper
#

hm that might've been me lol

misty dirge
#

then you certainly deserve a cookie. 🍪

desert patio
#

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)

normal comet
#

Is it possible to draw sketches without using the sketchpy lib class?

stone juniper
waxen fox
# fleet apex

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

vale current
#

Perhaps return VS print?

white bough
vale current
#

Could you argue that anything that is callable is a function?

neon pasture
#

range is also a type

vale current
#

Avery was making that argument

neon pasture
#

but yeah, it doesn't really matter

vale current
#

And it makes sense

white bough
#

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__.

neon pasture
#

a function is not a class

orchid thistle
neon pasture
#

a function is an instance of the function class

white bough
#

Wait range is a type? Hm never noticed, sorry for that confusion

orchid thistle
#

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

vale current
#

FunctionType, yeah?

orchid thistle
#

yep ```py

import types
types.FunctionType
<class 'function'>```

vale current
waxen fox
#

but to a beginner the word iterator is confusing

vale current
#

Isn't range not an iterator

#

It's iterable

orchid thistle
#

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```

vale current
#

You'd need to call iter on it to get an iterator

neon pasture
white bough
#

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
waxen fox
vale current
#

Although you can use a generic callable wherever you'd typically see a function, right?

orchid thistle
white bough
#

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

green warren
#

Everything in Python is an object, including functions and types. Honestly this might be confusing to someone learning OO.

white bough
neon pasture
#

the most common example is a bound method, which is a different, ale quite cool, object

white bough
#

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

waxen fox
neon pasture
#

yeah, range is a bit odd, since it's a special object which is not a generator, not an iterator, not a list, ...

vale current
#

Immutable sequence 😩

neon pasture
#

ye, it is closest to a tuple

white bough
#

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?

orchid thistle
#

enumerate objects are iterators

neon pasture
#

honestly, pretending that range is not a sequence and just an opaque magic iterable is probably the best you can do.

white bough
neon pasture
#

not like you are going to put a range object into much of anything other than a for loop for quite some time.

white bough
#

Slice?

orchid thistle
white bough
#

This may exceed the channels goal, but as I am now curious any reason for the weirdness of range?

orchid thistle
#

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?

vale current
#

You can use a range more than once, right?

#

And they're immutable

neon pasture
#

neither of those things really matter IMO.

white bough
# orchid thistle ...?

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.

violet prawn
#

Do you guys offer help for assignments? I'm boutta fail at this rate ;oooo

stone juniper
desert patio
vale current
desert patio
#

disadvantages of saying anything that is callable is a function:

  1. 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

vale current
#

Hmm

languid yacht
#

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

vale current
#

!e ```py
class Foo:
def bar(self): ...
f = Foo()
print(type(f.bar))

worldly dewBOT
#

@vale current :white_check_mark: Your eval job has completed with return code 0.

<class 'method'>
vale current
#

Ah welp

#

Well, there's types.MethodType, isn't there

ripe folio
#

Yes

languid yacht
junior whale
#

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.

pure fog
#

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'
    )
)
junior whale
hazy delta
#

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.

misty dirge
#

If your message was deleted, please keep in mind that this channel is for the discussion of teaching. Please keep it on topic.

#

.topic

fleet apexBOT
#
**What makes a project a good learning experience for beginners?**

Suggest more topics here!

ripe folio
#

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.

wispy comet
#

I really like your answer!

mossy belfry
#

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

native hearth
#

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

ripe folio
#

Yeah but what makes !projects good projects for beginners?

native hearth
#

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

mossy belfry
#

!projects

worldly dewBOT
#

Kindling Projects

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

mossy belfry
#

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

native hearth
#

Maybe its time for pydis to curate a list itself and add it to the site

orchid thistle
#

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"

silent goblet
vernal sentinel
gentle oriole
orchid thistle
#

oh that's a good response, i might use that

heavy trench
# orchid thistle i feel like something beginners don't tend to properly get is that errors are ac...

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

iron cobalt
#

what could be a good project idea but nothing 2 complicated still learning

heavy trench
iron cobalt
#

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

heavy trench
#

You could create/use a database and create a lil rest api to interface w it mayb create some website w it

runic sigil
wooden grove
#

!mute 436089796318724106 "6 hours" You've used up your mod attention budget for the day.

worldly dewBOT
#

:incoming_envelope: :ok_hand: applied mute to @pearl orbit until <t:1651376733:f> (5 hours and 59 minutes).

wooden grove
#

Sorry @winter spear didn't mean to delete your comments as well.

winter spear
#

U r good

runic sigil
#

We get mod attention budgets? :P

wooden grove
runic sigil
#

Can I get advanced notice when it's running low?

#

:)

fallow terrace
iron cobalt
fallow terrace
#

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

runic sigil
#

Sharks and Fishes is my go-to - a very similar idea.

#

(as in - it's a cellular automaton)

misty dirge
#

@iron cobalt @amber root @hexed sun please keep your comments relevant to the channel topic

jolly night
odd mirage
#

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.

misty dirge
#

@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

misty dirge
clear hazel
#

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

ripe folio
#

Courses and written guides? Leetcode/hackerrank and other problems? Walk-through tutorials? Online talks?

clear hazel
#

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"

ripe folio
# clear hazel Perhaps they need some intro resource that is more project-oriented. "Here's how...

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.

clear hazel
#

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

ripe folio
#

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.

clear hazel
#

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

desert patio
pure fog
#

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

clear hazel
#

It is like Kahneman's System 1 and System 2 idea

pure fog
#

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

clear hazel
#

Yeah that's a common theme of debugging too

pure fog
#

indeed, and reading docs: don't skim, read carefully

clear hazel
#

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

pure fog
#

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!

clear hazel
#

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??"

pure fog
#

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)

clear hazel
#

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...

noble aurora
#

a thing that really works is asking them to "act like the computer"

spiral warren
#

can anyone help me with my exam

#

i have a ex pylab code that i have to eksplane

upper flint
#

!rule 8

worldly dewBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

spiral warren
#

ok sry

steady raft
#

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 ?

weak mortar
#

Hi, I'm trying to create a fun quiz for my students who have 0 experience of coding, so any suggestions? :)

misty dirge
weak mortar
misty dirge
misty dirge
#

@analog glen be sure to DM @viscid mural if you are concerned about a scam

mossy belfry
#

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

jolly night
#

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.

misty dirge
#

I agree. I usually call this the "salient part" of the message.

steady raft
runic sigil
#

I'm not sure this truly belongs here; I'm sure it can be leveraged for pedagogical purposes, though:

#

(Cunningham's Law)

runic sigil
#

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 }:) )

ripe folio
weak mortar
#

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.

jolly night
native hearth
#

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

ripe folio
#

Do you all think error messages should be technical?

runic sigil
#

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!

pine quartz
#

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.

cerulean bough
#

Maybe we shouldn't rely on users to report the issues.
When some error occurs, a message is displayed and a log is created.

orchid thistle
#

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

cerulean bough
#

I think more reasonable would be to give some feedback to the user :D.

#

Even "the game stopped working" is better than nothing.

orchid thistle
#

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

cerulean bough
#

That seems like a bug :D.

orchid thistle
#

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

cerulean bough
#

"no error handling anywhere" looks like a bug to me :D.

orchid thistle
orchid thistle
cerulean bough
#

once an error happens the game is usually in an invalid state
pretty hard to not have errors

orchid thistle
#

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

cerulean bough
#

"dress for the slide, not the ride" as they say

runic sigil
cerulean bough
#

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.

covert prawn
#

hi i had a question is there any way to compile pyhton code to an executable like c++ ?

formal flower
#

Yeah! U can use pyinstaller

#

or some like that, But I don't find it useful

covert prawn
#

i found an alternative called nutika (i was wondering if such applications are actually useful in real life applications)

stone juniper
somber rain
#

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...

misty dirge
somber rain
#

I'm just wondering

#

He hasn't actually done it; but could he do it?

misty dirge
#

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.

weak mortar
#

I am now Stelercus, Esq. what does this mean?

#

@somber rain why?

misty dirge
#

"Esquire" is a title that lawyers sometimes put after their names.

weak mortar
#

:D

somber rain
weak mortar
#

Can I ask why?

somber rain
#

Just generally wondering

misty dirge
somber rain
#

Like, literally no specifics

weak mortar
misty dirge
weak mortar
#

your sign was fine ;p

#

I know

weak mortar
#

but ok

somber rain
weak mortar
#

I meant to say nvm right after that, but I was timedout :)

misty dirge
#

@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.

weak mortar
#

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

somber rain
#

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

weak mortar
#

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

somber rain
#

it's a shame though... the animations in the course very very helpful in explaining what was going on

weak mortar
#

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 :)

somber rain
#

ty, but pretty sure I'm just covering my own butt too :)

weak mortar
#

unless you are from usa and you or the professor copies everything. you should be fine :)

somber rain
#

Lmao this is high-school, not even Uni or something

weak mortar
#

I'd say you can gift your professor

#

what they do with that - is on them

somber rain
#

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

weak mortar
#

I feel you

somber rain
#

And I don't wanna make a Textbox to get input and a label to display output just to do:

a = 7
print(a)
weak mortar
#

I don't agree with you here necessarily :)

somber rain
weak mortar
#

why don't you want to do this this way?

somber rain
#

Because we've made the exact same 2 or 3 programs for the past three years

weak mortar
#

ah, ok :)

#

yeah

#

scratch my assumptions

somber rain
#

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)

weak mortar
#

I don't think you've been honest about yout situatio/position :)

somber rain
#

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

weak mortar
#

:)

#

sorry, I can't help you with your situation

#

I also don't think you've been completely honest

#

anyway goodluck :)

somber rain
#

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?

weak mortar
#

nah, you were saying you like your professor and your wanna buy him something

#

it's clear you don't think much off him

noble aurora
#

maybe you guys should move to an off topic channel

somber rain
weak mortar
#

yep

somber rain
sage jasper
sturdy ice
#

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?

misty dirge
sturdy ice
#

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
orchid thistle
#

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

sturdy ice
#

But yeah makes sense

#

I just kind of need validation as to if I am on the right learning path

orchid thistle
#

...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

sturdy ice
#

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

orchid thistle
#

...fundamental facts? huh
what i was going for was either of:

  1. generally breaking down a task into smaller tasks, that aren't necessarily fundamental but that are easier to address than the entire task
  2. 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

sturdy ice
#

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.

orchid thistle
#

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

sturdy ice
sturdy ice
#

This all makes sense

#

I am glad I asked my question here, I was a bit nervous

orchid thistle
#

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

sturdy ice
#

Thanks @orchid thistle

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

sturdy ice
orchid thistle
#

fair enough

sturdy ice
desert patio
#

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"

native hearth
#

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

runic sigil
#

My usual trick is to add site:python.org. docs is definitely a shorter solution :)

wide folio
#

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?

fleet pulsar
#

Imagine having about 3 russian sites about w3schools-tier of bad pop up BEFORE w3schools BEFORE the actual docs

native hearth
#

It has incomplete, out of date, sometimes just wrong info

weak mortar
#

Can you give me an example?

stone juniper
#

stolen from a staff thread for bashing w3

misty dirge
#

!e max(5, 10, 15)

stone juniper
#

point is that it's not an example of what the sentence right above says

misty dirge
#

true

#

anyway, the bad learning website can't hurt you here

sage jasper
native hearth
#

Very quick (1 search lmao) google says yes

sage jasper
#

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

native hearth
#

Even python docs arent that great to navigate tbh

#

Whats up with shit like this

vale current
#

Lmao

native hearth
#

Imagine being a beginner trying to find things by yourself

vale current
#

Maybe a site which filters and searches the docs for you would be cool

native hearth
#

No wonder they dont read docs

runic sigil
#

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 ;)

glass hamlet
#

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?

runic sigil
glass hamlet
#

sorry mate, my bad

wide folio
#

Guys can anyone help me with an interview question?

#

Why is assuring system security a more challenging problem than assuring system safety?

misty dirge
pure fog
#

is there a ddg "bang" for python docs?

sage jasper
#

what's that

fallow terrace
fallow terrace
pure fog
#

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)

sage jasper
#

is there maybe an equivalent easy way for non ddg users

#

i guess just appending "docs" like the user above suggested

fallow terrace
stone juniper
fallow terrace
#

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.

sage jasper
#

if donations will make a difference i'll donate

misty dirge
sage jasper
#

probably PensiveFluent

misty dirge
#

Also at least one of the steering council members is a Google employee 🤔

sage jasper
#

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

fallow terrace
#

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.

analog sorrel
analog sorrel
#

Part*

fallow terrace
vale current
#

Or well, mailing list stuff

weak mortar
#

we need to open a therapeutic industry for programmers facing illogical errors.

rain plume
#

!rule 5
@brittle sand's

we don't do that here
refers to the server, not the #python-discussion channel

worldly dewBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

rain plume
sage jasper
alpine hare
#

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!

cerulean bough
#

@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.

alpine hare
cerulean bough
#

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.

robust bane
# alpine hare Hey guys, not sure if this is the best place to ask this, but I couldn't see a b...

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.

fluid pebble
#

whats a main routine, is it suppose to call your functions?

#

Im working on a flowchart and need help aniblobsweat

ripe folio
fluid pebble
#

ok 👍

tiny swallow
#

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.

tiny swallow
#

Awesome! Thanks--ill check it out

median folio
#

Thanks

weak mortar
#

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

weak mortar
#

Thank you so much mate

rain plume
long heath
oak breach
#

it says it takes an iterable

pure heron
#

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.

woeful garden
#

Hi. Are you guys able to answer questions on Kademlia?

misty dirge
#

@woeful garden kindly remove your comment and re post it in a channel that more closely relates to it. Probably #algos-and-data-structs

valid marlin
#

Here if we write just 2 not str(2) then why it's showing errors, why can't we just push numbers

noble aurora
misty dirge
#

@empty dragon your comment did not appear to be on-topic, so I have removed it. Please refer to the channel description.

split cliff
#

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?

misty dirge
# split cliff Hey guys, how are you? I've been learning some programming languages for over ha...

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.

split cliff
misty dirge
sacred violet
#

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?

stone juniper
#

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
misty dirge
sacred violet
#

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.

noble aurora
#

there's nothing preventing a book having code and an explanation

sacred violet
misty dirge
uneven tinsel
#

but that's a good start

sacred violet
#

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?

native hearth
#

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

sacred violet
noble aurora
pure heron
#

I, as a 35 year old grown man, enjoyed it 🙂

stone juniper
#

Exabots? something like that

pure heron
#

I haven't, no

#

It's good?

stone juniper
#

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

pure heron
#

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...

sacred violet
noble aurora
#

you literally called it "the children language"

sacred violet
stone juniper
#

i was close

tepid edge
#

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 ?

cerulean bough
#

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.

shell ravine
#

@tepid edge I think you are not going to have a problem if you are not making money out of it.

pure heron
languid yacht
#

Is it impossible to learn good code by yourself?

Because I can't learn from my mistakes if no one points it out

weak mortar
#

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

silent walrus
misty dirge
#

@weak mortar this is a discussion channel. See #❓|how-to-get-help, and remember to ask your actual question, rather than asking to ask.

misty dirge
hardy beacon
#

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?

tardy plaza
#

How do I get help with Java?

stone juniper
stone juniper
# hardy beacon i feel like some people want to learn programming without doing any hard work. l...

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

hardy beacon
kind flint
#

Hello

#

I am new to python

stone juniper
cerulean bough
#

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.

elder mauve
#

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?

pure fog
#

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

misty dirge
#

@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".

pure fog
misty dirge
native hearth
#

but what about learning x the hard way

misty dirge
native hearth
#

i wonder if thats why the server doesnt recommend "Learn Python the hard way"

misty dirge
#

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.

pure fog
# native hearth but what about learning x the _hard_ way

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

weak mortar
#

When learning js is it a good idea to get a good grasp of document object model

native hearth
hardy beacon
#

@cerulean bough @pure fog thanks for the help, will keep it in mind

dull basin
#

does anyone know a good website that can give me project suggestions to work on?

worldly dewBOT
#

Kindling Projects

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

spark flame
#

Anyone know what's this?

#

logics

misty dirge
#

@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

green belfry
#

Oh alright

#

I thought this channel is for kind of thing

misty dirge
#

so mostly how to teach OOP and type theory

cosmic hill
#

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

misty dirge
misty dirge
dark lintel
#

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 ? 🙂

somber venture
#

Try doing projects @dark lintel

dark lintel
#

Ok thanks ! Do you mean projects on my own or with other people ?

thorny mica
weak mortar
#

How many hours should you code as a beginner

#

What is the minimum

noble aurora
#

0

lunar wave
#

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.

buoyant zealot
#

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?

winter spear
buoyant zealot
fallow terrace
#

not requiring type annotations is actually rather good for teaching, imo, because types can be a fairly complicated concept

buoyant zealot
fallow terrace
#

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.

fallow terrace
#

and fyi, this channel is about teaching programming, so just programming in general is out of scope

buoyant zealot
# fallow terrace not having type declarations is not a bad habit as long as you take the proper p...

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

buoyant zealot
fallow terrace
#

perhaps off topic, if you're also discussing non-python languages

buoyant zealot
#

but these channels have all... weird names?

fallow terrace
#

!off-topic-names (these ones)

worldly dewBOT
buoyant zealot
#

oh🐔

noble aurora
#

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

fallow terrace
#

hmm, that's true.

viscid wing
#

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}')

viscid wing
#

anybody

#

got any idea?

desert patio
viscid wing
pure fog
#

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

misty dirge
dull cave
#

Oh I see your example, ok.

dull cave
noble aurora
#

no

bleak parcel
#

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" ?

dull cave
wooden grove
#

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.).

noble aurora
#

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?

wooden grove
#

Yeah I mean its more just that they fail to really understand what's going on.

dull cave
wooden grove
#

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.

viscid wing
gritty lintel
#

hi..iam new here idk what we do in this server

ripe folio
hidden oyster
#

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)

misty dirge
edgy trail
#

@hidden oyster yes

misty dirge
edgy trail
#

He should request reviews in your help channels

hidden oyster
#

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

misty dirge
hidden oyster
#

Thats a bummer. Thank you though!

misty dirge
misty dirge
vale current
#

I guess you can have somewhat polymorphic functions in statically typed languages too? But they aren't "ridiculous"

misty dirge
vale current
#

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

native hearth
#

Examples aside, what does "ridiculously polymorphic" mean

vale current
#

Maybe a function which tries to adapt to every type under the sun?

native hearth
#

so print then, first thing that comes to mind

fleet pulsar
#

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]
fallow terrace
#

can't that be annotated with an anonymous sum type?

#

sorry, union

fleet pulsar
#

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

fallow terrace
#

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

fleet pulsar
#

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

fallow terrace
fleet pulsar
#

Ah, fair enough

orchid thistle
fleet pulsar
#

Yeah, exactly

orchid thistle
#

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)

fleet pulsar
#

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

orchid thistle
#

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)

fleet pulsar
#

True

orchid thistle
#

if not then yeah just don't do that

native hearth
#

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?

green warren
#

Stubborn how?

native hearth
#

insisting on doing things a certain way, basically overcomplicating simple things they already know how to do

green warren
#

Can you give an example?

native hearth
#

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

green warren
#

I'm not following what's "stubborn" about them, I think they just didn't know how things work.

#

Also, doesn't str.split() (with default arguments) split on all whitespace, treating multiple spaces as a single delimiter? That seems like the simplest approach.

native hearth
#

in this particular case they insisted on the importance of whitespace even when it was demonstrated that it didnt matter, they wanted to do things a certain way based on some misunderstanding of the test cases

#

maybe not the best example of stubbornness