#python-discussion

1 messages · Page 229 of 1

dry pike
#

imagine your 9to5 is being a superhero

#

and you have to hang up your superpowers at the end of your shift

charred tusk
viral nymph
#

you guys know that feeling when you made your own programm and it finally works and you feel like you just invented science

dry pike
#

noep

dusty pier
#

hai guys morning, anybody knows free hosting for cloud computing? i want deploy machine learning model but try at cloud free first

charred tusk
#

I got on a Teams call today with people in a different country in a different language and saved their day

#

Completely different company, a subcontractor of another division of my client

#

But they knew me by name

viral nymph
#

alr ill go work on my flask server

silver plover
charred tusk
dry pike
#

they knew your name was 🐺🌈

charred tusk
silver plover
charred tusk
spice hill
warped sigil
weak jasper
#

Currently I don't have a goal 😅 but I want to take up python as a hobby
Ohkk I'll try to build toy projects can you give some examples for that?

cyan palm
#

Hey, i want Api keys to create an Ai assistant, can anyone tell me which best free API i could get for thinking, listening and speaking?

#

guys?

pallid garden
#

can you break down your question

cyan palm
#

ohh ok..ok

cyan palm
pallid garden
#

yea, you can also just use that

cyan palm
warm field
#

@weak jasper Hmm I started with Rom hacking gameboy advance games. or a text editor so I could make an arm asm editor

charred tusk
#

We can’t always use the same one

vital haven
#

hi

vagrant horizon
#

Satire obviously

warped sigil
#

like actually how is this not all a bad dream

slate heath
#

can someone tell me is it worth it to learn python from youtube? or i should buy an online course

half pewter
runic flower
granite wyvern
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.

dusty pier
half pewter
velvet hull
half pewter
#

I like their payment structure though, you wont end up spending much on normal usage, training an LLM would be costly. I doubt the $400 free credits would even cover it. Really will depend on how expensive your model is.

#

why did I think it would be okay to start another factori⚙️ run, when I'm supposed to be studying

#

I wonder if a shop that made a poster of your actual factory would make profit

white knot
#

every POST api endpoint must have something like a token?

slate heath
white knot
frosty oriole
white knot
#

ah its a POST request that allows a user to update their profiles. i don't think that should be made public then...

#

even though the user id is like 32 character long and i get it from the current session user

fathom vortex
#

are you using flask?

white knot
#

but this particular request am making to a python backend with flask

#

my frontend has auth with supabase

fathom vortex
#

i mean, your POST endpoint would be public if its exposed to the internet by any means

white knot
# fathom vortex i mean, your POST endpoint would be public if its exposed to the internet by any...

ye thats what am thinking but. the POST request is like this

⁨⁨⁨```js
const { data: { user } } = await supabase.auth.getUser();
const user_id = user.id;

const reponse = await fetch("http://localhost:3000/api/update_profile", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    user_id: user_id,
    leetcodename: leetcodename,
  }),
});```⁩⁩⁩

see the userid i get is from getUser() which gets 32 character userid from the current session
i was thinking whether this was safe

robust ledge
#

Anything you want secured needs an authorization and authentication flow to grant an access exception into it. The default should be to deny access. ((assuming your gateway is public facing))

fathom vortex
#

oh, if its only on localhost, i think you're fine

fathom vortex
white knot
fathom vortex
#

you can't keep the javascript backend and the python backend separately in this case

white knot
#

ah i think would need to make something better in the backend than just checking whether the user with that userid exist in the db

harsh tree
#

I wanaa to learn numpy, pandas, matpolit in a quick good way.
And i was wondering Is there a specific book for that ?

swift sparrow
snow moon
#

How to learn and understand python

swift sparrow
#

.rp numpy

verbal wedgeBOT
#

Here are the top 5 results:

NumPy Tutorial: Your First Steps Into Data Science in Python
NumPy's max() and maximum(): Find Extreme Values in Arrays
Using the NumPy Random Number Generator
Look Ma, No for Loops: Array Programming With NumPy
NumPy Practical Examples: Useful Techniques
harsh tree
swift sparrow
harsh tree
snow moon
#

No thanks

fathom vortex
runic crystal
#

can one help me understand how to install something to run an automation in a pc game ?

white knot
#

am just new to this, trying jwt for first time

fathom vortex
#

i mean you can send the jwt token to the python backend and do the updates there but essentially, that also means that any user with a valid jwt can directly talk to your python api

vapid tusk
#

YAll anyone know how can I turn my tablet into windows

white knot
#

hm but isnt that much safer than what am doing now like sending user id in the request body.
and this token it refreshes right

#

so jwt is not safe either?

fathom vortex
fathom vortex
vapid tusk
fathom vortex
#

if you want that only your js backend talks to python backend, you need a dedicated auth mechanism between them, such as mTLS

fathom vortex
white knot
fathom vortex
#

oh, then sure, use the jwt token

white knot
#

so after supabase auth, the frontend calls this python endpoint

fathom vortex
#

that's exactly how you're supposed to do it

white knot
#

to make profiles

fathom vortex
#

authenticate the jwt token w supabase admin sdk

white knot
#

ok i will do that now, thanks

leaden plinth
#

hi

#

what is *args and **kwargs?

swift sparrow
leaden plinth
#

yeah

swift sparrow
#

the name args isn't necessarily important (although commonly used). What's important is the * before the name

#

it allows unlimited positional arguments in a function

#
def foo(x, y):
#

for example if I defined this function, it must receive exactly 2 arguments to be called

#

foo(5, 10) to call it for example

#
def foo(*args):
#

if I define a function like this, it can be called with any number of arguments

#
foo(5)
foo(1, 2, 3)
foo(1, 10, 100, 1000, 10000, 1000000)
#

these would all be valid

leaden plinth
#

is that what args is?

swift sparrow
#

!e

def foo(*args):
    print(args)


foo(1, 10, 100, 1000)
edgy krakenBOT
swift sparrow
#

if I were to print out args, it's a tuple of the arguments received when the function was called

leaden plinth
swift sparrow
#

print is actually a good example of this in action

forest atlas
leaden plinth
#

oh mb

#

i dont understand techninal vocab

forest atlas
#

**kwargs is the same but with the = things

swift sparrow
#

if you look at print, it works with unlimited arguments

#

I can print 1 thing, or 5 things, or 5000 things

#

!e

print('a')
print('a', 'b', 'c')
edgy krakenBOT
leaden plinth
#

oh cool

swift sparrow
#

kwargs is similar, but the kw stands for "keyword"

#

so it allows you to provide extra keyword arguments that the function didn't otherwise have

#

the result will be a dict

#

!e

def bar(**kwargs):
    print(kwargs)


bar(foo='bar', hello='world')
edgy krakenBOT
leaden plinth
#

but say you want to:


def add(*args):
  # Make a way to add all the args?

#

so uh

hasty island
#

(assuming everything passed in is numeric)

def add(*args):
    res = 0
    for i in args:
        res += i
    return res 
swift sparrow
#

or even just simply sum(args)

leaden plinth
#
def add(*n1):
  return sum(n1, n1)

theoretically can run?

swift sparrow
#

how do you think you would call that function?

marsh glen
#

Yo wassup

leaden plinth
#

print(add(1, 3, 5))
#

oh wait.

eager smelt
#

you should try it out

hasty island
marsh glen
#

I'm learning python

swift sparrow
marsh glen
#

I'm at strings

leaden plinth
#

oh i forgor

swift sparrow
leaden plinth
#

check now

#

can it work?

swift sparrow
#

and it has to be beyond any other positional args

swift sparrow
leaden plinth
#

o

#

well that sucks

swift sparrow
#

!e

def foo(*args):
    return sum(args)


print(foo(10, 20, 30))
print(foo(1, 2, 3, 4))
edgy krakenBOT
swift sparrow
leaden plinth
#

oh wait

#

oh i think i get it now

swift sparrow
#
def foo(a, b, *c):
    ...
#

this is good

#
def foo(a, *b, c):
    ...
leaden plinth
swift sparrow
#

this is not

leaden plinth
#

oh

#

*args need to be at end?

swift sparrow
#

for positional, yes

#

any arguments after the * argument can be keyword only

#
foo(1, 2, 3, 4, c=5)
#

I could call it like this

#

a is 1
b is (2, 3, 4)
c is 5

#

have you seen sep and end in print before?

leaden plinth
#

sep no

swift sparrow
#

that's exactly how it would have been defined

leaden plinth
#

end yes

swift sparrow
#

you can only use sep and end as keyword arguments

leaden plinth
#

meaning?

swift sparrow
#

!e

print('a', 'b', 'c')
print('a', 'b', 'c', sep='|')
print('a', 'b', 'c', sep='...')
edgy krakenBOT
swift sparrow
#

if I want to use sep, I have to type sep=

leaden plinth
#

sep = seperator

swift sparrow
#

yeah

leaden plinth
#

kewl

swift sparrow
#

by default, print adds a space between arguments that it displays

#

but we can override it

leaden plinth
#

end?

swift sparrow
#

by default, print adds a newline afterwards. We can change end to use something else

leaden plinth
#

so

swift sparrow
#
print('a')
print('b')
print('c')

# a
# b
# c
#

each print goes onto its own line by default

#

!e

print('a', end='')
print('b', end='')
print('c', end='')
edgy krakenBOT
leaden plinth
#

oh wow

swift sparrow
#

this prevents print from adding a newline

#

but yeah I couldn't just do

print('a', '')
leaden plinth
#

meanwhile other langs have 2 different print functions 😭

swift sparrow
#

it would have no way of knowing that '' is meant to be the end

swift sparrow
#

but when using *args, it has no way to differentiate what is meant to be the "end" and what is just an extra argument

#

that's why anything after args would be keyword only

leaden plinth
#

so **kwargs?

swift sparrow
#
def print(*args, sep=' ', end='\n'):
#

the definition of print would look something like this

swift sparrow
leaden plinth
#

do u have to put the end in \n

print("Hi\n")

print("Hello!")

"""
Hi

Hello!

"""

swift sparrow
#

no, it's the default

leaden plinth
#

or r u doing it for neatability

swift sparrow
#

do you understand what default values are in functions?

leaden plinth
#

ohh

weak jasper
#

Tell me the best resource from where I can restart learning python.

visual juniper
#

also what do you mean by "restart"

weak jasper
frail stirrup
#

same

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.

visual juniper
weak jasper
weak jasper
rustic needle
#

Codestyle question:

What do you think of refurb rule 118 that suggest this code change:

sorted_items = sorted(stuff, key=lambda x: x[0])

sorted_items = sorted(stuff, key=operator.itemgetter(0))
swift sparrow
#

I'd be fine with either tbh

bronze dragon
rustic needle
#

In this case I would argue the lambda is simpler code. (albeit slower, if that matters)

#

I'm more exchanging:

lambda x, y: x+y
operator.add
gilded wolf
#

hii guys if someone could tell me the resource for learning numpy
i am in a learning phase so i want something which is more explanatory

swift sparrow
#

I always recommend realpython as an intro to new libraries

#

.rp numpy

verbal wedgeBOT
#

Here are the top 5 results:

NumPy Tutorial: Your First Steps Into Data Science in Python
NumPy's max() and maximum(): Find Extreme Values in Arrays
Using the NumPy Random Number Generator
Look Ma, No for Loops: Array Programming With NumPy
NumPy Practical Examples: Useful Techniques
karmic idol
swift sparrow
karmic idol
#

Maybe books if they arent too large

swift sparrow
#

For books, I think Automate The Boring Stuff is a great intro to python

inland karma
#

good morning!

visual juniper
swift sparrow
#

it's a whole language, there's going to be a lot to cover

karmic idol
#

Sorry my internet is slow so this msg duplicated

bronze dragon
#

AtBS isn't nearly as comprehensive as learncpp
but it should be a good introduction

inland karma
#

and a byte of python is also nice to add on the side to anyone that have prvious language experience

granite wyvern
# karmic idol I see

And don't over think it. Pick something. Run with it unless you hate it.

At some point you'll have all the basic stuff down fine (variables, types, if, loops and classes) and you will just pick and choose where you go from there.

visual juniper
#

if you know C++ , you can pick up python , at least the basics and an introduction of most topics, in like 2-3 days

karmic idol
#

Thanks much guys🙂

prisma dove
#

What percent of people do y'all think cheat on technical interivews?

inland karma
#

thats not a question you can really measure

prisma dove
#

I can say at least 60%

inland karma
#

if there are developers on a technical interview, you will not get away with lying

prisma dove
#

(For online assessments)

inland karma
#

so anyone doing those interview as a developer would say that nobody lies

#

and a non developer interviewer, how would he know that someone is lying, so i think he cant measure that

prisma dove
#

yeah its harder to tell in live interviews

#

for online assessments you can easily get a lower bound

visual juniper
inland karma
#

and my experience developers think they are worse than they are

prisma dove
inland karma
#

so they tend to do the opposite than lying

inland karma
visual juniper
prisma dove
#

I meant online assessments

visual juniper
#

oh

prisma dove
inland karma
#

why does lying on an online assessment mean?

#

do you mean that you say you know X without knowing X ?

prisma dove
#

looking up the answer to a question

inland karma
#

not lying

prisma dove
#

thats why I said cheating

inland karma
#

oh i missed that

#

if your candidate can cheat, you failed on your assessment

#

you need bounderies to judge a candidate

prisma dove
#

Yeah fair, thats basically any OA atp

inland karma
#

and if you dont have that, you should not be interviewing

prisma dove
#

even in live interviews its kinda hard to tell these days with Cluely and stuff

inland karma
#

and if you dont have that, you are a poor interviewer

prisma dove
#

wdym by boundaries

inland karma
#

a boundery is something i make and control so that you do not have to do anything

prisma dove
#

not following what you mean there

swift sparrow
#

if someone cheats by performing something way beyond their capabilities, I'll find out the moment I ask them questions about their code

inland karma
#

if i want to judge your comptetency, i have to make sure i can without you having to do anythiing about that

visual juniper
inland karma
#

i would ask questions that does not allow cheating @prisma dove

white knot
#

hi

inland karma
#

if i make an assignment that lets the candidate cheat, then that is my own fault

prisma dove
#

Can you give an example of an assignment that doesn't allow cheating

inland karma
visual juniper
prisma dove
#

Oh yeah in person lol

#

of course thats easier, what if you're on call?

inland karma
#

i can setup a video call where we do the same

white knot
#

⁨```Important: A callback can be an async function and it runs synchronously during the processing of the changes causing the event. You can easily create a dead-lock by using await on a call to another method of the Supabase library.

they say not to use another supabase function on one callback why
visual juniper
#

look if the candidate is determined enough , invests more time in cheating rather than learning , like , its not fully impossible to cheat in online interview

but again , there is no point in that , you will be caught later on anyway

@prisma dove do you have a reason for these qeustion ? anything specific ?

prisma dove
#

no, just observed the lower bound for % of cheaters in our OA was 60% and thought it was interesting

inland karma
#

OA ?

prisma dove
#

online assessment

swift sparrow
visual juniper
inland karma
#

i see.. so an mdash checker

prisma dove
#

Ask a question that can't (realisitcally) be answered without cheating

swift sparrow
#

the ol' AI honeypot

prisma dove
#

yep

#

precisely, you make it like one tiny part of the assessment so they don't waste time on it

swift sparrow
#

What's an example of that?

prisma dove
swift sparrow
#

I can't imagine something that AI would be better at than an experienced coder

#

ahh ok so something hyperspecific

prisma dove
#

works pretty well lol, although I worry it does encourage people to cheat

visual juniper
#

how do you conduct these tests ?

#

do you use a specific assessment platform ?

prisma dove
#

Yeah one of the standard ones

visual juniper
#

i remember we needing to download some specific app, install it and give our assessment through that app , i dont remember the name of the app

swift sparrow
#

that's a pretty good trick for AI. A human might be "are you seriously asking me that?"

prisma dove
inland karma
#

yeah, and you can also use statisitcs to estimate it

granite wyvern
inland karma
#

because you might answer one honey pot question, but not five from five seperate areas if you only have 0 work experience

prisma dove
#

It's not a multi choice or anything lol, if you get this right you're cheating or you are 0.00001% of the population which ig is just a risk you have to take

inland karma
#

though, i still think you should not make a test that people can cheat on

prisma dove
#

I mean you gotta weed out people before taking the time to do a live interview

#

can't be conducting 100k+ interviews

inland karma
#

that is a hard problem to solve, and once you want to filter out, you have make those tests

#

but when i say candidate in this context, that candidate has already been filtered

prisma dove
#

I've caught a fair number of cluely users in live interviews lol

#

always a little akward

inland karma
#

the most popular role in tech probably have 6-8 interviews before the real one

visual juniper
#

also on site interviews

white knot
prisma dove
#

yeah we don't do onsites but thats obviously ideal these days

inland karma
#

are all possitions remote?

prisma dove
#

mostly

inland karma
#

then that is fair

visual juniper
#

thats gonna be hard when the person is fully remote xd

inland karma
#

a remote worker have more to prove than an on site worker

prisma dove
#

it is what it is

visual juniper
#

i wonder at what point interviews will require a "setup facing" camera too 😂

inland karma
visual juniper
#

oh wow

prisma dove
#

even getting them to share their screen isn't enough these days 🥲

visual juniper
#

also that awkward moment when the candidates shares a specific window instaed of the full screen and you have to tell them to share the full screen 😂

granite wyvern
prisma dove
#

@visual juniper do you ask them to open their task manager?

visual juniper
#

im a junior lmao

inland karma
#

i do interviews

prisma dove
#

ah yeah, its a little invasive but I can end about 10% of interviews early by doing that 😭

visual juniper
#

but i have seen some onsite interviews at our startup

inland karma
#

the answer is no i dont have them open their task manager

visual juniper
#

task manager would be crazy tho 😂

prisma dove
#

yeah I see Cluely and interview coder all the time lol

visual juniper
#

if someone asked me to do it , i probably would but it would be funny as hell

#

now that i think more about it , it is really hard to be 100% sure if the candidate is not cheating in an online interview xd

prisma dove
#

Yeah its easy to tell when someone is using a second monitor or has someone helping them, for those hidden to screenshare techniques I have to employ some special tricks..

#

e.g. just rapid fire some easy questions and watch for delay

visual juniper
#

xd

#

interviewers gotta evolve with the tech

prisma dove
#

work simulation interviews will give higher signal I think

#

with access to the regular tools you would have

#

If it was up to me the way we did interviews would be completely different, but we have growth targets so can only push back so much :/

inland karma
#

how would you change it?

prisma dove
#

We had a better interview before imo, technical first questions where we ask questions where only someone genuinely immersed/passionaite about the language would pass (or if they were cheating, this was pre cluely and stuff)

Second round, we would get them to compare a couple different code samples, point our pros and cons and pick which was better, as well as debugging/fixing some long-form AI generated code (with access to the internet and such)

#

This is a job where you need pretty good language specific skills, not just general SWE

inland karma
#

sounds like a good upgrade to the existing system

prisma dove
#

well, thats what we had before 🥲

inland karma
#

then you did a downgrade! 😄

prisma dove
#

got told we weren't hiring enough people, had to drop the bar to the floor

#

maybe this is a rare situation in this recession 🤣 its a growing industry..

inland karma
#

hire on a low bar means you have to set aside time for traning

peak relic
#

Happy Birthday to Guido

white knot
prisma dove
#

remember to set your security rules properly if you use supabase lol

#

its very easy to expose a lot of sensitive data with it

harsh swallow
white knot
#

yeah am using it for auth, other tables are got through backend

#

i mean backend has admin key

prisma dove
#

oh you can't just do the auth in the backend

#

maybe I'm not zoomer enough for this tech

harsh swallow
prisma dove
#

happy birthday

white knot
#

it was easy with the publishabale key to do it in the frontend

#

i think they have RLS or something like that for auth tables by default

prisma dove
#

yeah I've just seen some 💀 stuff with it before lol

#

like no security on a table for identity verification documents

granite wyvern
prisma dove
#

Important: A callback can be an async function and it runs synchronously during the processing of the changes causing the event. You can easily create a dead-lock by using await on a call to another method of the Supabase library.

Its specifically talking about awaiting something from supabase btw not just awaiting a method right?

#

maybe some supabase methods wait for other callbacks to complete? just a guess

#

so then your callback is waiting for something, and that thing is waiting for your callback to finish

granite wyvern
#

I think the ciritcal thig is this bit: "it runs synchronously during the processing of the changes causing the event"

So you can't await something else, because you're blocking things.

prisma dove
#

that doesn't make a lot of sense to me, shouldn't the callback be called once its done

#

e.g.

⁨⁨```py
def my_route(main_function_that_does_something, callback):
await main_function_that_does_something()
await callback()

#

theyre describing it like

⁨```py
def my_route(main_function_that_does_something, callback):
task = asyncio.create_task(main_function_that_does_something())
await callback()
await task


But then I wouldn't call this a callback
#

huh, sqlalchemy commit can only handle 50k rows at once, unless I'm just doing something else horribly wrong

#

(ignore the fact inserting >50k rows at once waas already a mistake)

#

Yeah nvm I was remember another project where I commit automatically in the session DI, I just wasn't commiting 🧠

elfin sleet
#

Does StreamWriter support concurrent writes inherently or do we need to use Mutexes? For example when multiple coroutines use the same StreamWriter to send data

novel shell
rustic needle
#

How can I simply find the try/except that wraps my code? Can breakpoint() + bt help with this?

cerulean ravine
#

feels like ELIZA

rustic needle
#

Because I don't see the timeout error from subprocess.Popen.wait() so I think it's catched.

#

I'm debugging a defunct subprocess

cerulean ravine
rustic needle
#

👍 Found at least 2 try/except keyboardinterrupt 😊

proud escarp
white knot
#

sites like resend need me to have a custom domain inorder to set up a smtp server?

proud escarp
#

you would need a domain name

white knot
#

ah

#

so what the actual use of these sites like resend. i mean i can just host my own smtp server like http right

#

because in supabase for custom smtp i see they suggest resend

#

i do have a personal .me domain, but this is a group project...

proud escarp
#

maybe it helps with the smtp server part, i havent used resend

#

you can just host your own smtp server on a network where you also have a domain name registered ofc

white knot
#

registering a new domain cost money isnt it, i was hoping that sites like resend allowed me to use their domain

proud escarp
#

is the project hosting an smtp server or do you just need a group email ID?

white knot
#

hm but i cant see that, inorder to add an email i need to own a domain in resend

rustic needle
proud escarp
white knot
white knot
#

for sending emails

proud escarp
#

oh, to work with resend you need to specifically buy a .resend domain?

white knot
#

no i was asking whether i have to do that, in resend i can only see option to setup my existing domain with it

proud escarp
#

im not sure, havent used resend

white knot
#

there is also gmail which offers this i think, i remember doing that like few months back

#

i had to register a app or something

#

in google

terse portal
#

hello

#

how can i upload file here?

#

???

white knot
#

you cant

#

i think

rustic needle
inland karma
#

!paste

edgy krakenBOT
#
Pasting large amounts of code

So that everyone can easily read your code, you can paste it in this website:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

rugged star
terse portal
#

i pasted it in python help

rustic needle
#

[99::-1] includes 1 more item

cerulean ravine
terse portal
#

can any of you find it and suggest?

rustic needle
#

Oh, right 😅

arctic salmon
#

Guys, my english is not that good. Please help clarify the meaning of the word "transaction" in the sentence below:

"A company’s “operational systems” are those systems needed to execute the company’s daily commercial transactions and all subsequent data processing needed to complete business obligations."

To my understanding, "transaction" means, in this context, a "deal"

junior orchid
#

Is coding with AI really a big deal? I'm new to coding (around 1 week in) and I'm ngl is making codes with ai bad? Cuz I've never coded w it and when my dad showed me smth and used AI I was confused then he explained that nobody actually remembers function that well and coding with AI is okay and coding is actually all about problem solving.
so I wanna hear some opinions on should or shouldn't I use ai to code?

terse portal
#

could you provide some improvements/

#

?

visual juniper
bronze dragon
visual juniper
#

while it can be useful in some cases
when you are learning , imo , it is better to not use AI at all as there are other source for you to learn , especially for coding , there are countless resources and a lot of them are good

#

not to mention , AI can be misleading , wrong but you wouldnt know because you are learning some thing you have no idea about and chatgpt is very good at sounding like it knows what its doing

bronze dragon
visual juniper
#

if something feels "very easy" to do , you have to be aware of what you are paying for that
using AI feels easy , but you are sacrificing your thinking process , your ability to try and come up with solutions

junior orchid
#

Not to fully make the code yourself

#

I mean not to fully use ai

visual juniper
bronze dragon
#

what do you exactly mean by "for functions and stuff"? what does using AI for that look like?

visual juniper
#

i assuemd they mean like " what if i get AI to write small functions but not the whole code "

junior orchid
#

Like getting small parts done with ai aka breaking ur goal to like a flowchart and then building step by step with ai

visual juniper
junior orchid
#

Why not

visual juniper
#

writing those functions is part of learning

junior orchid
#

Hmm

visual juniper
#

lets say you have to find maximum number in a list

you can get AI to write that code for you , but its such a basic thing that you really should know how to do it yourself as a beginner

junior orchid
#

okay so learn it but can I still use ai for stuff I don't know

bronze dragon
junior orchid
#

okay I get it I think

dusk adder
#

i think it should be the opposite way
you should use ai for the things you are already good at, so you can focus more on the things you havent mastered yet

bronze dragon
#

all shortcuts to learning come at some cost, even if it isn't apparent immediately.

visual juniper
visual juniper
# junior orchid That makes sens

its like handing a calculator to a 1st grader who is learning addition

vs an engineering student who uses calculator to save time

junior orchid
#

man all this coding looks so scary man 😭

bronze dragon
visual juniper
#

why is it scary

junior orchid
junior orchid
visual juniper
past cedar
visual juniper
silver plover
#

It gets easier.

#

(actually no, it doesn't get easier, you just get better at accepting that you can't remember everything)

visual juniper
#

you just get better at using google overtime

junior orchid
#

okay I'll just try to learn as much as possible

past cedar
#

ive been using prompts with ai to build some local programs , feeding back the error and trying to solve the problems, for most simple things its okay, but now im working on something, still simple but no room for error and im having a hard time getting itt right

rustic needle
#

My script subprocess handling is a mess.

While the script does
proc.wait() a signal handler notices ctrl-c and starts to do proc.terminate() simulatenously. I doubt that this is a good idea.

zealous edge
#

hello guys

past cedar
#

hi

zealous edge
#

this is python related, as I'm gonna code it in python, but do you a discord bot, which can switch the server icon every something minutes or hours would be cool?

#

and change the icon for a event, like shecudle the timing to change the icon

visual juniper
#

actually that would make it pretty hard to find the server 😅
server icon serves a purpose as a quick identifier

rustic needle
autumn forge
zealous edge
dusk adder
zealous edge
silver plover
autumn forge
visual juniper
terse portal
rustic needle
dusk adder
dry yacht
zealous edge
#

I think the schedule command would be coool though 😎

#

it could even have a dashboard??

visual juniper
rustic needle
gritty rampart
#

Hey if i made a chatbot using api . what is my coding rating / 10

zealous edge
visual juniper
zealous edge
#

also using a API is fine, because producing an LLM is very hard.

gritty rampart
#

I used open router's api with mistral ai model

dusk adder
zealous edge
terse portal
#

very basic

#

I have just started learning python

zealous edge
gritty rampart
terse portal
#

is python crash course book could for learning python

gritty rampart
#

yeah it was cheap

#

give it a try

zealous edge
zealous edge
gritty rampart
#

You wanna try the bot

terse portal
#

i have soft copy of it

rustic needle
gritty rampart
zealous edge
#

I was planning to use DeepSeek AI as it's got 700B params and it's $0.2 per 1m tokens

zealous edge
gritty rampart
#

it was a education only bot so restictions

zealous edge
#

please

gritty rampart
#

like the website

terse portal
#

from where have you learnt python

gritty rampart
#

you can use any model chatgpt deepseek or others

white knot
#

idk why is this happening... i was getting CORS error suddenly then just closed all server and vscode.
tried again now no CORS

#

am on development

zealous edge
gritty rampart
zealous edge
#

I still tryna figure out how to do the login system 😭

white knot
#

127.0.0.1 - - [31/Jan/2026 18:41:28] "OPTIONS /api/update_profile HTTP/1.1" 200 - 127.0.0.1 - - [31/Jan/2026 18:41:31] "POST /api/update_profile HTTP/1.1" 200 -

#

what is this OPTIONS

terse portal
#

according to yu all what is the best way or resource to you learn python

rare gazelle
#

whats the hinting for the exit dunder?

zealous edge
zealous edge
#

so like BroCode for example

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.

fervent matrix
terse portal
gritty rampart
#

Hey guys do you wanna try the student question only bot i made using openrouter's api?

rare gazelle
#

        , exception_type: type[BaseException] | None
        , exception: BaseException | None
        , exception_traceback: TracebackType | None

?

fervent matrix
terse portal
fervent matrix
gritty rampart
#

stupid school

terse portal
#

who are you

Bot Avatar Image
I am Mentor Bot. How can I help you today?
what is mitochondria

Bot Avatar Image
Mentor Bot: Mitochondria are organelles in cells. They produce energy (ATP) through respiration. Called the "powerhouse" of the cell. Found in most eukaryotic cells (plants, animals, fungi).
elaborate

Bot Avatar Image
I cannot elaborate. Please ask a specific academic or student mental wellbeing question.

#

i asked these all questions to the ai bot

#

the mitochondraia and elaborate are my questions

gritty rampart
#

yeah buddy it cannot connect to the previous question so it doesn't take it as

  1. what is mitochondria
    2"what is mitochondria" + "elaborate"
    but
  2. what is mitochondria
  3. just"elaborate" and then it is held back by restictions
dry garden
#

does anybody here know a good yt playlist or a book to teach how to properly structure code, like how to separate my project to multiple files and my code into sections, just for the sake of increasing the readablility of my code and easiness of editing or changing stuff

gritty rampart
zealous edge
#

guys how would I make a discord bot with a dashboard?

gritty rampart
#

they structure the code

gritty rampart
dry garden
terse portal
#

ia ma too of age 14

#

*am

gritty rampart
terse portal
#

*i am

#

in which class are you

fervent matrix
gritty rampart
white knot
#

i just hate copilot now

#

it just spoiled my day

gritty rampart
dry garden
harsh anchor
white knot
#

deleted copilot now

zealous edge
white knot
#

it reads my mind... and also gives wrong stuff

terse portal
#

are you talking about gihub copilot or micrsoft copilot

gritty rampart
terse portal
#

*github

fervent matrix
dry garden
white knot
gritty rampart
#

like in browser or compiler

white knot
#

i used it in vscode which is also owned by microsoft

#

how can i use copilot inside a compiler

harsh anchor
zealous edge
gritty rampart
dry garden
fervent matrix
gritty rampart
#

Btw any coder other than python too

pulsar inlet
# dry garden i m sure there is a good source somewhere

When you start to learn design patterns and how to properly structure data it becomes something you’ll start to develop in your code bases. If you want concrete structuring then you can always look into stuff like MVP

zealous edge
terse portal
fervent matrix
terse portal
dry garden
terse portal
#

@white knot so which ai are you planning to use now

zealous edge
fervent matrix
zealous edge
fervent matrix
# zealous edge how will I send the data that needs to be updated in the datbase to the API? wil...

errr, I'm thinking it more like this:
web interface, this is the place with UI, where you make changes to guild or something.
-> web updates the database with new data "update table with these values for this guild"
-> bot reads the database every now and then, and reads the table + checks when last edit, apply the changes based on that
-> now the guild settings are updated

You'll just have the bot and web/API being able to communicate via the same database

zealous edge
#

I mean how would normal JS change the dB?

rare gazelle
#

about the return of the exit dunder, True means to suppress exception or False

fervent matrix
zealous edge
weak jasper
#

⁨```py
students=[]
def add_student():
try:
name=input("Enter name of the student: ")
marks=int(input("Enter marks of the student: "))
student={
"name": name,
"marks":marks
}
students.append(student)
print("Student added successfully")
except ValueError:
print("Marks must be a number")

can we not just use ⁨``students``⁩ instead of ⁨``student``⁩ for adding the names?
fervent matrix
main lagoon
#

What is bot here bro I didn't get

zealous edge
#

it's fine with me, hosting can be expensive but I'll do anything to make something good

fervent matrix
# zealous edge yes

how do you want the combination be like? You can do python+js framework or something without python backend, there are many ways to do it so it really depends ™

fervent matrix
zealous edge
zealous edge
#

it's puzzling me a lot

fervent matrix
zealous edge
silver plover
zealous edge
#

I think it's the most cool part as it's the core of the whole system, the frontend is cool when it's modern

zealous edge
silver plover
fervent matrix
jade robin
#

it still needs to be reactive

zealous edge
jade robin
#

so you can either craft it yourself or rely on frameworks. one's easier

rustic needle
zealous edge
#

like tailwindcss, I just find react a pain in the but sometimes

silver plover
#

But what are you trying to build?

zealous edge
silver plover
jade robin
#

with a dashboard which updates itself constantly, i'm guessing

zealous edge
fervent matrix
silver plover
#

What's the dashboard do?

jade robin
#

if it does stuff like display server stats on a web UI, it needs to be reactive

zealous edge
jade robin
#

if it's just basic config, it's fine otherwise too

zealous edge
#

I'm giving very basic info but I've got a lot more features in the back

fossil steeple
#

!e

main lagoon
#

Can we write a route in a discord bot

zealous edge
main lagoon
#

Basically every discord bot connects or handshake with discord server right?

zealous edge
#

I have no clue what you are talking bout

#

all a discord bot does is connects with the discord api

fossil steeple
#

does it

silent wave
#

Why’s merging a big change to main for the first time in a 7 person group project so scary

silver plover
charred python
#

Because you see it as a risk of being humiliated if it goes wrong. But.. If you resolved your merge conflict first in your branch, checked things, tested, then you should be fine. (probably, I didn't see your code)

eager smelt
#

also, testing

#

automated testing

silent wave
#

Well I mean it was only 600 lines, it’s just my first ever time doing something in a group, I’ve only ever worked solo

#

All works though no issues

#

Just scary

charred python
#

Do you have pull requests or peer reviews?

little creek
#

I am looking for api developer
who can do api resgistration for instagram and must be ios endpoint

steady rain
silent wave
#

Anyone can merge to main

#

XD

#

It’s for a university coursework and they deemed it not necessary

zealous edge
charred python
#

Then maybe just ask one team mate to do a sanity check on your work if you are unsure. "Hey, I think I'm ready to merge this in, is there anything I should check first?"

weak jasper
#

what is ⁨|⁩ in python?

silver plover
zealous edge
#

anyone will laugh at you for doing something wrong so if you don't wanna learn it means you can take the fact of embarrassment

steel whale
zealous edge
charred python
#

There is no I in python. Or team. 😉

main lagoon
steel whale
dry yacht
# weak jasper what is ⁨``|``⁩ in python?

It depends. For ⁨⁨int⁩⁩ it could be a ⁨⁨bitwise OR⁩⁩, for a ⁨⁨set⁩⁩ it could be the ⁨⁨union⁩⁩ operator, or for ⁨⁨float⁩⁩ it is undefined. Also you can overload operators for any class however you like, so theoretically it can have an arbitrary number of meanings

dry yacht
steel whale
autumn forge
steel whale
#

maybe make your own API and run it alongside the bot

main lagoon
#

Yeah only websockets connection nothing other than that

charred python
weak jasper
dry yacht
weak jasper
zealous edge
charred python
#

ohh, sorry, your weren't the original asker.

steel whale
dry yacht
charred python
#

They raised you well.

zealous edge
#

that is the true definition of learning

autumn forge
main lagoon
#

Do people consider using fastapis or django if they have node js working fine and has good synergy with the data stuff

charred python
#

Those are all valid choices. Which one you choose may depend on:

  • Which stack you and your team know best
  • how much code you already have written in one stack
  • preference.
#

Or if there are other libraries you plan to use that are only in python or only in node. Those types of concerns.

main lagoon
#

Other than that you can choose which language you want to right doesn't matter much

charred python
#

FastAPI is very nice, imo, but it's just the API part of the stack, not database. So you'll need more. Django is more full featured and deals with databases and other application structure. Node is just a runtime like python, so.. I don't know what frameworks you are using there.

jagged belfry
#

Different languages are good at different things

#

Just like different frameworks

#

it is a good idea to understand what you rlanguage and framework are best or worst at, and compensate appropriately. Changing languages mid-project is a recipe for failure, but that doesn't mean all parts of a project have to be the same one. It's just tradeoffs.

main lagoon
#

I mean I recently started using Express and learned javascript like I feel writing frontend react code in js and I don't want to switch to python
But I love writing code in python before
But after js,I feel js is better for full stack web development

jagged belfry
#

Flask is excellent for a barebones, simple setup in python. Django is good if you want a lot of features and power and want the optimized guidelines it provides

#

Python as a language is very powerful and very flexible, but doesn't perform as well as rust or go

#

Javascript is the same language you will use for your frontend

charred python
#

well, for frontend you'll need some javascript either way. If you like react, you can keep your react. Your backend can be python

jagged belfry
#

"Full stack" is one of those things that's, how do I put it

#

Jack of all trades master of none

#

I should know, I am one. Frontend, react, mid-end, some networking, deployment, backend, databases

#

There is simply too much to know to properly advance and specialize

charred python
#

You'll find us all saying python becasue this is a python discord. But I have done JS backends in the past and would again. It can be a very capable runtime, lots of libraries, etc.

jagged belfry
#

The answer is you should know what you are doing and why

jagged belfry
#

It costs nothing to write a very small demo as well and launch in both language options, to understand how they actually work

jagged belfry
#

Oh

#

I see

eager smelt
#

breadth in lots
depth in few

jagged belfry
#

Yes

#

I'm a lot deeper in css, python, and some systems stuff

charred python
#

I'm H shaped.

jagged belfry
#

javascript gets the advantage in full stack because it theoretically reduces the amount you have to learn

#

it doesn't by that much, actually, but the idea gets a lot of weight

bright mauve
jagged belfry
#

Not saying it won't work in the future, but if AI worked windows would be a lot more functional right now than it currently is

charred python
#

Also, you can share some code between front and backend in .js. I have in the past.

src/
   client/
   server/
   common/

Where common has some things that could be used in both places. The same validation library both for instant feedback on the frontend, and also verified the API payload on the backend.

eager smelt
jagged belfry
#

@.@

main lagoon
gray siren
#

guys finally i learn nosql in my college

jagged belfry
#

It'd be lovely if browsers shipped a friggin python runtime

#

Annoyed at adobe and oracle for ruining that space

main lagoon
#

Python is built for ai models ngl

charred python
# main lagoon That's great we can't be doing with python

It can be great. But it also requires discipline to know what code can be shared. Also it can sometimes require changes both on front and backend to keep them in sync, etc.

Sometimes a clean separation can be better. (But it worked for me when I did it)

gray siren
gray siren
silver plover
jagged belfry
#

Now if only I didn't have to send over an xxmb runtime every time

jagged belfry
#

Can't even cache cdn's anymore because google and advertising companies are evil

main lagoon
#

Who owns Cdn?

charred python
#

What about router stuff? I had a separate frontend and backend routers. The frontend router had different concerns, like encoding which tab the user has selected, while the backend router was just RESTful based on the resources/models.

jagged belfry
#

It's a type of service, there are a lot of companies that offer them

jagged belfry
main lagoon
#

It's called system design

charred python
#

Of course. Some shared concerns (because they work together), some different concerns (because they have different responsibilites). I was trying to convey that already.

jagged belfry
#

CDN urls are no longer cached cross-site

main lagoon
#

Cdn are just our choice

jagged belfry
#

This is because of cache-based tracking attacks by large advertising networks using this to determine which websites a browser had visited before

stoic nova
#

for those who use pdb

do you do
python -m pdb script.py

or just run normally? does it even matter if you are using breakpoint()s?

jagged belfry
#

Which, notably, you as a website owner didn't even have to opt into. An advertising company could hit like 15 different cdns and cross-reference them against a list of common websites that hit the cdn's for natural purposes. Even worse with rapid iteration adding more bits of information to the process.

main lagoon
#

Do we have any websites that have news like these ,I mean today tech news

jagged belfry
#

Theoretically, ten years ago, if python wanted to take over the internet all we would have to do is have someone host one copy of the runtime and everyone access it. Then only the first time would the file be downloaded and python would be nearly as fast as javascript. But it doesn't work like that anymore.

charred python
#

So, you're talking about CDNs to host libraries for multiple sites/apps to use. That's one use. I don't like pulling my dependencies from a 3rd party CDN, I host them myself.

And my CDN takes the load off of my servers. So that my server doesn't have to serve that asset to each customer, the CDN can do that.

I just think of CDNs as part of my application, not a service to me as a user.

jagged belfry
#

They were originally intended to be both

charred python
#

Sure. I think the case of saving a few milliseconds because two websites happen to use the same version of jquery is rare, though. These days most sites have their own bundles of .JS compiled with their code and dependencies.

jagged belfry
#

You see, the thing was it wasn't a few milliseconds

#

Not only could you avoid the download--and js libraries were relatively as big back then as they are today, compared to internet speeds--you saved round trips

#

and round trips are murder on performance. You didn't have to set up connections, use bandwidth, handle TLS repeatedly. Remember that cdn's came in during the era of http 1.0, where everything went over a singular pipe and any blocking meant total blocking

azure crane
#

Bast

#

your bio is bugging me
what is it

charred python
#

I agree with everything you said. But I don't think it matters as much today as it did in the past.

But yea.. advertising and tracking ruin everything.

#

I mean.. round trips still matter, but that's solved with bundling.

jagged belfry
#

I would have linked you to a keyserver but they're all misbehaving for some reason

#

going to have to fix that I guess

azure crane
#

ty

jagged belfry
#

Perhaps the most strongly hit component was fonts

#

Fonts used to be effectively free, because they were only downloaded once

#

but today we have serious concerns over FOUC and similar because they are always downloaded now

hearty bridge
#

I want to download a previous version of macOS. I am currently on 13.43 and I want to upgrade to 15 is it okay to install it from App Store?

jagged belfry
#

full-sized fonts are upwards of a meg these days, and you pay for that for every site that uses it

charred python
#

You'll hate this:
We have some shared assets that get served by our CDN on more than 100 domains. So if a user uses multiple of our sites and happens to need the same assets, they download them again.

jagged belfry
#

yep

#

again and again and again and each time contributing to load and wait times

#

Fontawesome's website weighs 20mb

#

recaptcha.js is 1mb, and I have to keep fucking downloading it with every website

charred python
#

Some of the assets are customer-specific, and we have good reasons to use their domain (like media). But.. thinking about this, I might be able to have some things like fonts move to a shared domain..

jagged belfry
#

Don't.

#

Historically, having them on a shared cdn was faster

#

today, serving them from the origin domain is faster

charred python
#

I won't, becasue I don't care that much and have more important things to do. But .. is fun to think about.

jagged belfry
#

Right now with http3 the main source of latency is the waterfall (as always...) but also connecting to other domains. Keep in mind that each domain that you have to connect to naturally waterfalls behind the user's dns, which has gotten slower over the years

charred python
#

good point

jagged belfry
#

each of these is a minimum round trip

charred tusk
#

Hi Bast

jagged belfry
#

For most users, probably between 20 and 80 ms

twilit dawn
#

hey

jagged belfry
#

240 to 960ms of delay just in round trips, no matter how fast you serve

charred tusk
#

I ripped out the extra TLS lookup but it didn't really affect my time 🙁

jagged belfry
twilit dawn
#

hello hi howdy

jagged belfry
#

F

hearty bridge
#

I want to download a previous version of macOS. I am currently on 13.43 and I want to upgrade to 15 is it okay to install it from App Store?

charred python
#

We do pay attention to optimizations. For example when we have to connect to another domain (and we do a lot for all the various chatbots and bullshit our customers want on their site) we use the head elements that pre-connect. Other such things. Also we pay attention to google's core web vitals for our sites.

charred tusk
charred tusk
#

oh
No that's not a thing that I know of

hearty bridge
#

macOs Tahoe 26

#

latest macos version. I want one version before that

charred python
#

If you are just upgrading, upgrade from the settings panel in macos. It'll tell you you have updates to MacOS.

charred tusk
#

I meant -- I don't think pinning to specific releases is a thing
The updater is always going to download the latest

jagged belfry
hearty bridge
#

are you guys mac users?

charred tusk
#

But we're programmers, what do we know
I am a sysadmin, but a Windows one
The Macs in my env are always broken

#

Jinx

charred python
#

I am on a mac right now. I am an everything user.

hearty bridge
#

the onces who are suggesting me

jagged belfry
#

this is a python channel not a mac channel

#

you should not be surprised to be getting limited help in the wrong place for your question

hearty bridge
charred python
#

Sir, this is a Wendy's

hearty bridge
jagged belfry
#

I linked you a guide that allows you to install whichever version of macos you want, provided apple still provides it. I have no idea how you would go around it if apple doesn't want to provide it anymore

charred tusk
jagged belfry
#

Sometimes I swear I'm just speaking into the void

charred tusk
charred python
#

yea.. my suggestion is look at Bast's link above.

hearty bridge
#

same thing there true

#

can install from app store as well

#

thanks anyway

jagged belfry
#

I'm so confused

charred python
#

yea.. that link answers their question perfectly.

amber vine
#

have you heared about clawdBOT?

charred python
#

everyone has heard about clawdbot the last few days.

jagged belfry
#

Their social media site is kind of funny not gonna lie

charred tusk
#

Shit's wild

jagged belfry
#

I'm over here actually auditing dependencies for trust

#

and they're just like

#

"ai, go download instructions from another ai. Also here's my banking info"

charred tusk
jagged belfry
#

Depends on project requirements /slop

#

Depends on the use case and source

#

I don't audit django, for example, but if someone has a dependency on here I haven't heard of before I actually pull down the pip files to unpack them

charred tusk
#

I've got ⁨actions/dependency-review-action⁩ in CI and Snyk and stuff
I'm mostly good at sanity checking changelogs
I tried looking at the actuall diff of every dependency in the tree but that was WAY too much effort for a poor solo dev

hearty bridge
#

thanks

jagged belfry
#

yes

charred tusk
#

based

terse portal
#

Which book is better for learning python: automate the boring stuff with python or phyton crash course

cerulean ravine
terse portal
#

Which you prefer o

cerulean ravine
pearl cairn
#

hi

jagged belfry
#

Me: why is my laptop so slow??
Me: closes 4 youtube tabs and 3 web blog tabs
Laptop: suddenly performs a thousand times better

charred tusk
#

Have you tried getting a laptop made this century?

stoic nova
#

i think automate the boring stuff is better but it has some unholy code and the author plugs his modules without disclosing they are his and not really used at all

proud escarp
#

also i dont really like the code snippet format

#

it's called to copy paste iirc

#

oh, the website changed

jagged belfry
slow rivet
#

how much ram you got?

jagged belfry
#

more than 16gb

proud escarp
#

nvm, it's the second edition
⁨```py
➎ if text[7] != '-':
return False
for i in range(8, 12):
➏ if not text[i].isdecimal():
return False
➐ return True

bitter ermine
#

@jagged belfry you mentioned earlier that DNS had gotten slower, why is that?

proud escarp
#

im saving up for a new laptop this year though!

charred tusk
proud escarp
#

im going to buy the one with the best specs i can

jagged belfry
#

Good luck. Tech market is on six types of fire, spinning in a tornado, and diving into the dumpster to really kick it off

charred tusk
proud escarp
#

yep, what a bad time for computer parts to raise prices

slow rivet
#

yeah really happy I bought my desktop before the massive price spikes

proud escarp
#

when it's MY turn to be an adult

bitter ermine
proud escarp
#

||i just hope the AI bubble pops and manufacturers go back to focusing on the consumer market||

bitter ermine
#

although companies aren't caring about regular consumers as much now

zealous edge
#

hello guys.

jagged belfry
# bitter ermine <@246512746986864641> you mentioned earlier that DNS had gotten slower, why is t...

It's a mix of things, although I don't have hard data so I could be wrong here:

  • transition to secured dns adding 1-2 round trips
  • a change in networking focus on throughput for streaming increasing base latencies (in the united states in general)
  • companies taking advantage of being able to intercept dns and inject their own responses (comcast, etc)
  • google starting to fail to care about their DNS
  • more complex DNS requirements due to the proliferation of cdns
  • more complex dns responses due to HSTS and similar
stoic nova
#

but that regex one i would rather just learn normal regex instead since its universal

jagged belfry
#

bext can be replaced with blessed today, I think, although it's existence is reasonable for the time period the book was published in

cerulean ravine
jagged belfry
#

I don't mind much that a python book suggests it's own "make easier" modules. That's pretty consistent for learning books, because you want to smooth rough edges to learn before you can solve said rough edges properly

vast temple
#

how do i check that two mocks were called but in a specific order?

jagged belfry
#

The value of being able to actually do cursor and color in a terminal without explaining ascii codes is quite high

vast temple
#

hmmm ok

jagged belfry
#

TLDR: make one parent mock object and then check .calls

burnt ice
#

hey I wanted to make white noise or any color noise generator in python for fun what library should I use for the sounds

velvet hull
burnt ice
silver plover
bright mauve
rapid bridge
bright mauve
#

librosa should have high level ways of both generating and playing sounds, since it's a sound signal processing module

burnt ice
#

ty

silver plover
#

Now I'm just curious about doing this with a buffer or something

bright mauve
#

sounddevice and pyaudio should let you play numpy arrays directly

burnt ice
#

do I need to make it a file

bright mauve
#

make what a file? the noise you want to play?

burnt ice
#

yeah

bright mauve
#

no, you don't need to

#

you can if you want to play the audio in say windows media player or vlc

burnt ice
#

okay it seems like that for some reason

bright mauve
#

you can directly play your list/tuple/numpy array into the "output audio stream" though

hollow citrus
#

exactly what i did used the get function and suffix

but because i didnt want to set a unicode for all possible file types i used ai to do it for me file_icons: dict[str, str] = {
# General / categories
"directory": "\U0001F4C1", # 📁
"text": "\U0001F4C4", # 📄
"pdf": "\U0001F4D5", # 📕 etc it goes on for another 50 more file types xd
each one that exists

like for smth like this id argue its totally fine to use ai it saves me a good 15-30 mins of finding a unicode for each file type

bright mauve
#

what lakmatiol linked you to is only for writing and reading files, as far as i acn see

inland karma
burnt ice
#

man I have no idea what I'm doing

inland karma
#

print(dir(file)) to see everything it has

hollow citrus
#

mode_and_position: dict[int, tuple[int, str]] = {
stat.FILE_ATTRIBUTE_DIRECTORY: (0, "d"),
stat.FILE_ATTRIBUTE_ARCHIVE: (1, "a"),
stat.FILE_ATTRIBUTE_READONLY: (2, "r"),
stat.FILE_ATTRIBUTE_SYSTEM: (3, "s"),
stat.FILE_ATTRIBUTE_HIDDEN: (4, "h"),
}

for key, (index, char) in mode_and_position.items():
    if file_mode & key:
        mode_attributes[index] = char eivl also made my mode better not just plain old if statements this is more flexible
rapid bridge
bright mauve
burnt ice
#

no

bright mauve
#

digital sound is finicky

rapid bridge
bright mauve
# burnt ice no

read through the link i sent you, it has examples and explanations

burnt ice
#

oh

hollow citrus
bright mauve
burnt ice
#

okay so when I play a np array what happens and why I really don't know what to ask I don't know what I'm doing

karmic oasis
#

Where should I ask for vscode extensions uploading related issues?

bright mauve
#

commonly, for reasons you would learn in uni, sound and music are "sampled" at 44100 hertz, meaning that each index in your array/list represents a time duration of 1/44100 seconds

#

so you can make, say, a numpy array of length 2*44100. you can tell python-sounddevice to play this array with a sampling frequency of 44100 hertz. and this will produce 2 seconds of sound generated based on the values inside that numpy array

#

if you want to do stereo sound, you would need 2 vectors: one for the left speaker, one for the right speaker

burnt ice
#

okay this makes more sense

#

oh yeah stereo is there like a bash cmd to tell if I have stereo or mono gosh I'm so dumb

bright mauve
#

you have to keep in mind the real world phenomenon you want to represent. the easiest example is generating a sine wave, which your brain interprets as a "beep" sound

#

perhaps something like

young path
# hollow citrus mode_and_position: dict[int, tuple[int, str]] = { stat.FILE_ATTRIBUTE_DI...

i would skip the position in the dictionary, use enumerate() and just do

mode_and_position: dict[int, str] = {
    stat.FILE_ATTRIBUTE_DIRECTORY: "d",
    stat.FILE_ATTRIBUTE_ARCHIVE: "a",
    stat.FILE_ATTRIBUTE_READONLY: "r",
    stat.FILE_ATTRIBUTE_SYSTEM: "s",
    stat.FILE_ATTRIBUTE_HIDDEN: "h",
}

for index, (key, char) in enumerate(mode_and_position.items()):
    if file_mode & key:
        mode_attributes[index] = char
```instead, you just have to remember that the order the entries appear in the source code for dictionary is important now
bright mauve
# burnt ice okay this makes more sense
import numpy as np
sampling_freq = 44100
dt = 1/sampling_freq
seconds = 3
Nt = 3*sampling_freq # number of samples for the desired sound duration
fc = 500 # frequency of the generated tone in hertz
tone = np.sine(2*np.pi*fc*np.arange(Nt)*dt) # array with the tone samples
# and now you can feed this into python-sounddevice to play the tone for 3 seconds
weak jasper
#

!kindlings

edgy krakenBOT
#
Kindling Projects

The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

bright mauve
glacial leaf
#

how do i calculate the amount of messages sent per day from start date to end date
currently i have a ⁨timedelta⁩ of the difference but idk how to continue

charred python
#

I am having trouble launching my python app from another MacOS Desktop app. I think it's related to DYLD_LIBRARY_PATH but am not certain. More info in my thread: #1467202160277323776 message

(The one and only time I'll post my thread here. Hope this is OK)

silver plover
glacial leaf
#

i think i finally have the difference in days

silver plover
shrewd pine
silver plover
#

A dictionary?

hollow citrus
glacial leaf
glacial leaf
shrewd pine
#

for a totally raw stream you mostly don't know

silver plover
glacial leaf
#

i guess datetimes and timedeltas?

#

anything that will work?

shrewd pine
silver plover
#

If it's a dataframe, then it'd be: ⁨⁨⁨df[(df["date"] > startdate) & (df["date"] <= enddate)]⁩⁩⁩

shrewd pine
#

&, no?

silver plover
#

If it's a list, you could use a loop like: ⁨```py
for d in mydates:
if d > startdate and d <= enddate:
mycount++

silver plover
hollow citrus