#python-discussion

1 messages Β· Page 582 of 1

rare gazelle
#

no

swift sparrow
#

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

velvet trout
pallid garden
#

abc is abstract base class

wise imp
#

I meant more in terms of culture

#

long work hours, minimal pay?

craggy willow
swift sparrow
ashen jungle
#

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

wise imp
swift sparrow
rare gazelle
#

you can read this conv^ @velvet trout

#

!d typing.Final

velvet trout
#

One can use abc on a class to make its subclasses implement some contract methods (abstract methods) if not, abc class will error

edgy krakenBOT
#

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...
craggy willow
#

like, amongus and chess got popular because there was nothing else to play

jade robin
#

the pandemic was the best time to game

swift sparrow
# wise imp yes

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

ashen jungle
wise imp
velvet trout
ashen jungle
#

!d typing.final

edgy krakenBOT
#

@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...
velvet trout
#

Just used abc yesterday for BaseNumArgs

craggy willow
swift sparrow
#

there was a documentary about it

rare gazelle
#

Final goes for class variables that shouldn't be reassigned by subclasses, and they're also class variabbles

craggy willow
jade robin
#

the only gambit i know is opening my king side bishop pawn

rare gazelle
#

a normal class variabble is ClassVar

ashen jungle
velvet trout
swift sparrow
rare gazelle
velvet trout
#

I know

ashen jungle
#

i might watch it

swift sparrow
#

It's more about rivalries, but they bring up the boom that chess saw during those times

velvet trout
#

Among us was peak back then

wise imp
#

too high!

pallid garden
#

gotta aim for the stars

rare gazelle
#

Final is not to make it non subclassable

#

Final is to make the variable not edittable by subbclasses

ashen jungle
ashen jungle
rare gazelle
#

Final is used for class variables, not classes themselvse

#

i see

ashen jungle
#

i thought i was being careful with the cases but no

#

ty though

rare gazelle
#

np

wise imp
#

is the quote

craggy willow
pallid garden
#

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

rare gazelle
velvet trout
rare gazelle
#

only 1 salt die

silver plover
craggy willow
silver plover
#

I love that thumbnail.

wise imp
rare gazelle
velvet trout
craggy willow
#

now the word looks weird to me

#

i've seen it too much

silver plover
craggy willow
#

i didn't know it had a name

#

cool

ashen jungle
#

^

rare gazelle
#

billy created this page right now

#

using chatgpt

velvet trout
#

Like... Overloading meanings for same term ?

silver plover
pallid garden
#

tetris effect?

silver plover
#

I've been very busy

pallid garden
#

is there a distributed computing effect

#

whereby after you learn how a kube cluster works you begin to see everything in a microservices architecture

wise imp
craggy willow
#

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

rare gazelle
#

i know the game

craggy willow
rare gazelle
#

so that means... i do understand something?

ashen jungle
#

it includes the possibility that you might understand everything

rare gazelle
#

πŸ€”

ashen jungle
#

πŸ™ƒ

rare gazelle
#

perhaps i'm a genius

#

maybe

craggy willow
#

we're all maybe a genius

ashen jungle
#

i agree

wise imp
rare gazelle
#

😁

silver plover
wise imp
#

where blockchain btw

#

blockchain, more like blockpython

#

!pypi pyblock πŸ‘€

edgy krakenBOT
#

Reblocking analysis tools for correlated data

Released on <t:1583357885:D>.

wise imp
mighty bay
#

Are indians taking my job?

frosty oriole
#

they could

silver plover
halcyon fern
jade robin
#

pip install actor-fixer

#

sad

tame raptor
halcyon fern
#

!pypi cryptography

edgy krakenBOT
#

cryptography is a package which provides cryptographic recipes and primitives to Python developers.

Released on <t:1777935578:D>.

mighty bay
tight tree
#

that seems a tad racist

halcyon fern
jade robin
tame raptor
#

aight

#

mb

mighty bay
halcyon fern
tame raptor
#

rs

silver plover
#

Let's knock off the casual racism or whatever it is.

tame raptor
#

even tho i am an immigrant

frosty oriole
jade robin
#

as long as y'all allow travelling for trips, i don't particularly mind anti immigration

silver plover
#

People in lots of countries want jobs. Don't believe you're owed anything. Work hard, be prepared, and you'll make it.

mighty bay
tame raptor
#

unc on that preaching

jade robin
#

trolling pithink

mighty bay
silver plover
mighty bay
silver plover
#

Complaining about globalization is about 40 years too lates

swift sparrow
wise imp
tame raptor
#

if he formulates his sentences mor respectufully it is a conv for off topic

jade robin
tame raptor
#

dang hes gettin banned

hoary geode
#

hi guys

wise imp
#

hi

deep dome
#

Hello!!

raven urchin
raven urchin
raven urchin
ashen cipher
#

.topic

verbal wedgeBOT
#
**What reasons are you learning Python for?**

Suggest more topics here!

ashen cipher
#

yk what i dont like the topics tbh

what are yalls working on

pallid garden
#

a game

crisp jay
ashen cipher
ashen cipher
pallid garden
#

neither

ashen cipher
#

2.5d

pallid garden
#

pokemon-showdown-esque

ashen cipher
#

ic

crisp jay
ashen cipher
#

i can imagine

sour pulsar
raven urchin
#

guys do you have a good SQLite3 resource? video format if possible

pallid garden
#

you should get used to non-video-format resources

#

most resources wont be video format

raven urchin
wise imp
#

just chuck the non-video format to gen AI, get a video /s

raven urchin
charred tusk
#

goblins*

autumn kayak
#

Yo an indian guy took my job

brisk gazelle
radiant kernel
#

that damages the economy

#

and exacerbaits exploitation

#

assuming that this indian guy isn't a citizen

#

also assuming root isn't indian

wise imp
#

exacerbaits [sic!] more like ragebaits

autumn kayak
autumn kayak
#

that happens in europe

autumn kayak
wise imp
#

!pypi mesa

edgy krakenBOT
#

Agent-based modeling (ABM) in Python

Released on <t:1773574948:D>.

wise imp
#

anyone tried this for some fun side project?

ocean ridge
#

if an europeoan took your job would it be fine with you?

brittle merlin
silver plover
edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied warning to @autumn kayak.

quartz knoll
#

Guys what is your favourite feature in python 3.16?

runic flower
# wise imp anyone tried this for some fun side project?

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?

runic flower
quartz knoll
runic flower
# quartz knoll Why

cause that way it will have been released for 6 months or so and I might have an idea by then.

quartz knoll
#

What

runic flower
# quartz knoll What

3.15 will be released later this year, 3.16 will be released at the end of 2027. so ask me in 2028. πŸ™‚

pallid garden
runic flower
tight tree
#

The library I'm involved with got official 3.14 support about 15 hours ago

timber star
#

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?

hollow dawn
#

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

sacred cypress
hollow dawn
#

whats the difference between pip install virtualenv vs (python -m venv venv) or (pip install django)

#

Which is a better approach?

hollow dawn
#

oh ok2

#

i thought they are like different command of the same thing

pallid garden
#

pip is python's package management system

quartz fulcrum
#

can we create setter without @property decorator?

pallid garden
#

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

swift sparrow
#

anything you can do with a decorator you could technically do "the harder way"

quartz fulcrum
#

do i have to write the decorator by hand ??

swift sparrow
#

!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)
edgy krakenBOT
digital canyon
#

I just want to know that ai automation engineer is good role or not?

quartz fulcrum
#

oh ok..the traditional way

digital canyon
swift sparrow
pallid garden
#

this applies to literally any field

#

not just computing

swift sparrow
#

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

digital canyon
swift sparrow
#

"it's a leap of faith" -miles morales

pallid garden
#

do you get paid?

digital canyon
#

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

pallid garden
#

it's hard to get a job now, you might as well take it (assuming you are sure that it's not a scam)

swift sparrow
#

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?

digital canyon
swift sparrow
#

then what roadmap are you looking for?

#

have you worked in film before? Is this like a pipeline TD role?

digital canyon
#

No this is the first time in film production company

swift sparrow
#

what is the position title?

digital canyon
#

Ai automation engineer

proud escarp
#

maybe you'll be trained

floral terrace
inland karma
#

good morning!

proud escarp
#

good morning eivl

quartz fulcrum
#

good morning

digital canyon
swift sparrow
#

is there a role description?

digital canyon
#

Yes

swift sparrow
#

do you feel like you fit the description?

digital canyon
#

Means I have to look there internal crm also and other work right now I am doing is on n8n ,api integrations

ocean ridge
#

if you dont have experience using n8n or building infra and stuff like that idk if that job is for u

ocean ridge
swift sparrow
#

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.

ocean ridge
swift sparrow
#

everyone is trying to undercut each others' prices

ocean ridge
ocean ridge
bronze dragon
#

interesting

#

I'm kind of surprised that there are people out there who will pay $800 for a landing page especially in these times

quartz fulcrum
#
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)
ocean ridge
swift sparrow
bronze dragon
#

but yeah, maybe

#

it's still surprising

quartz fulcrum
bronze dragon
#

that's the problem?

#

str.lower?

swift sparrow
#

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

bronze dragon
swift sparrow
quartz fulcrum
swift sparrow
#

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

quartz fulcrum
#

which one should i refer?

#

but i didnt understand the project..what should i do then?

swift sparrow
#

I don't understand the project either and I'm experienced in python. The project doesn't make sense.

bronze dragon
edgy krakenBOT
#
Go-to beginner resources

Here are the top free resources we recommend for people who are new to programming:

For a full, curated list of educational resources we recommend, please see our resources page!

lost lagoon
#

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

swift sparrow
quartz fulcrum
swift sparrow
#

I don't really want anything to do with an AI generated project

lost lagoon
#

most python web framework use jinja templates??

bronze dragon
# quartz fulcrum which one should i refer?

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.

lost lagoon
#

Don't overthink the OOP part

opal gull
#

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

granite wyvern
# quartz fulcrum wait letme show you the project in help thread

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.

swift sparrow
granite wyvern
quartz fulcrum
granite wyvern
quartz fulcrum
#

should i skip it?

granite wyvern
quartz fulcrum
#

but the pics i have is not ai generated

granite wyvern
#

Whihc bit was AI generated?

quartz fulcrum
#

its the actual project from the course

granite wyvern
#

Oh. Hmm.

quartz fulcrum
#

the text written down

granite wyvern
#

Which course.

quartz fulcrum
#

oop

prime mountain
quartz fulcrum
granite wyvern
# quartz fulcrum but the pics i have is not ai generated

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.

quartz fulcrum
#

how am i going to write it

granite wyvern
#

Written a property before?

quartz fulcrum
#

yes

#
@property
def category(self):
  self.__class__.__name__.lower()```
granite wyvern
#

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?

granite wyvern
#

Oh, with a return

quartz fulcrum
#

__class__ tell which class self holds and name turns it into string right?

granite wyvern
#

So it would be:

@property
def category(self):
  return self.__class__.__name__.lower()
#

Yes, .__name__ is a string.

quartz fulcrum
#

will self.__name__.lower()
work?

granite wyvern
#

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.

quartz fulcrum
#

okay

granite wyvern
quartz fulcrum
#

i should give it a try....if i stuck i will ask for help here

swift sparrow
granite wyvern
inland karma
#

same as qualiffied name, only that is for the dotted name path

granite wyvern
mighty steppe
#

hi

inland karma
#

im not sure how the name lookup is actually implemented though.

haughty crane
#

how do you start learning networking

opal gull
ocean ridge
inland karma
#

implement http 1.1 from scratch using python

haughty crane
haughty crane
granite wyvern
# haughty crane how do you start learning networking

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

edgy krakenBOT
#
Resources

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

granite wyvern
inland karma
#

not meant that way,.. yeah it is a lot for sure

granite wyvern
#

Sorry, that was hyperbole - I knew you weren't actually being rude πŸ™‚

haughty crane
haughty crane
velvet trout
#

Hi chat

ocean ridge
steep elk
#

I used python to find the value for which cos(x)= x
0.739085133

#

Is it correct

pallid garden
#

yes

granite wyvern
#

!e

from math import cos
x = 0.739085133
print(x, cos(x))
edgy krakenBOT
granite wyvern
pallid garden
steep elk
#

Sorry

steep elk
granite wyvern
# steep elk Sorry

No need to apologise. But pointing out that you can test this kind of question!

steep elk
#

I realised that you can run a loop that takes Cosine of any no till a certain time

granite wyvern
#

That works. A bisection might be faster.

steep elk
#

Bisecton?

arctic plank
#

Hi

steep elk
#

Hello

#

Is it related to Calculus

arctic plank
#

How u doing

steep elk
granite wyvern
#

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.

steep elk
#

Newton's method?

granite wyvern
# steep elk We've not yet been taught

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.

granite wyvern
steep elk
#

Ok I'll write a program

granite wyvern
#

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β€²,...

bright mauve
bright mauve
#

hmm you can replace that with simply having positive and negative values if your function is continuous

teal ember
#

decided to make a clicker game because i am bored and will try to learn how to make one as i make it

stable kraken
#

what yall think about ai coding stuff

slender urchin
#

it can be a useful tool when used responsibly

bright mauve
#

don't ai and drive

stable kraken
#

i was talking about the ai replacing coders thingy]

wise yarrow
#

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

wise yarrow
#

relevant theorem is the banach fixed point theorem

#

!e

from math import cos
x = 0
for _ in range(30):
    x = cos(x)
print(x)
edgy krakenBOT
pallid garden
#

oh wow, interesting

hallow umbra
#

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 βœ…

slender urchin
#

Good luck :3

hallow umbra
dry pike
#

banach of banach-tarski paradox?

#

which is weird because I don't remember what the banach-tarski paradox is, just the name of it...

wise yarrow
#

yeah same guy

stable kraken
#

will i get crucified if i talk about c++ here

jade robin
#

TIL they have a paradox but i know tarski has a fixed point theorem too

wise yarrow
#

banach tarski is the one where you can turn one ball into two balls

jade robin
#

oh

gleaming knoll
jade robin
#

python is slow c++ is fast

stable kraken
#

thats true tho

craggy willow
#

no u

granite wyvern
dry pike
#

python is fast, c++ slow

stable kraken
#

python is fast, c++ slow

golden mortar
#

python is c++, fast is slow

craggy willow
#

!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)
edgy krakenBOT
teal ember
#

honestly making a clicker game is fun

slender urchin
#

i love playing them

#

but it's been a while since i tried one

median pine
white knot
#

hi

craggy trench
unreal vigil
craggy willow
#

from the discussion above

craggy trench
#

oh

#

well i learned something today

prime mountain
#

Where may I request the moderators to reopen a thread that was closed due to inactivity?

craggy willow
#

a help thread?

#

they can't reopen it, but you can open a new one

prime mountain
#

Yes. I was unable to do what I was adviced to do the day before and yesterday due to personal issues

autumn forge
#

you could link to your old help thread in a new one

prime mountain
#

Okay

velvet trout
#

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?

bronze dragon
#

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

velvet trout
bronze dragon
#

For one thing, this behavior means that simply adding new options can break old scripts.

velvet trout
#

Oh yeah, that's a potential bug awaiting to happen on new names being added

#

i will drop adding support for this

wise yarrow
#

I would prefer for some form of completions support instead

velvet trout
#

Agreed, that would be helpful

slow rivet
#

explicit alias are a good feature, especially short forms -r for --run etc

velvet trout
#

real

devout scaffold
#

can i ragebaiting by posting C++

opal gull
#

you can try

fiery yarrow
#

...in one of the off-topic channels

opal gull
#

but what if its python-related C++ code

#

or c++-related python code

#

πŸ€”

velvet trout
#

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

gleaming knoll
velvet trout
#

And those tricks make it less readable and no one likes that format, whereas Python's readability++

celest osprey
#

not really a trick tho

velvet trout
#

Honestly, if Python was named readability++, i wouldn't have minded.

velvet trout
gleaming knoll
#

people really often need to write a hello world program so the overhead of writing an entrypoint function is so big
very real

velvet trout
#

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.

velvet trout
velvet trout
bronze dragon
#

you can think of puts/gets as counterparts

velvet trout
#

Look at this

print("Hello, world!")

Even a baby can read and tell what this will do

opal gull
#
#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

edgy krakenBOT
#

Hey @opal gull!

Please edit your message to use a code block

Add a py after the three backticks.

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
bronze dragon
#

although the C standard library has never been that great at function naming

opal gull
#

what are you talking about bot

velvet trout
#

Code language missing?

opal gull
#

idk what language to put

velvet trout
#

cpp

C python plus

#

idk

gleaming knoll
chrome isle
#

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

velvet trout
bronze dragon
velvet trout
#

fgets? formatted get string?

gleaming knoll
#

the f stands for file, you provide the file to get the string from as the first argument

velvet trout
#

fgets reminds me fget from property

gleaming knoll
#

im trying to make firefox reload userContent.css that has local file imports on changes and im close to git comitting sudoku

bronze dragon
gleaming knoll
velvet trout
gleaming knoll
velvet trout
#

and even in that, puts()

and whatnot abbreviations

#

you just can't beat the elegance of Python's

Lol

opal gull
#

what about Go

autumn forge
velvet trout
#

No matter what you do, bring Rust, bring Nim, you just can't. Can't replace Python.

autumn forge
#

I must defend puts() because that's what Ruby calls it

gleaming knoll
velvet trout
#

They see terminal and goes HACKERRRRR

velvet trout
opal gull
#

but i believe its fine

velvet trout
bronze dragon
gleaming knoll
#

do people in stockholm still call it stockholm syndrome

velvet trout
opal gull
velvet trout
#

Ok there's an issue

#

I don't usually use -c tbh

opal gull
#

bash is even more readable, elegant, and concise

slender urchin
#

I would not call bash elegant

velvet trout
bronze dragon
gleaming knoll
velvet trout
#

\n

gleaming knoll
#

the 1 line for the include is such a big problem in real cases
very important for the world

opal gull
velvet trout
#

its still unreadable, \nputs looks awful and seems like someone's cursing you

autumn forge
gleaming knoll
slow rivet
#

and even ignore that, how many real programs actually use stdout and stdin directly

bright mauve
#

c, the quintessential outbedded development language

velvet trout
bronze dragon
#

just ragebaiting atp

velvet trout
#

finally someone understood

velvet trout
gleaming knoll
#

all people who ragebait should be banned

velvet trout
#

Y'all fell for it πŸ˜”

gleaming knoll
velvet trout
slender urchin
bronze dragon
#

is that so? trolling has been part of the internet forever

gleaming knoll
#

i sitll cant hot reload usercontent.css imports

slow rivet
# velvet trout This is way readable, less words and quickly understandable, whereas that c++ on...

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)])
gleaming knoll
#

fuck modern browsers i DONT CARE about seucirty

velvet trout
#

Why would i be banned, it was all on-topic and i preached Python and its elegance with well-versed arguments

bronze dragon
#

people are way more comfortable admitting to "ragebaiting" than "trolling" though

autumn forge
bronze dragon
#

@gleaming knoll consider forking Stylus and using native messaging to let it load/reload files from disk

crystal burrow
#

Print (β€œHello World”)

velvet trout
#

The ragebaiting is already finished bro, you're late

gleaming knoll
slender urchin
#

immediatly jump to tailwind

bronze dragon
#

lambda about to reinvent Dark Reader

turbid sigil
#

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.

slender urchin
#

Started with school and then learned more at work

gleaming knoll
#

ok it works now
i just vibecoded the reload script

turbid sigil
#

nice

gleaming knoll
slow rivet
gleaming knoll
#

choichen? = chosen?

slender urchin
#

mdn is great

turbid sigil
#

what is choichen? lol

slow rivet
gleaming knoll
#

is viv using voice input
with a heavy norvegian accent

bronze dragon
#

"choice in"?

turbid sigil
#

I have used mdn before to learn html. It was enjoyable

slow rivet
#

✨ dyslexia ✨

turbid sigil
#

then I tried to parse through a webpage, to do web scraping, and it was div hell

gleaming knoll
#

i wonder how dyslexia works on keyboard text input
like surely its some different brain part than reading

turbid sigil
#

the whole mdn course was like "be semantic when making your HTML web pages", then its a nonsemantic mess outside of it

slow rivet
slender urchin
slow rivet
#

or can be is more correct to say, it varies between people

#

I dont have much issues with reading, for me its mostly spelling

turbid sigil
gleaming knoll
smoky cedar
#

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.

turbid sigil
smoky cedar
quasi umbra
#

hey

quasi umbra
#

anybody here knows hwo to use cheat engine?

#

or make a good ui, i wanna learn

slow rivet
turbid sigil
#

mmm, I see

slender urchin
quasi umbra
steel whale
quasi umbra
steel whale
#

no never dealt with it

slow rivet
# turbid sigil mmm, I see

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.

quasi umbra
turbid sigil
slow rivet
#

like in big companies the people designing the page arent the people implementating it, but for hobby projects you will be doing both, etc

steel whale
steel whale
pastel sluice
quasi umbra
pastel sluice
#

the Discord client, for instance, is one such app

turbid sigil
#

mmm, ok

slow rivet
#

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

steel whale
slow rivet
#

I personally find immediate mode frameworks really neat

gleaming knoll
turbid sigil
#

hobbiest? hobbist?

#

idk lol

slow rivet
#

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

turbid sigil
#

πŸ‘

gleaming knoll
steel whale
turbid sigil
#

sorry for going off topic. Thank you all for your patience

quasi umbra
velvet trout
#

.topic

verbal wedgeBOT
#
**What is your process when you decide to start a project in Python?**

Suggest more topics here!

velvet trout
#

"is this thing even possible to be implemented by me or should i give up already."

pastel sluice
#

Figure out the data design, as everything else stems from that. Then look for suitable third party libraries to aid with the project.

bright mauve
#

grab a notebook and doodle

turbid sigil
#

develop use cases, diagram a dummy system, then program from requirements.

smoky cedar
#

@quasi umbra

turbid sigil
#

uhh, also system sequence diagrams, and domain models

#

those help a lot

quasi umbra
smoky cedar
#

you okay with it?

bronze dragon
# verbal wedge

pick a small component of it that's easy to iterate and test on, and try implementing that

quasi umbra
turbid sigil
#

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

last ginkgo
bright mauve
#

me when i exterminate 10% of all marine life by spending 10 trillion tokens and 5 hours on claude code

native coyote
#

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

brisk gazelle
#

Avoid AI. Ask us.

bright mauve
#

the more you struggle with it, the more it sticks tbh

brisk gazelle
#

!beginner

edgy krakenBOT
#
Go-to beginner resources

Here are the top free resources we recommend for people who are new to programming:

For a full, curated list of educational resources we recommend, please see our resources page!

brisk gazelle
#

Consult documentation.

native coyote
#

Okay

#

so instead of asking gemini for hints I should look at the offical python documentation and try to figure it out from there

golden mortar
native coyote
#

ok

golden mortar
native coyote
bright mauve
#

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

bronze dragon
pastel sluice
bronze dragon
#

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.

native coyote
wise imp
brittle merlin
#

Wordle 1795 2/6

🟩⬜🟨⬜🟨
🟩🟩🟩🟩🟩

#

I'm so dope boy

craggy trench
#

pydsn wordle

hexed grotto
#

can someone explain for me arrays and linked lists

brisk gazelle
# hexed grotto 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

hexed grotto
#

like dictionary

tame hinge
# turbid sigil has anyone here done "behavioral driven development"?

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.

https://dannorth.net/blog/introducing-bdd/

brisk gazelle
# hexed grotto like dictionary

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

jade robin
#

Binary Descision Diagrams

hexed grotto
#

ooooh thank you for your time

tacit frigate
#

hi

tame hinge
# charred tusk 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.

rotund moon
#

as an as

brisk gazelle
#

Whatever happened to the Ghurkult?

charred tusk
#

They're still alive

brisk gazelle
#

Hm.

charred tusk
#

... maybe
I can't find them in my server list

#

Found them

cerulean ravine
#

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.

silver plover
#

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)

glad egret
#

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 πŸ™

tame hinge
# silver plover This is more or less how I work. End to end tests are more important than unit t...

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.

tame hinge
tame hinge
turbid sigil
glad egret
#

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.

turbid sigil
glad egret
#

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
turbid sigil
#

ok

prime mountain
#

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

glad egret
#

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

tame hinge
# glad egret I popped in kind of 1/2 way into the conversation, but for context BDD usually ...

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/

turbid sigil
#

I see. ok. That makes sense.

tame hinge
glad egret
charred tusk
#

I was summoned by mention of devops

turbid sigil
#

The cult of observability welcomes you

charred tusk
#

Oh no
I made a legacy branch of my application
And now I have to backport PRs
IDK how to do this πŸ™ˆ

turbid sigil
#

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

glad egret
golden mortar
#

e2e black box tests don't quite have the same issue

turbid sigil
glad egret
tame hinge
glad egret
# golden mortar I think too many unit tests can be problematic too. They kind of coagulate your ...

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.

turbid sigil
#

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.

tame hinge
# glad egret I'm a super fan of the ago old idea of listening to your tests. A test that is ...

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.

tame hinge
# glad egret One of the things the BDD community realized pretty early was that combining the...

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")
gleaming knoll
#

how did d end up here

glad egret
fresh pawn
#

Hi guys i am yamen recently I launched my first app on Google play it call "taskflow " please guys can u download it

turbid sigil
#

I see. I got the idea from the fowler article he has on the pattern.

turbid sigil
#

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

turbid sigil
bronze dragon
edgy krakenBOT
#

6. Do not post unapproved advertising.

bronze dragon
fresh pawn
golden mortar
turbid sigil
golden mortar
turbid sigil
#

πŸ‘

fresh pawn
#

Well, do any of you know where I can post
my app?

terse mauve
ashen jungle
#

sorry i'm replying a day late lol i had to leave quickly

turbid sigil
#

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 😁

ashen jungle
#

i'll take that as a compliment though :p

fresh pawn
prime mountain
ashen jungle
terse mauve
fresh pawn
terse mauve
terse mauve
prime mountain
runic flower
# fresh pawn No

You know this is a python discussion channel on a python server?

turbid sigil
terse mauve
prime mountain
#

Oh

ashen jungle
#

@prime mountain it depends what comes after the shebang

prime mountain
#

Oh

terse mauve
#

you could have:

#!/bin/bash
#!/bin/env bash
#!/bin/perl

etc etc
prime mountain
#

Where do I learn more about this?

ashen jungle
#

possibly here

prime mountain
#

#!/usr/bin/env bash source /home/atreus/Scripts/.venv/bin/activate python3 /home/atreus/Scripts/ccwd.py deactivate

terse mauve
gleaming knoll
#

ok i can see why people go for nixos

harsh swallow
# prime mountain Bash I believe. Starting with #! ?

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.

terse mauve
gleaming knoll
prime mountain
terse mauve
prime mountain
#

internet edition

rugged barn
#

But by God managing the dotfiles become a chore

harsh swallow
rugged barn
#

But it beats having to reinstall everything all the time

gleaming knoll
#

not some global state mess edited by god knows what scripts ran in god knows what order

turbid sigil
#

they have a few chapters on shell scripting there. They were fun to read.

terse mauve
glad egret
# tame hinge I think that some types of tests are more brittle than others and not a good ide...

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.

terse mauve
ashen jungle
#

i don't think shebangs are the first thing someone learning python for the first time should have to learn

crisp jay
#

You need the -S flag

turbid sigil
#

yeah, what is your usecase for learning scripting?

terse mauve
ashen jungle
#

yes

crisp jay
terse mauve
prime mountain
terse mauve
prime mountain
#

Anyways, thanks

turbid sigil
turbid sigil
#

automate the boring stuff

terse mauve
prime mountain
#

Yeah

crisp jay
#
#!/usr/bin/env -S bash --norc
output=( $(mpstat --dec=0 1 1) )
cpu_usage=$((100-${output[-1]}))
echo $cpu_usage

Like this for example

glad egret
hexed grotto
#

hi!

turbid sigil
#

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

raven urchin
#

Hi Pydis

prime mountain
glad egret
#

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

prime mountain
#

Also I like computers in general so it's a personal interest

turbid sigil
#

πŸ‘

tame hinge
# glad egret The testability of the code as a whole is greatly influence on where and how you...

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.

tame hinge
prime mountain
raven urchin
prime mountain
#

Oh okay πŸ˜†

knotty ice
glad egret
knotty ice
#

learning python dam its so demotivating rn

raven urchin
hot lark
#

hello

raven urchin
hot lark
#

how are you bro?

ocean ridge
harsh anchor
tame hinge
# glad egret I was talking about the repository pattern. I used Github as an example for whe...

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.

rapid pond
glad egret
# tame hinge Take for example there's some registration and login code, you need to register ...

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.

slow rivet
tame hinge
slow rivet
#

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

tame hinge
slow rivet
#

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

raven urchin
# ocean ridge my "wall" was OOP concepts

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.

ocean ridge
#

since i came from scratch

tame hinge
ocean ridge
#

there was no such OOP in scratch πŸ™ƒ

raven urchin
slow rivet
glad egret
# tame hinge If we're talking about an interface to GitHub or something and wanting to be abl...

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.

tame hinge
ocean ridge
# raven urchin Python was my first

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

raven urchin
#

Ooh

ocean ridge
#

my 2nd was c++ for programming arduino and microcontrollers

rugged barn
#

You don't need tests if you're confident on your own code πŸ‘
/s

raven urchin
#

Tests are hard

ocean ridge
#

#TeamRust

glad egret
raven urchin
rugged barn
#

#cfg(test) moment

ocean ridge
# rugged barn `#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!

glad egret
charred tusk
#

hey Copilot, please backport PR 923 to the legacy branch

API response 400, there are no commits changed between my branch and main
πŸ€¦β€β™€οΈ

raven urchin
#

Absolutely no.

ocean ridge
raven urchin
#

Go to a police station.

tame hinge
surreal summit
rugged barn
ocean ridge
charred tusk
#

<@&831776746206265384>

charred tusk
glad egret
tawdry bolt
#

hi guys im new here

glad egret
#

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

tame hinge
#

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.

tame hinge
terse mauve
glad egret
# tame hinge For the discord API/gateway the tests are supposed to be abstracted and not know...

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 🀷

terse mauve
raven urchin
terse mauve
glad egret
terse mauve
tame hinge
raven urchin
terse mauve
tame hinge
terse mauve
glad egret
terse mauve
glad egret
cerulean ravine
terse mauve
# raven urchin CI?

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

tame hinge
terse mauve
brittle merlin
glad egret
brittle merlin
#

yo @raven urchin

terse mauve
raven urchin
brittle merlin
#

yo

glad egret
turbid sigil
#

if I had to pick one first, unittest or pytest or both to learn the fastest, which one would you advocate for?

raven urchin
terse mauve
terse mauve
gleaming knoll
#

i hate systemd

raven urchin
terse mauve
raven urchin
brittle merlin
raven urchin
terse mauve
terse mauve
glad egret
#

"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 πŸ™‚

brittle merlin
# raven urchin Discord bot

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

raven urchin
glad egret
brittle merlin
#

The only "tests" I write are snippets inside if name == main

raven urchin
brittle merlin
terse mauve
brittle merlin
#

i see

tawdry bolt
#

alright bro..

#

<@&831776746206265384> guys does this ping works just testing

naive ermine
#

Yes it works

turbid sigil
#

yes, goofball lol

tawdry bolt
#

oh.

naive ermine
#

Don't ping for tests.

tawdry bolt
#

sorry

raven urchin
#

Why would it not work..m

gleaming knoll
# terse mauve oh boy, here we go again. why?

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

glad egret
# turbid sigil if I had to pick one first, unittest or pytest or both to learn the fastest, whi...

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

terse mauve
frigid trout
#

What happens if you ping @ everyone?

terse mauve
grave tree
frigid trout
spice hill
terse mauve
grave tree
frigid trout
glad egret
#

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

grave tree
raven urchin
grave tree
frigid trout
#

In the Pygame server they ban you if you do that. Haven't tried though.

gleaming knoll
glass shoal
#

what does @ here even ping to

raven urchin
gleaming knoll
grave tree
turbid sigil
raven urchin
#

I have OpenRGB with sleep too

tawdry bolt
#

@pseudo carbon hi

frigid trout
tawdry bolt
terse mauve
turbid sigil
#

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

turbid sigil
#

I am still a bit lost there, where should there be side effects, and where there shouldn't be any

grave tree
terse mauve
turbid sigil
#

or wait, it would be an adaptor, not a wrapper/decorator

#

my bad

glad egret
# turbid sigil mhm, makes sense. I understand what you are saying/what you mean by side effects...

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.

terse mauve
velvet holly
#

It isn't possible to type something like: v1, v2, v3: float = 0.0, 0.0, 0.0?

turbid sigil
#

uhh, it would have to be v1, v2, v3: float, float, float = 0.0, 0.0, 0.0 I think

quasi umbra
#

hi guys

turbid sigil
#

but yes, its possible.

quasi umbra
#

i genuinely had a laugh when i heard somebody in a video say

#

"ai is taking programming"

velvet holly
gleaming knoll
#

you dont need an annotation here anyways, float will be inferred here
and can just do v1 = v2 = v3 = 0.0

clear crystal
#

hi fella snakes

velvet holly