#python-discussion
1 messages · Page 21 of 1
Hi yall!
hey hey
What are we discussing about?
the usual, Python
I can’t wait for 3.14
Good thing it's available already 🙂
So indeed. they can't wait.
I have not updated my computer yet been busy with work.
thx you and everyone who helped
I think the fact that you can turn off the GIL means you can write your python code to run faster. (For certain problems, designs, etc.) So it’s not necessarily an issue of “should I write this in Python or Java or C?”, it’s “I have this python code base and now I may be able to make it run faster.”
Thx!
I'm thinking of doing this to name a file after it's location in the hive:
SaveKey(key_object._key, f"~/.{key_object.hive.name}" +
f"{key_object.path.replace('\\', '.')}.breg")
definitely free-threaded builds and subinterpreters open up possibilities
does alpha2 not release today
it looks like 3.15a2 is delayed due to the cloudflare problems
oh rip
Even python relies on Cloudflare💔
isn't it back up now?
wdym
like each thread has a lock? so the threads started in a non-main thread wont be free?
they would be concurrent?
I want to make an app using python does anyone have any advice on where to start
it was github actions that slowed it down
If u don't know how to start may be you need to start with an ai
Same Python is like Rome for I.A, but i don't like this language lol
hi
For backend a strong typed language is way better
each object
python is great for backends, and you can do as much static type checking as you want.
Coming from a C++ and C# experience (asp.net core is great), i don't feel like that
i can see that you don't.
have you used a type checker with Python?
Not yet, i have use the type hints in some places, not everywhere
you will like it
#python-discussion message has some tips on where to start
Maybe i'm stuck in the mentality of : types are enforced (like c#, c++, typescript) or no types (javascript, lua, etc)
If someone writes a new static type checking engine, they could call it Van de Graaff.
i found something very weird in the typing system, but probably others know about it
It's definitely an adjustment. It took me a long time to get past the weirdness and embrace the pythonanity.
why not enforce types in Python?
maybe you've heard of typescript for javascript. python doesn't have a separate language built on top of it, but if you use type hints in your code, you can use static type checkers to statically check them.
say u have 2 types, one is a subclass of another
noow in 1 overload u're accepting the subclass, in another the superclass
the type checker will try its best to use the subclass, even if its less explicit
Yeah, that is true, first time with python, i only had experience with javascript and lua when it comes to pure dynamic languages
I should try it
even if its not the first overload
Yeah
Personally, I'd argue for: embrace the Python approach and see where that brings you, I get pretty far with "somewhat typed" (basic?) and not strict pyright.
Honestly, coding without types feels like a disorganized world, like something is missing
I accept it in javascript because i'm not doing anything complex with it
I feel that... but when you go through the looking glass, suddenly it feels like freedom.
(at least for me)
i think it depends
sometimes u need perfect types, sometimes u dont
🤷♂️
yo guys, working with a small database issue rn
I currently have a table that keeps track of a session, and another table for slots. each session has multiple slots
then I have a session attendee table that currently only keeps tracks of attendees for a slot, and I need to do a long query to check if an attendee is in another slot
is it recommended to just add a sessionID column to attendees? or do the query
So you want to track: session, slot, attendee name?
do ateendee belongs to the session?
lowkey the worst debugging ive had to do was an entirely vibecoded untyped JS frontend
there were no introspections for anything 😭
yep, rn I just want to do a check if an attendee is part of a slot that's in the same session before they can get transfered or etc
like if a session has slot1 and slot2, and an attendee signs up for slot1, I want to do a query to see if the attendee is in slot1 of the session before transfering them to slot2 if they request
if the ateende belongs to a certain session adding the sessionId colunm is pretty ok
yes
hm okay
Roughly, the textbook approach is to have a: session table, a session_slot table, an attendee table, and a slot_attendee association table.
im only worried about future usecases where there might be an attendee that needs to attend 2 sessions
what'd the slot_attendee do?
You could also just put the attendee_id in the session_slot
each slot can have several attendees
Yah, then you need a separate slot_attendee.
which stores slot_id, attendee_id
That will do, but i got one question why we can't add an attendee id colunm to the session_slot table and instead add an assocition table?
Because each slot can have several attendees, and an attendee can have multiple slots.
might work actually, ty
Basically, think of the relationships of each: is it 1 to 1? 1 to many? or many to many?
That makes sense, i was working wit the idea the ateendee can only occupy one slot
1 to 1 would not require a assocition table i believe
ah okay
yup, need the association when you have a many to many situation.
but assuming that each attendee should only have one slot, what would be the best solution here?
Then you could put the slot_id in the attendee table.
So that a slot can have multiple attendees, but an attendee can only have one slot.
1 to many
sry typo, I mean session
what if each attendee can only sign up for one slot within a session at a time
anyone want to be apart of my project im working on ?
In the association table, you'd have: session_id, slot_id, attendee id. And, set a unique_key on (session_id, attendee_id)
i was thinking a 1 to 1 would work in this situation
hey! im looking for an experienced Python programmer preferably one who knows about the requests module and can teach me how to perform post/get requests with it!
But adding a table for that with the unique keys garantee his requirement
help me w this guys
You should announce your project better (sell it ) otherwise people won't feel its attractive to work on it
yea I think this is the best way
It gets complicated to enforce all business logic in the database... in some cases, we can make it simple. Adding a session id to attendee could lead to a discrepancy where the slot-attendee relationship is inconsistent with the attendee-session relationship
its a clash royale ai thing
So its a game?
Open a help thread plz: #❓|how-to-get-help
anyone experienced with pip install requests
a ai that plays a game yes
👍
Is that ok? i mean does that count as a bot that violates the game terms of service?
idk really im just doing it for fun
Yeah, i would not add the sesson id to the ateende, but i would need some a query to garantee the ateende is not using another slot in the same session, using the association table is simpler
Database modeling can be fun btw
A lot of times the whole application is "done" after you got the model right
You just need some crud in your favorite language, some checks business logic and its done
There is this free open source game called 0 AD
Its a lot like age of empires 1 - 2
I wish the AI was better
Its random but i ask myself how good an LLM would play against a real person
the one i had before i lost my usb it was on did fairly well tbh lol
You lost the code / prompts?
@ornate wren Dude 0 AD was still fun to play even though it was easy.
sadly yes lol idk where the usb went
but the one im working on now is 20x better no joke
Think of it this way, even when types are not "enforced" by a type checker, everything still has a type.
Of course, its just missing the hints (lol)
The game is good itself but if you are playing offline against the A.I very soon it becomes boring
Bingo! I use VSCode, Pylance, and the Python plugin, and every time I write a method, it tells me the types for the parameters and return values.
Ugh. New keyswitches coming in thursday, and have new keycaps already.
if i have numpy activate on a python file thats in my C drive and use a virtual enviorenment in my D drive in vscode that wont ruin anything right
This.
nope, should work fine
aye should i use tkinter for making little desktop applications or is there something better?
It's probably okay for a quick app or two. If you want a bit more than that, then you can start considering other frameworks like Qt or web-related stuff.
ok thanks
use pyside or pyqt
tkinter is more lightweight, however pyside/pyqt are heavier but much more flexible
Hi guys..can anyone help me pls
in addition you have the whole qt ecosystem, like qt3d, qt multimedia, qt bluetooth, if you ever need it
it is a bit more complicated than tkinter for GUI, but if you're learning a GUI framework anyway you might as well put in the bit extra work
PySide and PyQt rely on the same framework (Qt) and have very slight differences. I personally like PySide more since it's the official binding. Relative to Tk, Qt usually imposes a more object-oriented approach so it introduces some complexity in that way.
same for me, pyside is the offical binding
ok thanks
however there are like 5 differences total between pyside and pyqt (i'm serious, lol)
lmao
there's no reason to not use pyside though, better support from qt company
what's your issue?
yeah i think ima play around with pyside
If you go with tkinter, bookmark this: https://tkdocs.com/shipman/index-2.html
It is extremely useful.
Describes the Tkinter widget set for constructing graphical user interfaces (GUIs) in the Python programming language. Created by the late John Shipman. Last updated in 2013.
thanks ima definitely use this
this is a tutorial for QtWidgets, one of two ways to build UIs in qt the other way is QML
ok
QML is more modern, the coding for the UI is simpler and it's easier to use with animations, but it's harder to interop with python since it's like a seperate coding language that you run through qt, QWidgets is more mature, is 100% directly in your python code so it's easier to make gui->python interactions, but is a biiit more clunky than QML
it doesn't really matter which one you learn first since QML is so different, just learn qtwidgets because it gives you a better overview of how to work with qt in python
you learn how to handle qobjects, signals and slots, etc easier through QWidgets, then you can bring that knowelge into qml later if you wish
anyway let me not infodump on you go learn lol
ok lmao
im glad i have more over view though and not picking a random library and hoping it does the job
yeah yeah, np
I learned python but never built anything. You guys have any concept to work on? something creative.
https://github.com/awesome-open-source-projects/percent
Look at this masterpiece
Meow
conway's game of life
Meow? Meow didn't understand
What do you think
It's a simulation that you can program.
Just look it up
Meow meow~....... Gotta look up
Oh meow. It sounds fun. I will return when this project is ready. MEOW
This was funny Meow's laughing
hello
Add pr meow gaha
Meow didn't understand again. Meow's dumb.
I didn't notice that was your project Meow
is a pull request the same as a put?
What do you mean by a "put"?
I don't use github. How do I do that? (It's so embarrassing)
a put request is it the same as a push
push maybe?
If I made git, I might have used pick/put too
oh ur taking about git
thought u meant the request module
Not really
Pushing to a repository implies that you have write access to that repository.
But a pull request means you request someone who does have write access to merge your changes.
my bad gang
No Meow wasn't talking about git there. Meow meow
@finite yacht Would you like to have a module that would do Financial mathematics using this?
New knowledge unlocked
any other suggestions that isnt cs50? He's a great teacher just moevs way to fast for my little brain
pause the video
Pause when you don't understand something, rewind or lookup for that point which you didn't understand and then move forward.
Because you won't be able to see your progress if you keep changing tutorials and motivation is important to keep going.
fair point
Maybe a book or other written material would suit you better?
😂
@finite yacht << Support for Percent Ranges: Allow users to calculate percentages for a range of values, making bulk processing easier. >> Maybe I would like to work on this but I need to know what is means. (I AM SO DUMBB)
Since you can't ask the teacher then search your question / doubt using either google or chatgpt
ai is ass i've heard been tryna avoid
ChatGPT makes me more confused that Wikipedia these days
See: Automate the Boring Stuff, Helsinki Python MOOC
will do ty
I loved this book
Not my experience but idk, ask it to search the internet LLMs are more reliable with better data / context
if you are asking it to search the internet then you might as well use google?
Meow, I use ChatGPT for many things but not for learning things I don't really know about.
it will scan the internet for me and then will try to condense the knowledge so it works better than googling a lot of times
I only use it for schedules, writing snippets of codes to save my time etc
why does condensing the knowledge matter?
This matter is actually controversial. Different people have different opinions about AIs based on their experience. Meow
ruff
llm to be specific
Yeah, that makes sense, you should atleast have a general knowledge of the subject or the area so you won't be misguided that easily
pretty good, i use it myself
Synthesizing useful information from the huge mass of it available online from traditional searching is not a trivial task. It's useful to have it done for you, modulo hallucinations etc.
? he said meow
Yep Yep! I don't discourage people from using llm
i will do it myself if its not the AI doing it, i mean my method always been searching the subject, opening multiple tabs and scanning the website for the relevant stuff
it's a joke
o
he is a cat, obviously
Meow?
ruff
perhaps there is a problem with technical writing then
just peed on my owners leg😛
are you an eastern european cat?
Haha meow meow. There is a script called rocketmeow that I made. I don't know how to use git or github
me either
well you know the difference between the two
Anyway, A.I is useful, but honestly its good for popular things
I learned about that in a meme and comment section
Meow is actually from South Asia. Meow
Sure. But even if the individual pieces of writing are all high quality, if there is a large amount of them, it takes time to read all of them and combine their knowledge.
Meow chose Vladimir because. Actually there is a long story behind Meow acting like a cat. I can speak lil Russian
Right
if the writing is high quality and doesnt talk about unnecessary fluff, then it reasons that the LLM is removing useful information in order to shorten the knowledge?
Because there is no single source of truth or knowledge
Nor in a book much less in a website
i guess sometimes you just want to learn how to use a function, and other times you want to know every possible ways you can use a function
Guys i want help
It's like seeing things from far to decide your destination. Once decided you can dive deeper with real technical writings.
Your immediate needs are probably narrower than the full scope of the full set of documents. And summaries are always lossy; they are useful regardless.
Meow will help, what happened?
If you have means to condense some knowledge, like keep what is similar in all sources but then highlights what is different, that is a more complete knowledge
still, isnt the ability to synthesize information and pick out what you need a necessary skill to learn?
I want to make a extension..using chatgpt which saves the link of whatever videos i watch in youtube so what can I do
Maybe? maybe
bookmarks?
humans will always need to do that as long as they are making decisions
youtube watch history
How can bookmarks saves the video of whatever i watch
Meow knows nothing about extension sadly. I don't even use them
It is for sure. I completely agree. I'm just saying that LLMs are not entirely pointless.
But instagram doesnt have watch history so
you said youtube
u said youtube only
bookmarks?
this is fun
i think he wants to autosave to make a virtual history
What about Instagram+ youtube only has watch history..it doesn't save the link automatically
What bookmarks gonna do
What do you mean by "save the link"? Like automatically download the video for archival?
I want it to save in Google sheet automatically
do you want to save some videos or every single videos you watch?
It's not about saving webpages sadly
You want the extension to see that you are watching a video and add it to a list that you can check later
he wants to read the link and write it into a spreadsheet for every different video
Save the link of whatever i watch in social media and save it in Google sheet
what is your usecase btw?
So i can know what i watch
Ok, but how useful it is?
u are basically creating a watch history right
To know what you watch
Yes
This is fairly doable if you restrict yourself to only using social media on a browser. If you use apps I expect it'll be much more difficult.
well i get it because sometimes there are very pretty girls in reels that u accidentally scroll past and we can't rewatch
it's impossible
what the fuck
.topic
Suggest more topics here!
Why you can't rewatch?
if you accidentally leave the scrolling session there is no history to rewatch it
you can only rewatch if you are able to scroll up back
true
😭
See guys I have different email id for different purpose..one for coding and another for something else so I only watch that kinda of videos in that type of email id like that so ai of social media only recommends me that only like that
🤔
Social media is full of that shit
hahaha i get it
Damn so much effort
So what can I do so i can know what videos am watching
What else I can do..
use that mode 🤯
What mode
The one which doesn't save anything so that nothing of that topic is recommended in future to you
You mean guest mode
Yeah
h
why is there no web dev servers 
there are , i dont know what you are talking about
https://discord.gg/474nEvJ8
https://discord.gg/VMukKVsD
these two are javascript servers , so a ton of webdev in there too
also #web-development but y'know... with Python
spammoment
has anyone used Positron?
Try asking the question directly in #data-science-and-ml . Don't ask if "anyone" has used it. Just ask what about it
I have a script running in my Task Scheduler but it keeps popping up the console window every single time, which is annoying. How do I make it run without showing up the window?
Currently its action is set with C:\path\to\uv.exe, arguments as run main.py
I tried with -q but it still pops up the terminal window
How about renaming it to main.pyw?
you might want to check stack exchange for suggestions
I'll try the .pyw
there is a suggested solution about checking "Run whether the user is logged in or not"
I'll have a look at that too
Ignoring me 🥲
This doesn't sound like its Python related
Where can I ask then?
Please read our off-topic etiquette before participating in conversations.
I tried .pyw. Still pops up. I'll try what zehata suggested
apparently, my uv was at version 0.6
the latest version is 0.9
and it has uvw similar to pythonw
upgraded, switched to using uvw, and it works
nice and quiet background process
thanks for coming to my TED Talk
is Fluent Python suitable as a second book for learning python?
I have a question
If i change something in a code
How do I cross check where else it will effect
So that the other functions that are dependent on the variable or function whatever does not get effected.
I cannot check usages with values being passed around dynamically I am unsure of.
Oh didnt know uv had a uvw
I would run unit test to see if at least the core functionality is affected or not. Otherwise, manual test each function one by one.
how can i do:
class a(Generic[A,B,C]):
b = a[int,str,list]
it says Undefined name 'a'
in ruff
hi guys
what ide do you guys use
i dont have a computer rn
so im just using online ides on borrowed laptops
but i’m gonna get my own soon
so i was wondering
type b = a[int, str, list]
i dont use the 3.12 type system
then, a is not defined
i'm just getting into python, not sure if this is the place to ask simple questions
not another option
😡
it's not an annotation
i think how to get help is it
that’s where i went
pycharm
What is that supposed to do?
true
save an annotation that using in a few places
i dont know "a[int, str, list]" is really ugly though
I see
.>
why pycharm
is vim good too
or vscode
those are the only other ones i know
if only Self and type were generic aliases man
just use a forward reference
personal preference
vim is good. vscode is good too. pycharm is good too. But if you're really new, use Thonny. It helps you visualize how the code works
"a[int, str, list]"?
yep
What happens if you define a before?
what u mean
Like if you solve the runtime issue by doing something like
a = defaultdict(int)
class a(Generic[A, B, C]):
b = a[int, str, list]
does the type checker complain then?
not working
from typing import Generic, TypeVar
from collections import defaultdict
A = TypeVar("A")
B = TypeVar("B")
C = TypeVar("C")
a = defaultdict[str, int](int) # !!!
class a(Generic[A, B, C]):
b = a[int, str, list[str]]
Type "defaultdict[str, int]" is not assignable to declared type "type[a[A@a, B@a, C@a]]"
hi Bruneian
that sounds like my name
but i’m not bruneian
i’m brazilian
hi
thank you for the suggestion
locals()["a"] = defaultdict(int) # shhh!
class a(...):
...
then pylance thinks that a isn't defined
i struggle with that too
but at a smaller scale
like idk how for loops work
a lot of the time
it’s like an ant starving next to a homeless man
despite the millions of ants it would take to make one man
the feelings the same
if that makes sense
hey man can you please not put an extra newline between every line of your msg, it's kinda spammy
if we had Owner and both Owner and Self were generic aliases
sorry
bad habit
What the completely irrelevant tangent
yeah that's not at all related to what we're talking about.
Tho, keep at it bro.
what
😭 dam
what x2
bro just wants to be included 💀

I'm already feeling so exhausted and its only Wednesday.
what a week huh
fr
me every week
the week isn't over yet u know
you'd probably age faster exponentially that way. Slow down
.topic
Suggest more topics here!
honestly i think i get it that i can't explain it with words
🤷♂️
somehow i just find a way
xD
u learn about something suddenly u find yourself in some forum or a discord server, some github repo u find intersting
or for example how i've made the pycharm plugin, there was a githubb for a template for making plugins
i could say search for documentation or stuff like this bbut there isn't a fixed way to learn something i dont know
i think the greatest skill in that is that i dont trust chatgpt for example, i use it, but i dont trust it
on the contrary when my mom gets a sms saying she has won 10k$ or whatever
the ability to recognize if something is good and question stuff, thats what i think trully is important
can any1 review my prog to say if it's reasonable for a benchmark? i.e. if it's doing anything silly that is killing performance by accident: https://paste.based.lol/J0
jupyter is soooo good
i been using notepad++ for years and now i use jupyter
jupyter nombr 1 best
is that on linux?
does it have dark mode
yes
what does it have that vscode or other ides dont
idfk i never used the other ides , i only used notepad++ and now i use jupyter and from my biased standpoint jupyter is the best
alright
it's not an ide
That ain't an ide
jypyter notebooks are great for tasks where what you want is closer to a very fancy repl
Integrated Development Environment
Notepad++ is just a text editor, not an environment
e.g. it's great for stuff like data analysis and whatnot
if you can type code and do code stuff its an ide whether you like it or not
Its literally not
tell me smart man, why is it not
is a repl an ide?
i do not know what that is but if you can do code stuff then yes
It's like calling pen and paper an advanced image editor
is !e an IDE
No, that's an interpreter
idgaf what you guys saying if i can type code and run it it's an ide whether you like it or nor
$ python
Python 3.12.12 (main, Oct 18 2025, 05:45:20)
[...]
>>> print('this thing')
this thing
I wasn’t seriously asking
can i save the code?
if not then it is not an ide
(more like, is discord/pydis an ide because we have !e?)
best ide
if you can do a project from start to finish then whatever you used is an ide
You're wrong, if you don't even wanna take into account arguments against it your just denying you're wrong. You know you're wrong but too much of an asshole to admit it
Text messages in discord are saved, is discord channels an ide?
if you can extract these messages and save them as a .py format and then run it on terminal then yes
if you can get a project done with it it is in fact an ide
That’s a stretch
Hi guys, is there anything i can improve on my github?
If I manage to draw in ms paint so the binary file it produces can be read as python code, does that mean it's an ide?
Indeed
are we seriously discussing the definition of "IDE" for the 10000th time
yes
yall 🙏
pray tell, what does the I stand for?
a very unique one that is
interactive
nope
what
What does the DE stand for while we are talking about it
I don’t think any of us think the editor vs IDE thing is productive, but this is outrageous
integrated
development environment
is it?
im not ide'ist so i wouldnt know
An environment, a collection of tools for development, syntax highlighting, auto completion, debugger. Have you seen a debugger in notepad?
You lost the argument the second you started typing, give up already
my environment is one which requires me to get my code to be saved and run on terminal
So you admit you don't know anything about ide's
why are you being arrogant
you couldve used this chance to educate them about what an IDE is compared to an editor
and ur whining about some "you lost the argument HAHA"
Because at this point I know he knows he's wrong, he still keeps going just to in some wild way maybe be right if you bend the rules a bit
i never used a debugger because i can just change my code a bit and see what's going on
We've gone from helpful to hopeful
are u on linux
Hopeful he's maybe right sometimes
Loser mindset tbh
That approach is quite inefficient. I would suggest to look at more evidence based approaches
let's chill
thats true, the only wrong thing about me is the fact that im too lazy to change from windows to linux
I just copy pasted what he said
yall can both chill
Nah I'm fine
it works and has always worked, the bread and butter are the things one needs
It's entirely up to you
the point of ides is that it's an editor with deep integrations with the language and similar development needs
I've already mentioned the definition of an ide twice, him ignoring it is up to him, Ive tried to take the chance to educate, he declined
Hence the name
you can bring a donkey to the river but you can't make it drink
🗿
Hence i stopped trying to educate
jupyter notebooks are more of a "literal programming" environment
jupyter notebooks can prevent that you train your typing muscle
it's not meant for creating full-on programs, but a place to do interactive stuff
i prefer figurative programming
My mind is my editor, i do theoretical programming
i.e. it's closer to a very fancy repl
i have a theoretical degree in programming
that hasn't stopped data scientists from asking for scheduled notebooks

that implies the existence of unscheduled notebooks
(trying to use jupyter notebooks as an ide is also a bad idea as it allows you to run cells out of order and repeatedly)
no one ever expect the unscheduled notebooks
I would have gotten one myself last month but i accidentally started thinking about a while true loop, I forgot to add a break before i started thinking
i.e. you can have a notebook that "works" but only because it worked in the order you ran/edited the code
notebooks are great at a bunch of stuff, but being an ide is not one of them 🙃
that reminds me - what do users of the community edition of pycharm do now that you have to pay?
Wait, did they make the open source program, paid?
How, why, what
yeah, only pro version available now
Is the source still available?
download vscodium
You don't have to pay
If only you didn't need the full visual studio code to support live share
whats live share
oh
https://www.jetbrains.com/pycharm/download/?section=windows
"Free forever, plus one month of Pro included"
Google docs live collaboration type thing
i use git btw
I had a dream where i ran out of variable names
They consolidated it into one version that has both free and paid functionality, you can still use it without paying and get the community edition functionality
It's better when collaborating on websites or to help debug something
i am not well informed then, sorry
It's just convenient for smaller sessions
you can checkout a remote
Live collaboration has it's upsides
But I only use it when teaching or helping
how often do people help each other debug, in the workplace?
all the time
I ain't got no job
i always had this impression that people who have jobs are able to solve any problems given enough time
Well thank you for assuming I've got a job
but it's better if 2 people take less than 50% of that time
I feel smart now
sure,, but sometimes a colleague already spent that time.
wdym
how bad electron is for writing a simple gui app ?
i only hear bad things about it
If they have solved the problem, why would you spend time solving it again
a problem that needs time solving was already solved by a colleague, an that colleague happens to now the answer already == time saved 🙂
why is there a regression
imagine opening a new chrome instance every time you want to open a website
not a new tab/window
a completely separate instance
what about qt? is it good for mobile app development
it's not exactly common
It's an easy way to create an app if you know web frontend dev
It's a team sport
i think i should just learn flutter then
Qt's mostly done through their web engine nowadays too
You also have to consider that someone senior has seen more issues and can find it faster than a junior.
And often, you don't want a junior to spend days being stuck. So you want to time bound the issue.
And then you have the tunnel vision and rubber ducking
For anything where I'm figuring out business rules I'd also much rather bounce ideas off of someone do we don't overlook something before validating them with a client
im not talking about junior/senior though
i meant like colleagues of similar experience levels
junior/senior on the same team are colleagues
Just write pixels directly to the graphics card
same ideas with people of similar experience
well thats not what i meant to ask
pardon my phrasing earlier
I might
I lost my original script snd all I have left is an exe of it 😭
do you help your colleagues debug over the shoulder?
yeah
thats... interesting
🍐 programming
there is no shame in that
nah, back when i was interning i dont usually see my seniors doing that
maybe they were too shy or not the same culture
i didnt mean that it's shameful
Where i'm at rn every offfice has an extra chair so someone from a different office can pull up and sit beside you
different companites different culture i suppose
working with someone doesn't mean you would never find it on your own
just the one chair for the whole office
i should try that
hot-chairing pair programming
Or room in the office, not sure how you would call it in english
6 ppl in a room, 7 chairs
the most collaboration ive done with other people is over github and slack
People will come from different backgrounds, degrees, experiences, their own favorite tools.
So it can be great to exchange ideas and tips and ways of working
like you would notice they use this fancy new CLI or shortcut or theme and would probe about it.
Or discover a feature of the debugger you never cared to check and try
in our area we even have a vacated desk
it's a significant reason why i decided to join discord programming servers
time to start your twitch or join some voice channel and collaborate
"you should try vim"
"have you heard about jj?"
Let me alias emacs=vim
jjk?
there is a vs code plugin called that for jj :P
yea yea yea yea yea
"chat, does this line make sense?"
I need to try jj, I was happy with pycharm's git integration, but had to switch to vscode and the git in here is kinda crap that I do half the things in cli anyway
"noobmaster69 welcome to the stream"
join the cult 🥰
You might solve it given enough time for sure but also might not have the privilege of enough time depending on the size of the codebase etc. In a good company there's teamwork.
That's at least my experience.
could any1 check my prog to see if it looks reasonable as a benchmark https://paste.based.lol/J0
just want tom ake sure i didn't introduce anything that will make itway slower than it should be
Hi, I started the process of creating a proposal with the goal of writing a PEP. Do you see any use/point in it?
https://discuss.python.org/t/proposal-for-a-new-way-to-overload-methods-by-arguments-and-whether-it-is-synchronous-or-asynchronous/104902
Example
import asyncio
class Example:
@coroutinedispatch
def process(self, x: int) -> str:
return f"Processing integer: {x}"
@process.register
async def _(self, x: int) -> str:
await asyncio.sleep(0.1)
return f"Processing integer asynchronously: {x}"
@process.register
def _(self, x: str) -> str:
return f"Processing string: {x}"
@process.register
async def _(self, x: str) -> str:
await asyncio.sleep(0.1)
return f"Processing string asynchronously: {x}"
example = Example()
print(example.process(42)) # Processing integer: 42
print(example.process("hello")) # Processing string: hello
async def main():
print(await example.process(42)) # Processing integer asynchronously: 42
print(await example.process("hello")) # Processing string asynchronously: hello
ok, but one can store coroutines and await them later, and this will break that:
async def foo():
..
some_coros = [foo(), foo(), foo()]
for coro in some_coros:
await coro
What does _ func name do?
It's an "empty" name, it's like saying "It doesn't need a name"
Ohh so they all r named process?
_ usually used when name won't be used
e.g.
for _ in range(5):
print("hi")
i'm not using the loop variable, so i indicate that by using "_"
Yes, it is a method overload, but considering the context from which it is being called, if it is called from a synchronous context, it returns the synchronous functions; if it is from an asynchronous context, it returns the asynchronous functions.
But my question is how does it know which method to overload?
This is only a problem if you need to mix contexts; if you need to save asynchronous functions from a synchronous context to execute them in an asynchronous context, I understand that the logical thing to do is to constantly be in an asynchronous context to avoid jumping between contexts.
But u only call process method, why doesn't it say method doesn't exist, why does it overload that method 
By applying the decorator @coroutinedispatch (coroutinedispatch is what I'm proposing), you indicate that argument or context overloading is possible, and you apply it to other methods with @method_name.register
i don't understand how it's a mixed context
From a synchronous function you call another asynchronous one; you are in a synchronous context and you are calling a function from an asynchronous context.
In some libs I've seen them use,
Example().some_method(with_async=True)
Think they do something similar.
But maybe that can solve this problem?
Does this exec the foo() methods in lost as async???
Will have to try this
The closest thing currently available is to use the singledispatch function from the functools library and add an argument like that.
Yeah maybe that's why I've only seen that
chat who tryna buy my doordash
Here is the complete code for the proposed class that does this; there is still much room for improvement, but it can help to understand what I am proposing.
https://discuss.python.org/t/proposal-for-a-new-way-to-overload-methods-by-arguments-and-whether-it-is-synchronous-or-asynchronous/104902/3
def make_some_tasks():
return [asyncio.create_task(example.foo(i)) for i in range(4)]
ok, but, like, this happens pretty often
dispatch gonna have a hell of a time
In this case, you would have to make the make_some_tasks method asynchronous so that it returns the asynchronous methods.
This is intended for libraries that have different code for the same method when it's synchronous and asynchronous, and that manage this using:
sync: <name_of_method>
async: a<name_of_method>
With this, in the documentation and from the user's perspective, it would be the same method, and the appropriate one would be executed depending on the context.
alternatively, you could just have separate sync and async function names so you don't get a surprise bug
i mean i've seen this before in curio
curio/meta.py lines 118 to 122
def awaitable(syncfunc):
'''
Decorator that allows an asynchronous function to be paired with a
synchronous function in a single function call. The selection of
which function executes depends on the calling context. For example:```
but i don't think it's good design
but i guess i'm not who you gotta convince anyway
All opinions matter. There are very few people who can decide whether this gets included or not, but it's important to discuss as a community whether you think it makes sense, whether it could be useful, or whether it's just garbage.
These changes stem from my experience working with Django, where I realized they would greatly simplify my code and could also significantly simplify Django's codebase. However, I'm not sure if this is just my specific case or if other people might also have this thought.
til about singledispatch
insane airball
Hater
I am incandescent with hatred, but I could never hate Python. I am, at worst, occasionally mildly annoyed by it.
Like, yeah, let's have a convention that classes should be in Pascal, but then have the builtin classes named in lowercase because "they're used like functions".
pretty sure it was just because the classes were provided before there was an established convention
Hm. Makes a sense.
I'm also slightly annoyed that lambda is six characters.
Lambdas should be short. The length of the keyword is almost self-defeating in that purpose.
Yes, you could just def it up with something short.
looks away as they close the ts file in front of them with 20+ line anonymous functions
(╯°□°)╯︵ ┻━┻
same, but in java
My usual gripe is the difficulty of navigating docs. Not the docs themselves, just the navigating the hierarchy of the stdlib, classes, etc to find something. (Not a new rant, just since we're venting spleens)
I don't think I've ever opened the PDFs.
I'll look at the html docs, because they're what gets presented as the foremost.
But when I was starting out, yeah.
library.pdf is the Python bible.
I am very spoiled by the consistency of Rust docs, yes
reference documentation really benefits from every kind of item being documented in the same way
i accidentially made the most cursed guess the number game (in my transpiled language so... this is kinda off topic but eh...)
Cursed how?
my recent example was from collections.abc: some methods of abstract classes are listed in a table (without parameter counts or names or explanation), some are documented later under each class; and for the number and variance of generic parameters you need to see a completely different page, namely the deprecated items in the typing module
imp std/random.pypp
fn main() -> int
assert_fix: false => int num=random_randint(0, 10);int guess;while (guess != num){std::cout << "guess: ";std::cin >> guess;std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');if (guess > num){std::cout << "Too high!\n";};if (guess < num){std::cout << "Too low!\n";};if (guess == num){std::cout << "You got it!\n";break;};};
end
so... umm
can you say more about the difference? Isn't it the same content?
The html docs are more segmented, for one.
The pdf files, while there are a few of them, aren't as segmented.
I think.
It's been a while and I may be rose tinting it.
anyone who's knowledgeable abt monte carlo simulations😭
tbh, i've never looked at the PDFs, but they are built from the same pile of .rst files
what would you ask them?
Madam what is a monte carlo simulation? I only know monty python :p
I first thought it was that uh equation veritasium made a video about which when graphed gives a 3D mandelbrot or something
Hi everyone! I'm Ankita and am new here
I’m a full stack developer with over 3+ years of experience ( React, Next.js, TypeScript, Tailwind, Shadecn , Node.js, NestJS, PostgreSQL, MongoDB, AWS, Docker, Firebase , Strapi , Python , FastAPI ,MCP , Agentic Workflow and Automation , even used may AI Based tools for productivity etc )building and contributing to various tech projects. I enjoy solving problems, collaborating with teams, and working on meaningful products. I’m currently exploring part-time opportunities where I can contribute alongside my current role.
If anyone is working on something exciting or knows of any opening, I’d be happy to connect and explore! Looking forward to engaging with the community 😊
Welcome!
Thank You
guys what after RESTAPI?
i've learned that on flask
so if in a particular company they work on MERN then i have to learn RESTAPI on MERN?
or i'm good to go
Express.js is restful so yes, this is not a python question fwiw
What's an easy gui library that even a brain dead monkey can understand
Ig tkinter
why
heh turtle is probably the simplest but it's not a serious library, what do you need a gui for?
curious !
Monte Carlo is essentially running a simulation or model many times, and recording results. (More formally, it's really about sampling)
streamlit
im fairly sure that's a joke question no wait, it's a legit question
can you tell us more about the project you are building?
So its not a simulation, got it
I think that's a normal phrasing.... a Monte Carlo simulation really is: I'm running a simulation many times, to understand how the results are distributed
i mainly just need the a search, and autofill function. Users will look up an item, the app returns the item's cost, prty simple
matplotlib.py for data
fair enuff, thanks @silver plover
a monte carlo simulation also implies that it is not deterministic, right?
you are always generating randomness during the simulation
Well, yah, if there's no distribution whats the point?
@grizzled solar 
the name "Monte Carlo" is from the randomness of roulette tables in Monte Carlo (I think)
I think it's implied that the search space is too large to exhaustively search, too
Iirc, the term came about from Manhattan project... let's see if I'm right
oh interesting
TIL
when i checked wikipedia for monte carlo, i only got the wiki for the place and the intro was so short, it was basically "monte carlo is a place... there's a casino there... yeahhhh"
we are both right 🙂
that's its namesake
the technique is named after that place
yeah
An early variant of the Monte Carlo method was devised to solve the Buffon's needle problem, in which π can be estimated by dropping needles on a floor made of parallel equidistant strips.
I don't think I've seen that method of finding π mentioned before. Nifty.
theres a numberphile video on that iirc
sounds like something they'd cover.
In finance, we often use Monte Carlo to consider the effect of randomness on portfolios: the idea being that you can use the statistical characteristics (namely volatility, or stddev of returns) to consider different 'equally likely' outcomes
is fuzzing considered monte carlo?
You'll find a lot of similarities between physics and some economics math.
thats what my thermodyn prof said too lol
I wouldn't think so: the goals are different
If you're interested, look at the black scholes equation
I need a tiktok view bot code
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
Eh, better to just explain 🙂
We don't help with stuff like that.
Why
Why would you think 'Python discord' is the place to ask?
This isn't a job posting board. It's a community that helps you learn how to code.
Ok
*spit take*
How rude would it be to say you actually need engaging content
hawk tuah
.topic
Suggest more topics here!
i hope to do so soon
Yes, I ain't telling. Users how you get bugs reported.
I did. And then I was asked by a major company to pull it. 😬
Eh, I’m not a fan of that one
They are in the right place to talk about code
When calling a method from a class instance (ie. instance.method()), the instance itself will automatically be passed as the first argument implicitly. By convention, we call this self, but it could technically be called any valid variable name.
class Foo:
def bar(self):
print('bar')
def spam(self, eggs):
print(eggs)
foo = Foo()
If we call foo.bar(), it is equivalent to doing Foo.bar(foo). Our instance foo is passed for us to the bar function, so while we initially gave zero arguments, it is actually called with one.
Similarly if we call foo.spam('ham'), it is equivalent to
doing Foo.spam(foo, 'ham').
Why is this useful?
Methods do not inherently have access to attributes defined in the class. In order for any one method to be able to access other methods or variables defined in the class, it must have access to the instance.
Consider if outside the class, we tried to do this: spam(foo, 'ham'). This would give an error, because we don't have access to the spam method directly, we have to call it by doing foo.spam('ham'). This is also the case inside of the class. If we wanted to call the bar method inside the spam method, we'd have to do self.bar(), just doing bar() would give an error.
oof

It was that good huh?
now im really curious
Uhhhh "good" is questionable. Easy to read, definitely. And that's how I dug my hole. And now I'm working with them again, so ehhh didn't end poorly
I'm wondering why a company would tell you to take a pypi package down
I can DM you if you want
What did you do 😭
Played the game a little too hard 😄
Lol
I had a GitHub webhook tell me someone had forked my repo once
Their bio said “security researcher”
I braced for a security report but nothing ever came
Of course!
Hopefully you have that time
that time?
It doesn't even have to work just make a PR
Bad practices, make an issue if you know you can't write the code. Look to see how someone else would write it, and seek to understand how it works honestly
There's lots of ways to do financial math in Python. What do you actually need?
ha
that's a lot of packages
https://github.com/bmc/munkres
Python's Munkres implementation got abandoned...
Time to take ownership with a kickass fork.
their help💀
what do you need
Be the PR you want to see
yes, but being upfront with your specific question helps
Actually I'm rewriting the implementation from scratch, aiming to see good benchmarks at the end
What is munkres?
"Hungarian Algorithm"
What is Hungarian algorithm?
munkres
It's an algorithm that solves the linear assignment problem with minimal cost.
not with minimal cost
but fairly efficiently
(What's the linear assignment problem?)
The problem is called like that
with "minimal cost" did you mean of the cost function, or computational cost?
because the jonker-volgenant algorithm will give you the same solution as the hungarian algorithm at a lower computational cost
the total cost of assignments minimized by the optimal solution
ok then yeah
Is this some TSP like problem?
no, i don't think there's a guaranteed optimal solution for TSP in the general case
this is all english...
hello! i just upgraded my bike, new rear and front suspensions (both are pneumatic, not coil), 4-gear front, new shifters, wheels, seats, etc etc
Wait omggg, you were the one i talked to abt this before too😭
I mean...😶 I kinda want to explain it clearly but it seems i forgot how to explain it clearly LMAO
In bacteria
Nice, now I need to learn a new algorithm...
I heard the Hungarian is parallelizable tho...
it's more like "i have N people that can do any of N tasks, each at a cost c(i,j) (for the ith person, jth job). who do i assign to each job?"
I too love to pretend I'm not using a microwave to cause skin radiation 
ah, i haven't checked anything regarding parallelization of the algorithms so i can't comment there
Casually I'd assume there's a linalg answer to this
is there any problem you are facing?
there is one such flavor 😌
or rather, what do you need help with?
Apparently scipy.optimize.linear_sum_assignment uses a modified Jonker-Volgenant algorithm
do you have some formulae that you are planning on using?
Yes
are you familiar with the random library?
you might want to post screenshots of the formulae in one of the #ot channels
I need the simulation itself, so like i was thinking if github might have one but idunno how to use it so i still haven't found one
Wait a minute
What's that channel?
any one of the Off-topic / General channels
transport_coefficient = 0.9999 # this is a constant related to the tissue i was simulating
rng = 1-torch.rand(N) # this is the ξ in my formula
step_lengths = -torch.log(1-rng)/transport_coefficient # this is the formula i was given
ignore the torch part, that's not exactly related
and the formula i was given (written out) was
-(1-ξ)
l = --------
t
essentially i generated a random number ξ which i then feed into the formula, and this gets done multiple times, e.g. by using a for loop
@grizzled vale this is one of the variables (in this case, the step length) that is used to calculate the movement of a photon
What is the question here? I've gathered that simulating bacteria was the topic right?
@grizzled vale so your formula looks like this yea S(D) = e^( -aD -bD^2)
simulating ionizing radiation on bacteria
actually we should open a help thread
this is filling up #python-discussion
why pytorch?
it was what i knew then
this is old code
ignore the pytorch part
today i would use cupy
I mean, I suppose it doesn't matter, it's a lot like numpy anyway, except you have the option to use CUDA if you have hardware support
I would have thought there's be an easier formula if you're just collecting reproduction data but I guess for a simulation pytorch makes sense
i was using google colab, which does have cuda t4s
I feel like cupy fell off the market once pytorch and jax arrived
Yesss
i would call them gpgpu libraries?
Basically GPU-enabled Numpy operations.. https://github.com/jax-ml/jax
with autograd
open a help thread it looks like this might be quite a long conversation
Okayyyy, got it
Cupy is specific to CUDA by my rough estimate based on naming convention.. https://github.com/cupy/cupy
it's basically literally numpy on the gpu
"or AMD ROCm platforms", I stand corrected
meh, no point in even bothering with rocm anymore
does pytorch not integrate this?
might as well just use google colab
they even suggest import cupy as np I think
same deal
That's what I figured
In here right? #1035199133436354600 😅
yea
yeah, Pytorch also has broad API parity with numpy
yeah, it's pretty nice
I mean, if you want, you can rawdog it by writing compute shaders via opengl or similar
yea no
might be more lightweight if you wanted to distribute your program and had a specific need for some operation only
seems like one of those things that sounds easy until you try to do it
or like if you just needed something very custom
like, cupy also lets you write your own kernel ops
but again, I don't know why someone would want to use cupy when you've got pytorch and jax
I suppose if you have existing numpy code it might be a lot easier to just import cupy as np
i was told download size?
hmm, I guess jax is a "research project", so, yeah
and I imagine pytorch tensors don't have all the API capabilities of numpy
this is the thread https://discord.com/channels/267624335836053506/1440681854008164393 i feel like it doesnt need monte carlo, maybe someone can confirm or correct me
(not to mention that some of the behaviour is slightly different)
I mean, monte carlo is quite thematic for something radiation-related, lol
check the equation
the post is not self-contained 😭
(and doesn't link to where it began in this channel either)
Who is she she is answering non stop and helping everyone society needs these type of peoples💔💔
it's cause im unemployed
in this economy?
Who
Felt
But it's almost 5am here and I'm studying for an interview for a role with 50% travel
Well i ain't got no job either
Seeing way more experienced programmers unemployed gives me a bad feeling 4 the future
any1 can able to have a quick look at my prog and see if it is ok as a benchmark? is it doing anything unusual that could make it slow? https://paste.based.lol/J0
I think we're about due for a LLM market correction, starting to see headlines of hedge fund managers betting against it. Hopefully CEOs recognize that replacing employees with haluci-bots was a mistake sooner than later.
or: is there some small change i could make that would make it dramatically faster?
is this a qsort benchmark?
They're deranged. Once the hedge funds realize we're heading towards a financial crisis, it's already too late.
no
ffi benchmark. qsort is good cuz it will invoke the callback a lot. and the callback calls back into C (labs)
so a lot of calls both ways
but ts slow asl so i wonder if i did something wrong
and youre doing this a lot so it makes sense
i benching it vs my vm usually cpython crush me but on this one im 5-6x faster.. . doesn't seem right
Doesn't that suggest cpython is the one doing smth wrong
yes
could be but that seems less likely
Burnt
What was hardest question?
pwc?
The aptitude one, i was asked to not use pen and paper and solve within 1 minute
I could solve half only
What was the Q?
It was like, i have 8 balls same size, 7 weigh same, 1 ball is slight heavier than the rest. I have a balance scale to measure weight but i can only use it 2 times. I had to find which ball was the heavier one
Ah... similar to the water jug problem.
Yeah water jug was asked in another company interview i sat for
it's really a question of: 'have you ever seen this type of problem before'
with 8, you measure 3 v 3, leaving two aside. (the rest is left as a problem for the reader)
How do you solve that problem?
i think , group 3 v3
it's essentially a binary partitioning problem, isn't it?

not quite, because that would require 3 comparisons
but you can split into 6 and 2, and then 2 and 1
Yah, log2(8) wouldn't work
Yeah, I thought a bit fries brain
Nah, it's easy for us to think of it without the pressure of time.
and the interviewer
The thing is, I can build and develop end to end stuff but when it comes to logical stuff like this, I am cooked
Yeah the interviewer was just asking me again and again to just explain my thought process behind solving
He wanted to see how i approach the problem
Do a course on aptitude questions , you just have to get familier with different flavours of the problems
you honestly dont even need a course , just solve problems on online sites and its good enough
True man i could hardly think about anything during interview i had a lot of performance anxiety
Thanks
jfc logical test for an interview...
its not unheard of
Yah, that's the bad part about interviews: staying calm
well it should be
Yeah man u remember we were talking some days ago about this? I told u i appeared for an interview but it was very hard
That sounds like a good interviewer: I don't ask questions to find out what they know, but what they think
Yeah this staying calm skill is immensely powerful
meh
its fine to slide in a trick question here and there apart from the usual interview questions to judge how the candidate thinks
just dont treat that trick question like it has any real weight on the interview
depends largely on the type of work you'll do. maybe your tasks will be very math/logics heavy
Yep i still got shortlisted even after I couldn't really arrive at the solution because he was asking me how i thought about
Now i feel like interview is not about acing every question but about how to behave and react
this is often the case. interviewers sometimes give out difficult tasks just to see how you deal with pressure, if you can approach problems systematically, if you ask questions, etc
True, this is a great experience I've got
not all interviewers are like that btw, some will be very douchey about this
you can also take that as a hint regarding whether you really wanna work there or not
I was lucky i got a good interviewer
Yep i felt the interviewer was very friendly and allowed me to relax a lot during the interview because of how he behaved with me
honestly do you even have that many options in today's job market 😂 ?
fair enough
at least you'll be able to mentally and emotionally prepare yourself for what you're getting yourself into
Does anyone have any experience of working at pwc here?
and because of that there are a lot of companies treating employees like shit and dont care if they quit because they can just grab another one from hundreds of others
Yeah this is somewhat correct
One of my friends got selected in a company for some data science role, he got the offer letter and stuff and date of joining
When he went to the office on his first day, he found out that he was shifted to sales role
💀
Only on his first day he realised he was shifted to some sales position
Man companies these days are strange
Good Morning all. Does anyone have any suggestions for modern alternative to using settings.ini for persisting configuration values in code? I presume JSON (or some markup) is a more preferred format nowdays, but are there any good libraries for configuration management along these lines?
toml seems pretty popular
Good start.. have not heard of it before... will look it up. Thx Stele
toml is the modern ini replacement
GM. I cannot figure why this is giving me a syntax error (ignore the #'s)
patient_name = "John Smith"
age = 20
is_new = True
#print({patient})
#input is a built in function.
patient_name = input("What is your name? ")
print("Goodday " + patient_name) # Here we've combined two (2) strings)
#what is a string? "+" is a combination/concatination
#an expression is a piece of code that produces a value
show the whole syntax error
Hi guys, in your opinion, what are the best libraries for reading PDF files that contain tables?
File "<stdin>", line 1
SyntaxError: invalid syntax
wait its been 14 days