#python-discussion
1 messages Β· Page 582 of 1
pandemic meant everyone was indoors with nothing else to do and games saw a big uptick, so studios overhired to pump out new projects. We're now seeing the collapse of that
Then 
abc is abstract base class
i feel like there was a game drought during pandemic too
like, work-life balance in game dev?
abc means the class can't be instantiated
final i believe stops the class from being subclassed/inherited from
they each have their own purposes but here they're used to make the class act as just a namespace
yes
yeah, projects definitely got delayed
One can use abc on a class to make its subclasses implement some contract methods (abstract methods) if not, abc class will error
typing.Final```
Special typing construct to indicate final names to type checkers.
Final names cannot be reassigned in any scope. Final names declared in class scopes cannot be overridden in subclasses.
For example...
like, amongus and chess got popular because there was nothing else to play
the pandemic was the best time to game
it does really depend on the studio, but I think that aspect is better now. Studios are hyper-aware of overcrunching and trying to avoid the bad publicity of it. I was at EA during the pandemic and every project immediately got their release windows pushed back to avoid any crunch
yes this is the original use i knew it for
chess also got popular because of Queen's Gambit methinks
Same
!d typing.final
@typing.final```
Decorator to indicate final methods and final classes.
Decorating a method with `@final` indicates to a type checker that the method cannot be overridden in a subclass. Decorating a class with `@final` indicates that it cannot be subclassed.
For example...
Just used abc yesterday for BaseNumArgs
i think it got popular before
pandemic + queen's gambit was HUGE for chess
there was a documentary about it
Final goes for class variables that shouldn't be reassigned by subclasses, and they're also class variabbles
but it probably helped
the only gambit i know is opening my king side bishop pawn
a normal class variabble is ClassVar
huh, I see
what was the documentary?
I think their namespace class example lacks all details so my guess was both right and wrong.
Untold: Chess Mates (on netflix)
normal class variable is ClassVar, not Final
I know
It's more about rivalries, but they bring up the boom that chess saw during those times
Among us was peak back then
too high!
gotta aim for the stars
Final is not to make it non subclassable
Final is to make the variable not edittable by subbclasses
gotcha yeah, magnus and hans. that could be interesting too
the lowercase final is what i meant
np
is can be used for classes too
if you aim for the moon, orbital mechanics will send you somewhere else
you have to aim for where the moon will be in 4 days time
you're final
@Final ?
Or you mean
x: Final[Foo] = Foo()?
only 1 salt die
Not if I aim with my radio waves!
@final
class DontSubclassMe:
...
I love that thumbnail.
THE THUMBNAIL 
maybe that's the real meaning behind the quote π
it goes so: " Aim for the moon, even if you miss, you'll land among the stars"
EDIT: shoot instead of aim?
there's Final and there's final
You replied "is can be..." to a message which had capital F 
beautiful
Semantic satiation is a psychological phenomenon in which repetition causes a word or phrase to temporarily lose meaning for the listener, who then perceives the speech as repeated meaningless sounds. Extended inspection or analysis (staring at the word or phrase for a long time) in place of repetition also produces the same effect.
^
Like... Overloading meanings for same term ?
My other favorite term is Tetris dream:
tetris effect?
those are all billy's alts
he has a time machine
is there a distributed computing effect
whereby after you learn how a kube cluster works you begin to see everything in a microservices architecture
that's... a game
The Tetris effect occurs when someone dedicates substantial time, effort, and concentration to an activity and thereby alters their thoughts, dreams, and other experiences not directly linked to said activity. The term originates from the popular video game Tetris.
People who have played Tetris for a prolonged amount of time can find themselve...
i think this one
not the other
i know the game
oh god
honestly relatable though
this is too iq for me not gonna lie, i dont understand nothing
so that means... i do understand something?
yeah it does
it includes the possibility that you might understand everything
π€
π
we're all maybe a genius
i agree
now you're just overcorrecting
π
Very appropriate given your name
this is regarding that username btw
Are indians taking my job?
they could
Do you have a job?
yo so what module could be used for bad actors
why you doing linux shi
!pypi cryptography
never been employed but indians want to hustle and take my future job
that seems a tad racist
they always taking our jobs at microsoft
there's no linux shi here tho
I think I'm becoming anti immigration
yes same
rs
Let's knock off the casual racism or whatever it is.
even tho i am an immigrant
"your future job" is not set in stone, there's no "future job" reserved just for you
as long as y'all allow travelling for trips, i don't particularly mind anti immigration
People in lots of countries want jobs. Don't believe you're owed anything. Work hard, be prepared, and you'll make it.
There isn't because of the indians
unc on that preaching
trolling 
Nope
Stop. We're not doing this. It's false, and just baiting people.
alr go to #ot0-psvmβs-eternal-disapproval if you wanna discuss the truth
Complaining about globalization is about 40 years too lates
This discussion is not fit for this server at all, even in off-topic
can I complain about solar-systemisation yet? /lh
if he formulates his sentences mor respectufully it is a conv for off topic
allowing alien immigrants would be kinda lit
dang hes gettin banned
hi guys
hi
Hello!!
I don't want to keep the conversation aggressive, but that guy comes every now and then and it's just mean.
hey, how are u doing? what else did you learn?
(you can DM @pseudo carbon)
Ty
.topic
yk what i dont like the topics tbh
what are yalls working on
a game
Trying to understand Haskell
has skull
2d or 3d?
neither
2.5d
pokemon-showdown-esque
ic
The syntax is hard to read π
i can imagine
Hello i am new here and just looking for a convo to start and I am working on learning basic python syntax
goated showdown π£οΈ π₯
guys do you have a good SQLite3 resource? video format if possible
you should get used to non-video-format resources
most resources wont be video format
Well, I did SQLBolt first, which is written and interactive
just chuck the non-video format to gen AI, get a video /s
AI suddenly starts talking about dolphins:
goblins*
Yo an indian guy took my job
Alternative perspective: Your employer made a business decision.
that damages the economy
and exacerbaits exploitation
assuming that this indian guy isn't a citizen
also assuming root isn't indian
exacerbaits [sic!] more like ragebaits
yup
he isn't
!pypi mesa
That sucks tho
anyone tried this for some fun side project?
why shouldnt he?
if an europeoan took your job would it be fine with you?
π€£π
!warn 1205209977052991598 We do not going to tolerate racism or ethnic divisiveness here. Review our #rules and #code-of-conduct , or you'll be removed from this server
:incoming_envelope: :ok_hand: applied warning to @autumn kayak.
Guys what is your favourite feature in python 3.16?
It looks interesting. not something I'm much familiar with. Could you for example use this to build a system of independent agents to see how they interact over time? Like could you build something like a sims simulator where each sym is either a politician with a fixed ruleset or a voter with a fixed ideology to see how the agents behave to maximize their votes?
Ask me again in 2028.
Why
cause that way it will have been released for 6 months or so and I might have an idea by then.
What
3.15 will be released later this year, 3.16 will be released at the end of 2027. so ask me in 2028. π
Oh
realistically libraries will take a few months to get updated to make sure they run on 3.16
"a few" might be generous. π
The library I'm involved with got official 3.14 support about 15 hours ago
Hi everyone, Iβm starting from zero and my goal is to learn programming first, then move into AI and machine learning. I prefer a desktop PC. What build would you recommend for this path if I want something reliable, upgradeable, and good for the long term?
Hello can somene help me get a god tutorial for django?
Im very confused because there are lots of ways to setup a project
some uses pipenv but doesnt work for me
CS50 has a short course on django (cs50web), I would say rather than doing the whole course just watching the main django intro lecture would be a good learning experience as an intro https://www.youtube.com/watch?v=w8q0C-C1js4
this lecture is kind of the meat and potatoes of it while the other ones are more generic web stuff that you might have picked up elsewhere
whats the difference between pip install virtualenv vs (python -m venv venv) or (pip install django)
Which is a better approach?
these do different things
pip is python's package management system
can we create setter without @property decorator?
you invoke it with pip blablabla
pip install virtualenv tells pips to install virtualenv
python -m venv venv tells python to run the module venv with the parameter/argument venv
pip install django tells pip to install django
decorators are always just a shortcut, so yes
anything you can do with a decorator you could technically do "the harder way"
do i have to write the decorator by hand ??
no, you can just call the property function and pass in your get/set
!e
class Foo:
def __init__(self):
self._x = 0
def getx(self):
return self._x
def setx(self, value):
self._x = value
x = property(getx, setx)
f = Foo()
f.x = 5
print(f.x)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
5
I just want to know that ai automation engineer is good role or not?
oh ok..the traditional way
Means roadmap of this field I want to know
yes, decorators are what we call "syntactic sugar". It's just an easier way to do something that was already possible
ok
there is no roadmap that definitely leads to success
this applies to literally any field
not just computing
no one can predict the future about how the job market and industries will change
so it's hard to choose something now that will put you in the best possible position 5 years from now
Okk thanks I am just getting nervous about this opportunity whether I take or not
you are getting an offer?
"it's a leap of faith" -miles morales
do you get paid?
Yes I got offer this in film production company
That's why I am getting confused
They want to automate internal or external studio also
it's hard to get a job now, you might as well take it (assuming you are sure that it's not a scam)
you have a job offer but you also need a roadmap?
do you already have the skills? How did you get a job offer without the skills otherwise?
I have python skills ,and ai models also
then what roadmap are you looking for?
have you worked in film before? Is this like a pipeline TD role?
No this is the first time in film production company
what is the position title?
Ai automation engineer
maybe you'll be trained
Are those just fancy words for "AI prompting"
good morning!
good morning eivl
good morning
I don't know
is there a role description?
Yes
do you feel like you fit the description?
Means I have to look there internal crm also and other work right now I am doing is on n8n ,api integrations
do you have any skills in that
What can i do for get job
if you dont have experience using n8n or building infra and stuff like that idk if that job is for u
Maybe see upwork or fiverr? A friend of mine got a lot of freelance offers in upwork
Upwork is a mega race to the bottom with insane competition. You're welcome to give it a try but it's hard out there.
oh i dont mean posting your profile, they post a lot of job offers you can just reach out and say i can get this done like that for 4 or 5 offers and then maybe one will get accepted.
yeah, but you have to make insanely low offers to get accepted
everyone is trying to undercut each others' prices
my friend was a mid website developer and he got an offer for a landing page for a massage service for 800$
when was this?
2 or 3 months ago
interesting
I'm kind of surprised that there are people out there who will pay $800 for a landing page especially in these times
Every single item in the studio is a "Resource." Whether itβs a CPU or an SSD, all of them need to track these basic details:
Name: What it's called (e.g., "Intel Core i9").
Manufacturer: Who made it (e.g., "Nvidia", "AMD").
Total: The overall number of these parts they own in total.
Allocated: How many of these parts are currently locked up inside a PC build right now.
Category: A smart shortcut that looks at the item and automatically says its type in lowercase (like "cpu" or "sdd")```
```py
class Resource:
def __init__(self, name, manufacturer, total_parts):
self.name = name
self.manufacturer = manufacturer
self.total_parts = total_parts
def category(self, search):
if search == self.name:
return self.manufacturer```
how to write last point (category)
Just take a look at the job offers in upwork.
it's a bit unclear from this, but it seems like category should still be a simple attribute, not a method
I had a brief stint on Upwork a couple years ago
but yeah, maybe
it's still surprising
how am i going to write it in lowercase
The lowercase isn't the issue. It's unclear where it expects you to get the category from
it describing it as a "smart shortcut" likely means it won't be a parameter, but you'll have some way of knowing which category the resource is based on the other info
is this problem prompt generated by AI?
Wouldn't be surprised
yes, but i also have an original problem which i didnt understand
you're getting confused because AI is giving you terrible problems and information
don't use it
seriously.
you're doing so much harm to your learning
which one should i refer?
but i didnt understand the project..what should i do then?
I don't understand the project either and I'm experienced in python. The project doesn't make sense.
!learn
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff β an online book (also available to purchase as a physical book)
- Harvardβs CS50P course β video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course β text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
I'm frustrated while making my school project so I asked Claude doing it for me, but it's broken allover I end up rebuilding everything from scratch tho I still use the things it generated as reference to have something to cross reference while building the thing
Just go spend a few weeks doing codewars problems. You'll be much better off in the end.
wait letme show you the project in help thread
I don't really want anything to do with an AI generated project
most python web framework use jinja templates??
pick something from this list, and do it from start to finish.
don't drop it and start another resource. I recall at one point you somehow ended up on and were wasting time on a course that was about deep esoteric Python internals before you even really understood OOP. don't do something like that.
Don't overthink the OOP part
the way i use AI to code is ctrl+i (inline chat)
whenever i have to do something tedious, ill just select a block of code, ctrl+i then type "can you do this tedious thing for me kthx"
personally prefer it over agentic stuff
cuz then i still have control over the code
It wants you to deduce the part type from what information you've got. And really there's no way to do that without a huge table of "this name is a cpu, this name is a video card" and so one. Unless you annotate every part, or write something which parses or guesses from the name, you can't do this.
save your breath, it's an AI prompted problem
I gather. But it's not enough to say "this doesn't make sense" we should at least point out why.
https://discordapp.com/channels/267624335836053506/1506180435779129374
need help..how do i approach this project
As mentioned: don't. It's a bit nuts.
There are only 2 approaches: annotate each part with type information, or write (something magic an unspecified) to guess the type from the name and manufacturer (i.e. the information you have).
should i skip it?
Fash and I think so. AI hallucinates, and that means it can generate nonsense.
but the pics i have is not ai generated
Whihc bit was AI generated?
its the actual project from the course
Oh. Hmm.
the text written down
Which course.
oop
Could you link the course here?
Oh, it's this bit:
It sounds like you're making a subclass for each resource type (HDD etc?)
Then you want tthe name of the class, lowercased.
You've got self, the instance.
The class is either type(self) or self.__class__ - these are the same thing.
And the name is the .__name__ attribute of the class.
And you want the lowercase of that.
Write that expression and return it.
Sounds like it's a 1 line @property method.
how am i going to write it
Written a property before?
Ok, this is a property.
You can basicly derive this from the spec:
"computed property that returns a lower case version of the class name"
So "computed property" means:
@property
def category(self):
What's the class name of self? (See above.)
Once you've got that, how would you get the lower case version?
Yes, this, exactly.
Oh, with a return
__class__ tell which class self holds and name turns it into string right?
So it would be:
@property
def category(self):
return self.__class__.__name__.lower()
Yes, .__name__ is a string.
will self.__name__.lower()
work?
No. π
I know with a normal instance .foo finds .foo on the class (if it's not direct;y on the instance itself). Doesn't seem to happen for .__name__. So you need self.__class__.__name__
I'd need to dig into exactly why, not sure.
Possibly classes special case some attributes if they're not on the instance itslf.
Or type(self).__name__, same thing.
okay
As it turns out, not an AI generated problem.
i should give it a try....if i stuck i will ask for help here
the AI explanation missed the mark about what was actually being asked though
But leaving aside whether self.__name__ would work, it's usually best to write exactly what you mean. So self.__class__.__name__ because you want the name of the class. So get the class.
name identify types, functions, modules, classes, and not specific objects
same as qualiffied name, only that is for the dotted name path
I know what its for, I meant the mechanism
hi
oh right.. whenever you have some custom lookup of a thing, it is always a descriptor
im not sure how the name lookup is actually implemented though.
how do you start learning networking
networking as in linkedin? or routers and stuff
um i started by learning different type of protocols. then learnt http req types, headers and all that
implement http 1.1 from scratch using python
yeah like routers and servers and linux
did you use a book or what resource?
Do some low level socket stuff. A pair of UDP sockets, send packets between. A TCP server and client socket, send data between.
Learn the basics of IPv4 addressing and routing (really just: network part, local part, gateway is enough to get going); IPv6 is a topic for later.
Search for "python socket tutorial" or look for a networking or sockets tutorial in the resources.
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Don't be rude π That's ... quite a lot. I went there once, unfinished. Someone here did an HTTP 1.1 impl recently ISTR.
not meant that way,.. yeah it is a lot for sure
Sorry, that was hyperbole - I knew you weren't actually being rude π
yeah sounds tough π
sounds good, thanks for the help all!
i self learnt
yes
!e
from math import cos
x = 0.739085133
print(x, cos(x))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
0.739085133 0.7390851333600954
This is the kind of question you can answer for yourself π
Sorry
Thanks
Thanks
No need to apologise. But pointing out that you can test this kind of question!
I realised that you can run a loop that takes Cosine of any no till a certain time
That works. A bisection might be faster.
Bisecton?
Hi
How u doing
We've not yet been taught
Take two values either side of the target A nd B. Get cos(x) half way between each value "mid". See which side is closer. Use (A,mid) or (mid,B) as the pair next time. Repeat.
Newton's method?
Bisection is just a search technique where you pick a place half way between the bounds you have and decide which bound to discard in favour of the midpoint. Haves the search space every time. Repeat until you're close enough or you find exactly what you're after.
It's been too long.
Ok I'll write a program
Meaning I can't remember how Newton's method works any more π
In numerical analysis, the NewtonβRaphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valued function. The most basic version starts with a real-valued function f, its derivative fβ²,...
mind that bisection will only work in intervals where the function is monotone though
hmm you can replace that with simply having positive and negative values if your function is continuous
decided to make a clicker game because i am bored and will try to learn how to make one as i make it
what yall think about ai coding stuff
it can be a useful tool when used responsibly
don't ai and drive
i was talking about the ai replacing coders thingy]
for this problem specifically because cosine is nice you can just start with any value and apply cos a few times and it'll converge to the fixed point
wait what
relevant theorem is the banach fixed point theorem
!e
from math import cos
x = 0
for _ in range(30):
x = cos(x)
print(x)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
0.7390822985224024
oh wow, interesting
If all goes well, I will go to master's admission in one of popular technical universities of Kyiv. The preparation is on the way to be done β
Good luck :3
π
banach of banach-tarski paradox?
which is weird because I don't remember what the banach-tarski paradox is, just the name of it...
yeah same guy
will i get crucified if i talk about c++ here
TIL they have a paradox but i know tarski has a fixed point theorem too
banach tarski is the one where you can turn one ball into two balls
oh
unless you spam "python is slow c++ is fast" then not really, at most you'll be asked to move to #ot0-psvmβs-eternal-disapproval
python is slow c++ is fast
thats true tho
no u
TIL, thx.
python is fast, c++ slow
python is fast, c++ slow
python is c++, fast is slow
!e whats it called when you iterate over n functions alternating and get n fixed points
from math import cos, sin, sqrt
def f(*funcs):
n = len(funcs)
x = 0
for i in range(n * 100):
x = funcs[i % n](x)
for i in range(2 * n):
x = funcs[i % n](x)
print(x)
f(cos, sin, sqrt)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | 0.6961411774944359
002 | 0.6412615079574365
003 | 0.8007880543298811
004 | 0.6961411774944357
005 | 0.6412615079574363
006 | 0.8007880543298809
honestly making a clicker game is fun
C++ is , slow fast python
hi
this is what shallow searching has brought me
https://en.wikipedia.org/wiki/Iterated_function_system
there's also something called a contraction mapping apparently, but i don't know what any of these terms really mean
making games you want to play is fun probably, as a hobby
its just fixed point theorem on some function like f(x) = sqrt(sin(cos(x))), i was just being silly
from the discussion above
Where may I request the moderators to reopen a thread that was closed due to inactivity?
Yes. I was unable to do what I was adviced to do the day before and yesterday due to personal issues
you could link to your old help thread in a new one
Okay
argparse supports prefix matching for option/command names as long as the prefix is unambiguous.
Example:
--ver -> --version
--ini -> --initialize
con -> connect
If multiple matches exist, it throws an error and lists possible candidates.
Do you use this behavior in CLIs?
Do you like it, or prefer strict full-name matching instead?
I'm not a fan of this being done automatically, tbh. you can have aliases but they should be explicitly defined.
The only CLI tool I can recall immediately which does this is ip (e.g. ip a maps to ip addr (even though there are other commands which start with a))
I see. thanks for your reply.
For one thing, this behavior means that simply adding new options can break old scripts.
Oh yeah, that's a potential bug awaiting to happen on new names being added
i will drop adding support for this
I would prefer for some form of completions support instead
Agreed, that would be helpful
explicit alias are a good feature, especially short forms -r for --run etc
real
can i ragebaiting by posting C++
you can try
...in one of the off-topic channels
Ragebait C++ by posting Python
Imagine writing 6 lines of code in C++ just to print Hello World when its 1 line of code in Python.
6 lines of code, that too without readability & quick understanding without prior knowledge lol, where someone new can literally read and tell it
#include <stdio.h>
int main() {puts("Hello, World!");}
you have to do those tricks to make it less lines of code, whereas, in this case of hello world program, Python's default flow results into 1 line of code. You don't even need such tricks.
And those tricks make it less readable and no one likes that format, whereas Python's readability++
not really a trick tho
Honestly, if Python was named readability++, i wouldn't have minded.
I mean, whatever that is called.
people really often need to write a hello world program so the overhead of writing an entrypoint function is so big
very real
what's even puts()? the s stands string? first impression would make me think 'the βsβ marks the third-person singular present tense.'
print makes much more sense to me.
[out]put s(tring)
If you're coming from english
Even worse lol
you can think of puts/gets as counterparts
Look at this
print("Hello, world!")
Even a baby can read and tell what this will do
#if 0
x="""
#endif
#include <iostream>
int main(){std::cout<<"Hello, world!"<<std::endl;}
#if 0
"""
print("Hello, world!")
#endif
same code prints hello world in both C++ and Python
Hey @opal gull!
Add a py after the three backticks.
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
although the C standard library has never been that great at function naming
what are you talking about bot
Code language missing?
no because it's both C++ and Python
idk what language to put
gets literally removed from c11
I'd argue that readability is subjective. Is python more readable because it uses less symbols? And even if something is readable, is it understandable? What about everything that Python abstracts away? C-languages and Python are languages designed for different goals. And I imagine people who work at very low levels prefer a bit more verbosity in exchange for more control
print("Hello, world!") β still reads better, much english, less encrypted / scary. Even comers can make a quick guess as to what this will do.
ah, right
fgets still exists though
fgets? formatted get string?
the f stands for file, you provide the file to get the string from as the first argument
fgets reminds me fget from property
im trying to make firefox reload userContent.css that has local file imports on changes and im close to git comitting sudoku
the includes and main function don't really "cost" a lot of readability when considered over nontrivial programs
i got to the point of styling websites with pywal colors
its just names, rest is scary and not understandable to a newcomer.
because i hate when things arent consistently colored
and even in that, puts()
and whatnot abbreviations
you just can't beat the elegance of Python's
Lol
what about Go
readable? For sure: echo 'main(){ puts("Hello, World"); }' | clang -include stdio.h -std=c89 -x c - && ./a.out
No matter what you do, bring Rust, bring Nim, you just can't. Can't replace Python.
I must defend puts() because that's what Ruby calls it
lets goo c89 implicit int types
show this and a newcomer will consider you a hacker
They see terminal and goes HACKERRRRR
Naming convention makes me discard it
i think i just have stockholm syndrome
but i believe its fine
lol
hmmm
can an extension force the reload of userContent.css?
do people in stockholm still call it stockholm syndrome
Now you have more code/words than originally you had in a .cpp file.
why wouldnt they
and now look at this.
python -c 'print("Hello, world!")'
Yet concise, yet readable, yet elegant.
Ok there's an issue
I don't usually use -c tbh
look at this
echo Hello, world!
bash is even more readable, elegant, and concise
I would not call bash elegant
Fixed
Any words? Compare this to your .cpp code or cli way
https://esolangs.org/wiki/Hello is the most concise and elegant (on this metric)
[lambda] (include) (14:29:00) clang-repl $'#include <stdio.h>\nputs("Hello, World!");'
Hello, World!
\n
the 1 line for the include is such a big problem in real cases
very important for the world
arguable, i wouldnt know what h does
its still unreadable, \nputs looks awful and seems like someone's cursing you
I'm glad they provide a scratch interpreter
the case where the existance of stdout doesnt make sense is not important
because C is, as we all know, not used for embedded development
so printing should totally be builtin, not in a stdlib
/sarcasm
and even ignore that, how many real programs actually use stdout and stdin directly
c, the quintessential outbedded development language
This is way readable, less words and quickly understandable, whereas that c++ one still looks obscured and not understandable and not english-ish. No space, ugly \n, horrible $'# starting words.
Even cli version of python looks straightforward and readbale
just ragebaiting atp
finally someone understood
.
all people who ragebait should be banned
Y'all fell for it π
until this word was a thing people did it much less
nowadays its more often than genuine messages

Word of the year!
is that so? trolling has been part of the internet forever
i sitll cant hot reload usercontent.css imports
such simple
(pg:=__import__("pygame"),__import__("pygame.locals"),ri:=__import__("random").randint,sc:=pg.display.set_mode((600, 600)),cl:=pg.time.Clock(),sp:=pg.Vector2(10,10),sb:=[],di:=pg.Vector2(10,0),nf:=lambda:globals().update(fo=pg.Vector2(ri(0,59)*10,ri(0,59)*10)),nf(),[(sb.append(pg.Vector2(sp)),sb.pop(0),sp.__iadd__(di),(sb.clear(),sp.update(10,10))if(sp in sb or not(0<=sp.x<=600and 0<=sp.y<=600))else None,(sb.insert(0,pg.Vector2(-10,-10)),nf())if sp==fo else None,sc.fill((0,0,0)),pg.draw.rect(sc,(255,0,0),(fo.x,fo.y,10,10)),pg.draw.rect(sc,(255,255,255),(sp.x,sp.y,10,10)),[pg.draw.rect(sc,(255,255,255),(p.x,p.y,10,10))for p in sb],[((1/0)if ev.type==pg.locals.QUIT else di.update({pg.locals.K_w:(0,-10),pg.locals.K_s:(0,10),pg.locals.K_a:(-10,0),pg.locals.K_d:(10,0)}.get(ev.key,di))if ev.type==pg.locals.KEYDOWN else None)for ev in pg.event.get()],pg.display.update(),cl.tick(10),)for _ in iter(int,1)])
fuck modern browsers i DONT CARE about seucirty
Why would i be banned, it was all on-topic and i preached Python and its elegance with well-versed arguments
people are way more comfortable admitting to "ragebaiting" than "trolling" though
it is actually two words: rage bait
@gleaming knoll consider forking Stylus and using native messaging to let it load/reload files from disk
Print (βHello Worldβ)
The ragebaiting is already finished bro, you're late
what im currently doing is a fx-autoconfig JS/ script using the browser stylesheet service to reload it but it doesnt seem to work
i will likely need more than just css later for websites with random class names
immediatly jump to tailwind
lambda about to reinvent Dark Reader
where did you guys learn about frontend dev? I find more and more I need to know it, for both personal projects, and figuring out the interfaces/front end logic of applications I am programming with.
Started with school and then learned more at work
ok it works now
i just vibecoded the reload script
nice
amazing
mainly just the docs of my choichen frontend framework and mdn
choichen? = chosen?
mdn is great
what is choichen? lol
me spell good
is viv using voice input
with a heavy norvegian accent
"choice in"?
I have used mdn before to learn html. It was enjoyable
β¨ dyslexia β¨
then I tried to parse through a webpage, to do web scraping, and it was div hell
i wonder how dyslexia works on keyboard text input
like surely its some different brain part than reading
the whole mdn course was like "be semantic when making your HTML web pages", then its a nonsemantic mess outside of it
sure its different from reading, but its related, and dyslexia is for both reading and writing
I wonder how dyslexia would work with a brain interface chip.
or can be is more correct to say, it varies between people
I dont have much issues with reading, for me its mostly spelling
I understand though, why that is the case, cause I've heard from others people used to automatically generate HTML documents from some sort of automated language thing they had. I forgot the name they gave it, it was a few months ago.
this is awesome
i can edit my .css overrides in neovim and it autoreloads
its time to make uhh
discord and github css overrides
i hope they dont have shitty css class names that change each time
: )
is there anyone at the age of 15 who is interested to deep dive into the field of artificial intelligence and data algorithms? I need a group of ppl to spend my time with about computer vision, robotics, etc.
anything for the "big picture" of front end dev?
why 15?
ok, any age
hey
sure
anybody here knows hwo to use cheat engine?
or make a good ui, i wanna learn
well the ecosystem is kinda fragmented, so the shared stuff is mainly html and css, and then js/ts. and most stuff beyond that you are getting into framework specifics
mmm, I see
We don't do cheating here
singleplayer games?
I only use it for geometry dash speedhacks
you know how to use pymem?
no never dealt with it
there also various related topics like accessibility and web design, which depending on your goal your might or might not want to also get into after learning the basics.
how do u make sp cheats then
I've noticed that when people talk about "front end", they only talk about it in the case of web applications. Our group for senior project transitioned from a web based application to an EXE running on our device. Is there any differences that go into that?
like in big companies the people designing the page arent the people implementating it, but for hobby projects you will be doing both, etc
probablee ja
absolutely
what are sp cheats
many desktop apps now use a web UI, so there's more overlap there than it might seem
single player
the Discord client, for instance, is one such app
mmm, ok
ah actually fair point, frontend can mean non web, tho usually without a qualifier people assume web.
it depends, theres electron and friends which basically just package your website as a native app, but then there are also antive specific stuff like which can be pretty different
you hook into the process's memory and you modify it, same thing for most if not all games
I personally find immediate mode frameworks really neat
since i vibecoded the reload with deepseek, i decided to also style it first
it seems to have consistent (although not human-written) class-names so it wasnt that hard
#ot0-psvmβs-eternal-disapproval message
and how
uhh, other than hobbist, what would be the most common in a professional environment?
hobbiest? hobbist?
idk lol
well most stuff is web these days, and I think react is still the main goto. tho I tbh i havent looked at the numbers in a while
π
i wonder how hard would it be to change the theme of codeblocks that it outputs though
to match my neovim theme
do your research
sorry for going off topic. Thank you all for your patience
alr
.topic
Suggest more topics here!
Figure out the data design, as everything else stems from that. Then look for suitable third party libraries to aid with the project.
grab a notebook and doodle
develop use cases, diagram a dummy system, then program from requirements.
@quasi umbra
mhm
you okay with it?
pick a small component of it that's easy to iterate and test on, and try implementing that
ye
has anyone here done "behavioral driven development"?
I've been curious as to what its like.
I know its typically a ruby thing, but pytest has their own module for it
Use claude and repeat.
me when i exterminate 10% of all marine life by spending 10 trillion tokens and 5 hours on claude code
Ye
Vibecode and Repeat.
Yo quick question, geenrally speaking if you are tryna learn some new python concpets how long should you struggle doing it alone with the notes alone before using AI or getting help from somone. To maximize learning
Avoid AI. Ask us.
the more you struggle with it, the more it sticks tbh
!beginner
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff β an online book (also available to purchase as a physical book)
- Harvardβs CS50P course β video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course β text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
Consult documentation.
Okay
so instead of asking gemini for hints I should look at the offical python documentation and try to figure it out from there
Give it an honest go first. Then ask for help. I don't think it's helpful to just bang your head against a wall forever. And it's demoralizing too. But don't give up too quickly either.
ok
You can use the official docs, but a lot of the time I think it's just as helpful or more to use 3rd party sources like tutorials, blogs, forums or this server.
this is actually quite useful I saved it
okay
feeling uncomfortable and dumb is the first step and natural response to being exposed to something new, so it always happens when you start learning something
what are you struggling with?
if you're struggling, ask someone here, we are only too happy to help clear things up. AI is superficially useful but can be subtly wrong in ways that harm more than they help
in general it is valuable to get used to reading technical writing, but it's also OK to ask for help in understanding it, especially at the beginner stage. use help (preferably here over AI) as a supplement to reading the docs, instead of as a replacement for it.
not anything right now, I was struggling for a while before but then I gave up and asked AI
π
idk π I asked to find out what people have used it for, lol
pydsn wordle
can someone explain for me arrays and linked lists
"Array" is a nebulous concept with multiple definitions depending on the specific inplementation. It can mean a two dimensional grid of data, a one dimensional sequence of entries, a 3D grid, the elemenrs if all these may be restricted by type or be more abitrary, they may hold references to other objects rather thsn the data itself, etc...so arrays, yeah...which array from what?
As to (singly) linked lists, they are a data structure...think of them as a collection of nodes with two slots each, one slot for arbitrary data, and the other slot about where to find the next node in the sequence.
Doubly linked lists have three slots, data, next node, previous node
like dictionary
BDD is just TDD with a behavioral flavor. I.e. testing the code or system while saying nothing about how it works internally. DSLs like gherkin let you specify behavior in English and implement the steps separately. You don't need anything special to do bdd and what you typically see it associated with is acceptance test driven development. You should check out the original article by Dan North who came up with it if you want actual context. I.e. tests stop being thought of as tests, they become specifications and they're written first.
Not quite. Dictionaries are a different concept again. Dictionaries are a collection of items, each item comprised of a key which associates to a value. If we want a given value we say "Hey, dictionary, here's a key, what value does that key associate to?"
Binary Descision Diagrams
ooooh thank you for your time
hi
So.... integration tests?
The BDD commonly seen as associated with gherkin is acceptance test driven development with a behavioral focus which can also be applied to unit tests with a simple sentence scheme and not testing implementation detail, i.e. specifying how you want a function or class to behave. And by acceptance test I mean end to end test. It's the same scheme/mindset and it can apply to any tests.
The important part about doing it for acceptance tests though is that non technical people can read them and say you've got the right idea, or the wrong one.
as an as
Whatever happened to the Ghurkult?
They're still alive
Hm.
the counterpoint to the promise of BDD is that it's actually difficult to provide an interface for non-technical people to expess what should happen, and that interface requires an entire layer of code which itself can have bugs.
This is more or less how I work. End to end tests are more important than unit tests, at least for the type of stuff I do (or at least, in my opinion)
Altho, I'm not sure about the word "behavior" here, so maybe I'm misunderstanding their intent
(oh, reading article, not what I thought they were saying)
Since near its inception, I have never really seen a non technical person write at least the human readable part of a bdd test. Which is kind of a shame because it was a noble goal π
It's a behavior like when you add a positive number and a negative number you end up with less or something, i.e. into an add function, not that this is a realistic example.
With acceptance tests it's like a list of steps, a scenario of using the system end to end, like you enter an invalid credit card and you see an error. Basically behavior, test behavior not implementation detail, or specify it.
Or in other words, the behavior is what something should do.
I think they're all important but practically speaking I think you can't deem your application still ready for release or not broken without end to end, so in my case I'm writing them anyway, and in some cases it would be way more desirable and result in less complicated code to only write end to end.
I see. I have seen the cucumber book online, and did a little bit of reading there, but didn't know there was an article like this. Thanks.
I know a few of the original OG BDD people and some have stopped writing quite so many integration tests. They are slow, can be insanely hard to debug, and require a pretty complicated test harness setup. Instead they focus on enforcing contracts between methods and system components and write a lot of unit tests.
The idea of a the testing triangle suggests that there should only be few integration tests in comparison to unittests.
I would assume the non technical part of bdd is textual use cases, no?
Yea the gherkin.
I popped in kind of 1/2 way into the conversation, but for context
BDD usually implies mapping a bunch of scenarios in a Gherkin like syntax
Scenario: successful login:
Given the user is on the login page
When the user enters "username" and "password"
Then the user should be redirected to the dashboard page.```
to a set of functions that can really run anything. Some of those functions will contain an expectations like a normal unit test.
One of the original ideas is since we had broken describing the test and implementing the test we could get non-programers involved in helping us write them
ok
I read through the chapter 12 of ATBS but he didn't tell how the shell script works. Just told to copy paste the code below
But philosophically you could write BDD test in a tool like the stdlib unittest, as long as you are describing and testing behavior only the end user can see
You don't need gherkin for it though. You can write similar stuff in your programming language and drop the given when then. Also, end to end tests aren't necessarily slow or hard to setup, there's ways to design the system where you use the natural functions of the system to isolate data, just randomizing emails. The LMAX exchange does BDD with an internal dsl and has 10000+ end to end tests and push back against the idea that they're slow or cumbersome.
https://www.symphonious.net/2015/04/30/making-end-to-end-tests-work/
I see. ok. That makes sense.
This is what is advocated for by Dave Farley nowadays and I've also done that for both the technical benefits, and to clarify requirements on another project. I've written an acceptance test then had it reviewed to make sure it is for what we're supposed to be building because it wasn't clear by the code/state the project is in.
Totally, see the next comment :), but like devops means a specific set of tools to some people BDD has similar connotations to tool sets.
I was summoned by mention of devops
The cult of observability welcomes you
Oh no
I made a legacy branch of my application
And now I have to backport PRs
IDK how to do this π
Okay. I'll take some time to look at it. Right now, I was reading a TDD book, and its a bit to handle for myself, so It'll be a second before I really engage with BDD apart from the concepts shared here today. It is very helpful reading waht you all shared
One of the things that I kind of miss from writing BDD test were 1st class support for data tables. I even played around with making datatable helpers for unittest haha (p.s. I dont think its a good idea in th long run) https://gist.github.com/MattyO/f915cf8d57c2f6559348f678ed716b89
I think too many unit tests can be problematic too. They kind of coagulate your implementation details and make refactoring more time-consuming, since you end up having to rewrite a bunch of test code.
e2e black box tests don't quite have the same issue
btw, I know we glossed over this, but was it a BASH script, or a python script?
One of the things the BDD community realized pretty early was that combining the normal Cucumber stack with a page object pattern greatly reduced the number of expletives you shouted at your computer. With just a page object to help writing integration tests with your regular old unittesting library is waaaay easier and they look quite close to the older original BDD toolsets.
I just use an abstraction layer for interacting with the system/asserting stuff and the unittest module. Can make up the methods as needed and then use that as a specification for what needs to be implemented/wire it up later.
I'm a super fan of the ago old idea of listening to your tests. A test that is hard to write is telling you something about the architecture of the implementation. Its more likely something should change in your implementation than your testing tools. But those skills are hard won, as programmers normally are given a system that has had a long life and story before we showed up, and have limited ability to change it.
Agreed.
man, just reading about the "page object pattern" is quite the humbling realization my understanding of the depth of patterns is shallow.
other than the GoF patterns, I mean.
I think that some types of tests are more brittle than others and not a good idea to write. For example, the contract style testing you said these people use instead are the kind where you assert interactions between interfaces happen, that's brittle and doesn't give confidence in the code I don't think, a counter example to this is take the Repository pattern, if you have a layer of code that relies on repositories to load stuff, save stuff and function, you can use an in memory version and just test that code like you have a real system, but in memory, it's less tied to brittle and specific interactions.
Here's an example of a real test I threw together for testing keyboard input, this is from an experiment to figure out how to test it in general, and the application being tested is basically a keylogger because I wanted something simple to assert.
class TestAlphabetLogging(LineRecorderAcceptanceTestCase):
def test_should_record_lines_of_strictly_alphabetical_characters(self):
self._keyboard.press_and_release_character("a")
self._keyboard.press_and_release_character("b")
self._keyboard.press_and_release_character("c")
self._keyboard.press_and_release_enter()
self._line_log.assert_line_in_log("abcd")
how did d end up here
It doesn't have to be complicated. A class defines a page, and and function defines a action you can do on that page. You can do it with regular old classes and 'just'(haha) refactor the different bits that are already doing itegration actions into the right place. The pattern is more about putting friendly/related code next to each other
Hi guys i am yamen recently I launched my first app on Google play it call "taskflow " please guys can u download it
I see. I got the idea from the fowler article he has on the pattern.
This is the link
though the way you talk about it is a little different
its very nice to hear extensions of good programming advice, is what I mean lol
......
π
we understand you have a project. This is not the correct channel for it. We have a dedicated #1468524576479641744 channel, where you can post your work.
hi. sorry, but this isn't really the place to advertise your app.
!rule ad
if it is written in Python and open-source, you can talk about it in #1468524576479641744
Sorry
You still can't post a google play link and ask for downloads. You'd have to post your code.
understood. Sorry for talking about things I am not well versed in.
It's alright, I'm just clarifying.
π
Well, do any of you know where I can post
my app?
is it open source? written in python?
sorry i'm replying a day late lol i had to leave quickly
but no, I have to go do some DSA prep for a virtual interview I am having soon. It was wonderful talking @glad egret @tame hinge @golden mortar . I will absolute have to ask you some questions about good design and patterns in the future, if that is fine with you @glad egret π
i'll take that as a compliment though :p
No it is by react native
Bash I believe. Starting with #! ?
@silver plover
written in python?
No
no, a shebang is to tell thr linux os which binary to use to run the file
google adsense
So it's not a bash script?
You know this is a python discussion channel on a python server?
I was recommended a cloud system tutorial, and it had a page on bash scripting. I also did some stuff about it as well for my college coursework. This is the link to the free article from the cloud tutorial:
https://www.freecodecamp.org/news/bash-scripting-tutorial-linux-shell-script-and-command-line-for-beginners/
Not limited to bash
Oh
@prime mountain it depends what comes after the shebang
Oh
you could have:
#!/bin/bash
#!/bin/env bash
#!/bin/perl
etc etc
Where do I learn more about this?
possibly here
#!/usr/bin/env bash source /home/atreus/Scripts/.venv/bin/activate python3 /home/atreus/Scripts/ccwd.py deactivate
why not have a shenag in your python acript that targets the venv's python directly?
ok i can see why people go for nixos
Python scripts can still have shebangs. Or any scripts.
Any text file can be set to be executable - and then shebang is checked to know what program is used to run it. Be it python, bash, another shell, or something completely different altogether.
:)
the imperative configuration spaghetti is accumulating
and its spilling out of the bowl
I don't know about how it works. I just did what the book told me to do π
which book told you to do that? 
Automate the boring stuff
internet edition
Nix is incredibly cool and useful
But by God managing the dotfiles become a chore
Author of Automate the Boring Stuff did this π’ I helped OP before in #1035199133436354600 but had to go afk so I didn't show how to properly do this
But it beats having to reinstall everything all the time
atleast you have something clear to manage
not some global state mess edited by god knows what scripts ran in god knows what order
take a look at the free code camp tutorial I had sent earlier rq, and then there are books like "effective shell" or "linux command line" both from nostarchpress if you want to go more indepth
they have a few chapters on shell scripting there. They were fun to read.
It's not wrong, it's just unnecessarily complicated
I would totally write a test for that class where it connects to the real life repository, if possible. e.g. if the outside repository was memory or file system based. Sometimes that system is hard/impossible to reset or setup for your tests. I have a project that interacts with github so I use contract tests there.
But I would still probability refactor out the smallest and exact bits that communicate to the repository, mock the interaction, and write a unit tests. Those mocks will make setup for a bunch more unit tests way easier.
I dont know if there is 'real' name for this pattern, but I call it the 'dont touch me' pattern haha. I think it totally valid to put things that are implicitly hard to test in a dark little corner, build guards that prevent people from accidentally updating them, and then not touching them for years. When you do end up having to update something there, they require a bit of time extensive manual effort, but only every once in a very long while. Its a fine trade off IMO.
home-manager :π
i don't think shebangs are the first thing someone learning python for the first time should have to learn
Pretty sure this doesnt work
You need the -S flag
yeah, what is your usecase for learning scripting?
I agree, this has nothing to do with python and more linux specific
yes
When I need the shell to give me things
it's on mulyiple lines not a single one, it will work
Oh wait I have the linux command line! I paused learning through it for ATBS π
OP formatting was odd
Anyways, thanks
ofc, I mean for atreus' learning goals.
ATBS? 
automate the boring stuff
ah, thanks
Yeah
#!/usr/bin/env -S bash --norc
output=( $(mpstat --dec=0 1 1) )
cpu_usage=$((100-${output[-1]}))
echo $cpu_usage
Like this for example
The testability of the code as a whole is greatly influence on where and how you use our example Repository class. Dependency Injection / Inversion of control can make testing in general way more manageable. Also part of the "Dont touch it' / 'the floor(class) is lava' pattern
hi!
@prime mountain but if its for python specific reasons, you don't need to know shell scripting itself. You can make python scripts through the sys library that runs on the command line. Those then can be either called on its own, or in bash scripts. You don't necessarily need to know bash, too, cause if you work with MS systems like azure cloud, they use powershell (I think)
Hi Pydis
(unnecessary norc)
I am on linux and I mostly hope to use python for robotics and automation
@tame hinge Sorry if the replies seem confrontational. They aren't meant that way, just trying to keep things organized for anyone reading along and in a room with many concurrent conversations.
Also I like computers in general so it's a personal interest
π
Take for example there's some registration and login code, you need to register an account before you login. This code could be annoying, having to add entities into repositories and get it into a certain state... Or it could be easy, have your test case setup inject everything with fake repositories and test it like it's the real thing from a layer down but in memory. So you just call registration and then login and assert the results.
Are we talking about GitHub repositories or the repository pattern?
Damn that's tuff
?? You mean I chose wrong or something similar to that?
I mean that's cool
Oh okay π

I was talking about the repository pattern. I used Github as an example for when I make class that interfaces with it very small and rely on contracts for testing and assume a fairly stable interface. I have some other observably tricks that help, but those are outside the topic of testing
learning python dam its so demotivating rn
Demotivating? Once you create your first little project is the best thing ever. What have you done so far?
hello
Hi
how are you bro?
demotivating? i'd like to see you learn rust

If we're talking about an interface to GitHub or something and wanting to be able to test code that uses it I think that's a fairly simple example. All the code that needs to use GitHub would be simple and use dependency injection. It's probably stateless so you can just stub responses that you need. But what I'm trying to say is that there's a lot of code that integrates with a real system and changes state, like if you're just querying stuff it's simple, verify it interacts with your mock, stub or spy correctly. But what if you have a collection of code that in practice you're creating something on an external API then getting it later. I might be mixing up arguments here. But that's when I'd make a fake version of the real system in memory that requires no setup, it just acts naturally and I can write my tests like I have the real thing, in contrast to caring about small interactions or method calls.
are you stuck on one thing in particular? there are probably some people here who can help!
(I remember hitting the wall a couple of times when I was just starting out, too. I think it happens to everyone.)
my "wall" was OOP concepts
If I can set a config and make whatever the outside system the repository pattern in talking to easy to start, reset and have a modicum of effecienty(think writing a file vs making a network call). I'll just set a config pointing my app to the outside instance use for testing the thing. I'll likely have a bunch of the same test helpers for managing it regardless of if I'm managing it with mocks or treating it as an integration no matter what so my tests look pretty similar.
But how do you know your fake version of the service is implemented correctly?
Keep it so simple it's unlikely to go wrong or add tests for it.
Real services have a ton of tiny things you might forget to model, restrictions on valid inputs, rate limits, etc
Like in general you should at the very least have the option to test against the real service once in a while, maybe not on every change. But at least in CI before a release etc
No of course for that you add tests for your fake service if you need that or you don't need it really. You'd tell your fake service to use the rate limit you want to test your code or whatever. I'm talking about in memory fakes for unit tests/groups of code.
Sure for unit tests you can stub out some stuff, but you just have to be careful the way you stub it actually matches the real service
Like say your stub accidently accepts negative values when the real service doesn't etc
The best option is if you can spinup a version of the service locally, but ofc that isn't always possible
Now that I think about it, I didn't have any walls when learning the language itself. My only problems are either solving problems or understanding what problem I have to solve.
i mean thats the only thing i had difficulty learning
since i came from scratch
And they don't run fast and don't tell me my code/business logic works correctly directly.
there was no such OOP in scratch π
Python was my first
Well it depends on how dependant your business logic is on the service
I think we are agreeing on the same thing. That is what the example for my system that interacts with github is doing. My system automates new projects. One of the steps is setting up github repos. I can't responsibility do that interaction in any of my tests (integration or unit). So I make an interface that doesn't have to change, mock the api calls to ensure they are being called with the right args, and dont touch it.
I've gone down the make a api proxy route too. Its perfectly valid way to test that interaction. Both apporaches have their own trade offs. I have even used both patterns in the same project for different reason.
This is ideal for integration/end to end tests and what I do for making sure the implementations actually work. Second best is spinning up a fake version of the service, third is very simplified interfaces to the service in your code with just what you need.
well when i was 10, i was taught scratch at school so i did a lot of stuff in it and got real good at scratch programming and then wanted to do some real programming so i started learning python
Ooh
my 2nd was c++ for programming arduino and microcontrollers
You don't need tests if you're confident on your own code π
/s
Oh God
I need to learn how to write tests for my Python code π
Tests are hard
rust has an advanced in built testing suite
#TeamRust
There are a few tools that came out of the tools like swagger/OpenAPI that can make proxies easy to spin up.
Good for Rust, but I'm not ready to start learning Rust.
#cfg(test) moment
running 1 test
test testings::larger_holds_small ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
How wonderful!
But I normally start with a dumb little extra flask app and trying to hold off on more complicated tool setups for as long as possible
hey Copilot, please backport PR 923 to the legacy branch
API response 400, there are no commits changed between my branch and main
π€¦ββοΈ
Absolutely no.
#[cfg(test)] not #cfg(test)
Go to a police station.
I haven't had to even think about implementing whole fakes yet besides for the discord API/gateway. The only application I've come close to is one for adapters needing to be tested with wiremock, and what I'm writing is basically an http reverse proxy so using stubbed responses are exactly right.
yeah i guess...
I'll be sure to update the joke next time
alr
<@&831776746206265384>
Thereβs no guessing
Phone numbers donβt give anything
And vigilantism also ends with the idiot getting himself shot
I'm curious what tools are you using to make the proxy with?
hi guys im new here
@tame hinge I made a super neat proxy server a super long time ago. Its been on my list of projects to resurrect it into a real life library.
For the discord API/gateway the tests are supposed to be abstracted and not know how it's setup, so I started off by just trying to get stuff working in memory and modifying class state. Like I'll have a method on the harness like send message, create user, etc and then it'll get sent through the discord bot clients message handlers. I'm doing it all in memory to start and plan to put a web framework on top to enable all the API stuff. It wasn't fully thought out what I wanted to do with it and it's not far along. Unless you meant what am I using to make the reverse proxy.
I used aiohttp and hexagonal architecture for the proxying logic.
a littel of both.
Also python's
Yea the ports and adapter pattern works really well for these kind of integrations. A lot of times I'll pair it with a factory to grab the right adapter.. Its not uncommon for me to have 4 types. The real api call, a test adapter, a dev adapter, and a null object. test and dev look really similar, but it allows me to work in one without messing the others up. Though sometimes they are a super duper different. test being more like a set of static mocks and dev turning into a proxy with some observability mixed in. With the right set of adapters ya will never need a mock in any of your tests :). But some people dont like this kind of test code being live in production π€·
I recommend you take a look at pytest, unittest is less intuitive imo
Do you think it would be a good exercise to make some tests for Hux?
for anything really
but yeah, sure. why not
But unittest is stdlib and less magical π I've seen pytest sneak into more and more new projects though still a valid choice
ik it's less magical, but overall I think that pytest is the most solid choice
I love unittest and you can combine both. I use it as a runner and sometimes use the fixtures with autouse on the classes for more control.
I just don't know anything about testing, but I know it's pretty important
you don't need with 1000 tests, you can start with a single one. this will ensure that function returns what you expect it to return
I would trust unittest with my life.
π«‘
If you're gonna push to main directly without having a CI to enforce it, it will become useless
unittest is just a bunch of useful functions. The test finders never seem to work for me out of the box though and thats annoying. But pytest overrides the core assert method in python. And that monky patch has caused me more headach than I would like in the past
CI?
I preffers the assert approach over the self.assertTrue self.assertFalse self.assertIsinstace etc...
haha the first test that I always write doesn't even test a application function. just expect(1+2).toEqual(2) -> wach it fail -> update 2 to 3. Just to make sure the pumbing working haha
me too
"make sure the plumbing works" is a test.
Continues integration. a process that runs automatically based on a condition.
Here for example, it would be useful to run the test suite on every PR
That's what I do when first setting up workflows on GitHub for testing, just importing the package and making sure it doesn't fail.
Oohhh
If the CI reports errors it will prevent you from merging defective code
hi new here
That's pretty cool
That is one huge benefits to pytest. It pushes ya to write tests that test only true and false. Apposed to using a huge collection of fancy matchers. Those get out of hand π
yo @raven urchin
tests aren't useful unless there's something that checks them
Yeah?
yo
same:)
They aren't all the useful unless they break either π
if I had to pick one first, unittest or pytest or both to learn the fastest, which one would you advocate for?
Obviously, obviously. Those sound really useful, I'm wondering how it works, might look into it later.
If you're gonna change the API intentionally, the tests would need to be modified as well
You have github actions for free
try GitHub actions
i hate systemd
Shouldn't I write the tests first?
oh boy, here we go again. why?
What did sysd do to u
what are you making exactly
Discord bot
start with a dummy test, and work on the CI
Then, have a branch rule to restrict you from pushing directly to main (yes, even with --force)
"Should I write this test?"
As one of my mentors says one of my mentors says
"write a test until it gets boring" π go ahead and test the plumbing until it gets boring π
tests and CI is okay for learning purpose I guess
if it's something big and you have plans of updating ur app with updates in future then definitely do
I'd say pytest
Oki
do it in any order than makes sense. I write the test 2nd all the time. I make sure to see it break at least once before I'm done though.
The only "tests" I write are snippets inside if name == main
Can you show me later how to do that? I have no electricity as of now.
ofc
how do you set that up? is this actions side or git side?
it's a github feature (other git hosting providers provides the same functionality, possibility under a different name)
i see
Yes it works
yes, goofball lol
oh.
Don't ping for tests.
sorry
Why would it not work..m
tbh, if only i knew. its just that nothing works
i need to : run my WM session, then when its ready the wallpaper daemon, and a DPI bypass tool
the wallpaper daemon runs but seems to run too soon so it doesnt apply
the DPI bypass tool ExecStart runs if i just run it explicitly but hangs on systemctl start
short answer is I dont think it matters since the first test you will write are pretty simple. Import outside function -> run fuction with parameters -> and check the result.
IMO pytest will read better and might be more intuitive, but the things you are interacting with in unittest are more core/building block-y than untitests. e.g. the unittest matchers are pretty much just functions that raise exceptions. But those are pretty small details when you are starting out, flip a coin π or better yet write a simple test in both and keep the one you like most
absolutely. Thank you.
systemd does have bugs (like any other software), it's just relatively rare to encounter it since it's such a core component in many distros
What happens if you ping @ everyone?
pings everyone on the server, no?
it won't ping and your message will be removed
I know I have tried it before. The bot sends you a message
I wonder why we remove the message π€
that's great
... so then why ask?
I wanted him to try it.
@turbid sigil I'd focus on only function that dont have side effects to start off with. e.g. functions that one provide a simple answer without knowing anything that is outside of it.
we removed it before replies because of the lemon ping incident. Since then it's been very effective at removing spam and rule breaking messages
Depending on your DE I think you can just stop running stuff from Systemd and run it through your DE/WM.
I use a lot of exec-once in Hyprland.
... don't. Come on now
In the Pygame server they ban you if you do that. Haven't tried though.
yeah i did start-at-startup "awww-daemon" and it has the same problem. only worked with spawn-sh-at-startup "awww-daemon && sleep 1 && awww restore", which is stupid.
lemon ping incident?
what does @ here even ping to
Then maybe it isn't really a systemd problem, but a that thing problem.
i dont want to use sleep as a way of timing
this is disgusting
if you have permissions, pings the people who can see the channel who are also active/online
mhm, makes sense. I understand what you are saying/what you mean by side effects.
If it works, it works.
I have OpenRGB with sleep too
@pseudo carbon hi
Sir lancebot is more fun to talk to but do that in #sir-lancebot-playground
So many channels in here
That's great, wait. I'll send you something you probably already know
How simple I should make my functions is kinda difficult for me to wrap my head around, so it's been good to experiment. For example, I made a byte reader, where I then had a decorator around it to transform the bytes into whatever format I wanted it to be in (xml, json, etc.)
but that turned out to be quite tedious, cause there were functions already there in libraries
I am still a bit lost there, where should there be side effects, and where there shouldn't be any
You sent it so quick lol
it's pinned in the channel
ah
thing this like
return a+b
Stay away from testing things like
function save_add(a,b):
result = a+b
with open('result', 'w') as f
f.write(a+b)
return result`
Saving the result to a file is an example of changing some state outside of your function. They require special and sometimes confusing to new people testing tools. Focusing on the kind of function like the first one will also help train you to make more functions that are easier to test by breaking down problems into more smaller functions.
In a span of 2 days, github sent roughly 40,000,000+ emails π€¦ββοΈ
π
It isn't possible to type something like: v1, v2, v3: float = 0.0, 0.0, 0.0?
uhh, it would have to be v1, v2, v3: float, float, float = 0.0, 0.0, 0.0 I think
hi guys
but yes, its possible.
i genuinely had a laugh when i heard somebody in a video say
"ai is taking programming"
#bot-commands message
Already tried and it isn't valid
Yeah I thought so
you dont need an annotation here anyways, float will be inferred here
and can just do v1 = v2 = v3 = 0.0
hi fella snakes
Inferred types don't make sense to me