#python-discussion
1 messages · Page 510 of 1
by "take action" I meant "change the code". Of course I reply why I didn't when I don't 🙂
For something like this, maybe start with a side project as a minimal proof of concept
Phew. I've seen people who just click "resolve" without doing so much as a reply.
Well that file is on a sandbox device
And with that, I'm off to bed. Work is coming sooner than I'd like in the morning.
So long as whatever you're sending over the queue is pickleable, you should be okay. @hot junco
(Unless they're expecting bidirectional flow)
I'm definitely of the opinion that code reviews are the best tool we have for knowledge sharing. Using them to correct someone's misconceptions is a great use of them!

I always tell new people - look at the PRs. Even if you don't feel competent to comment, look at the PRs and what other people are saying and what changes are going in.
So what I made is a multiprocessing function that can start 5 processes not including the main process, but I want the processes to be able to share data on one variable between all active processes and the main for heavy multitasking.
pickable?
Basically a single communication line where all data can be shared IF asked of the program.
There's a pickle module for writing python objects in a binary format so that they can be sent to a subprocess (which is underneath a binary stream to each subprocess). It's a widely used thing for python->python object copying.
You want each process to be able to modify the same variable, such as that all other processes can see the result?
Per the pickle module. But BillyBobby is right to point out as to if this dictionary is supposed to be a shared state, or just communication of information. If you want a shared state, there are a few classes in multiprocessing for that.
But it still has to be pickleable.
Yes, so that if a task requires multiple processes to run on seperate "cores" (as I call them), they can share the live data to achieve said task when necessary
I agree. And it's usually something to bring to a standup, round table, or other team meeting. If y'all have a knowledge base, then it's as simple as calling out any changes you make to the knowledge base and starting a thread elsewhere about it so everyone can ask/answer as-available.
Any shared state is virtually shared. It's still cross communucated across processes.
Im gonna be honest, Im VERY unfamiliar with all that. I through myself into python barely a year ago
How so?
pickle and pkl always get me (I know they're extremely different, but they're pronounced the same way)
It's not shared memory like in the threading module.
It's communicated across processes.
I don't understand the technical details, but I expect there's caching and update callbacks to update/communicate things as needed.
It might just live entirely in one process' memory and readwrite from other processes might be pure communication with the one authoritative copy.
That communication is why everything you store in this shared state needs to be pickle compatible serialisable.
It will tell you if it isn't.
So is using a dictionary variable in a multiprocess.Queue setting a viable way to share a data sharing and modify?
You can communicate state, but modifying that at one end will not affect those at the other ends unless you do it explicitly.
Explicitly?
Communicating the updated state.
You're transmitting copies of the data. Like if I have one page of writing and I e-mail it to you. You editing your copy doesn't alter mine.
You'd have to email me back with the updated copy.
Emailing is the queue.
So I have to make sure its constantly transmitting the new data.
or at least every time its updated.
Unless you use one of the "shared" state classes in multiprocessing, of which I don't think there's a dict like.
!d multiprocessing
Source code: Lib/multiprocessing/
Availability: not Android, not iOS, not WASI.
This module is not supported on mobile platforms or WebAssembly platforms.
Yeah I read up on that and I dont remember seeing any dict in the examples. Most of what Ive read is mainly for multiprocess to main process communication, no multiprocess to multiprocess to main process sharing and communication.
Hm. I'm just looking at the managers part.
It doesn't look straightforward. I'd have to stare at it and chew.
Wow, looks like I wasnt the only one.
Yeah, I think this person is describing exaclty what Im trying to figure out.
It looks pretty straight forward to me. If you take a dict on a manager it looks like both processes can modify and read from it seamlessly?
I get easily overwhelmed by information.
Valid
Yeah but I was detered by the fact that its talking about data sharing between a parent and child process, not multiple child processes like Im trying.
I would imagine this works for multiple
Thanks for sharing that old forum though. It might have some ideas I can implement into my project,
I would just have to cake it apart
As a general idea, I am partial to cake.
🤦♂️ take
sorry
it's fine.
i see



ISTR that with multiprocessing all the processes are children of your initial process. So I'd imagine (I've never tried this) that if you can share between a parent and one child you can shared between all.
I'm thinking some piece of shared memory here I think.
I can still add a lot more stuff
Let's see how much I can learn about pyside with just a tic tac toe >:)
honestly that's a great way to learn. Build something, and then keep adding and modifying
but it is still helpful to start new things so you can remind yourself of all the setup too
chat now i made coding fun asff
I'm loving it, because it teaches you in a practical way and it's super fun
it taught me the most about classes and inheritance
Yeah, my main project is a discord bot I add stuff to periodically, but these "side quests" are incredible too.
It's teaching me a lot about organization and using multiple classes together to build something bigger :3
fashoomp and saber , let's say that I want to import a library, but for example, a mathematics library. How do I search in libraries? ?

depends if you're referring to standard library or 3rd party ones
google or github
You have to investigate what you need and what suits your needs
wdym by 3rd party one
python comes with modules (the standard library), like you could do import math without having to install anything special
If it's built-in (default) or you have to install it (3rd party)
but people are also able to package and release their own libraries for you to install
ik i don't have to install anything special but is there any other library than math
oh i understand it now
it really depends what you want to do
numpy comes to mind, that's a third party.
think about what you want to know, then do a bit of research to see if a library exists to achieve that
yea
package
!pypi numpy
(for example)
This reminds me that I want to make this exact command but with GitHub repos...
oh alr then I'll go Explore by myself .
Well, I now have homework for after I finish my TicTacToe

First of all, what do you want to build?
it's weird , like a college professor that ask you about very hard math
I think they're saying some sort of tutor program that asks you math questions
well there no problem i have cuz you and fashoomp solved my problem
nah not like that i mean college math
and i want to make a thing if you get 4/10 ( you failed )
if (5/10 you're on the edge )
and like that

nah i need to make hard things by myself to become better
do you already know what sort of questions you want to ask?
why do you think you need a special library?
My nap was too long and now its night and I can't sleep
I've never seen chat at this hour before
Oh
i don't want a special library but i thought there was only the library called math
But what kind of math you'll use?
idk lol

it's a bit hard to search for something if you don't know what you're looking for
but probably i want to make very hard math equations
You'll have to make a plan to follow
yea fr
i made a plan i just need to make it rn
After that, it's a lot easier to make something
A more detailed plan.
what sort of things have you already made?
well yea ur right , if i found a problem in my code I'll ask y'all
a calculator, a barista and much other things
You can make a #1035199133436354600 thread anytime you need assistance
Barista?
I haven't read what's in this section before. Thank you.
yea a starbucks barista
how long did it take u to create a calculator

well it was easy but you can say it took me like 2 hours ( i was a newbie )
so cool
night bro
now im better ( im using bpython cuz it has colors)
good night twin
ty
❤️
np bro
:))
^^
chat is there a library called History ?
out of the question
we were just asking!
Are you trying to make one?
nope i thought there was but there was none :(.
idk if any are explicitly "History" but there are over 10k
ty .
damn bro just shared a hidden gem
I showed you pypi moments ago 😅
well yea but i didn't understand what u said ( i didn't want to be a bombo . sorry twin )
Did you click it when I linked it to you?
nope , there was no link
the professor thing worked but it has some problems
it keep repeating the questions
good morning,
ready to learn again!
gm wizard
Hello!
Hi
gm
ready to grind assignments again :C
all the best
😔 I’m a gamer trapped in real life
Who else yells “+4HP!” after eating their breakfast in the morning?
i dont yell it... it just show on top of me
I dont but if I dont get enough sleep or eat breakfast, I will talk in simlish
That's just hypoglycemia
fun :D it’s a good creative outlet (also it makes people around me think I’m smart 😈😈)
a fish simulator game
Money
You’re in the wrong place then my friend
I fear you're alone on that one
🤑
Who is actually responsible for convincing the unaware that programming is in any way related to 'hacking'
That explains the weight gain
Who is actually responsible for convincing the unaware that hacking is typing loads of ones and zeros on a keyboard and saying “I’m in”
Far too many people genuinely believe that’s what hacking is
Holl E. Wood
i mean to be a 'hacker' you have to be a programmer
Do you?
Not really
ive pentested before on a small scale
to make exploits on a system level you 100% need programming, for pentesting youll still likely need it for an advanced target
I thought more people in computing / ICT would be interested in programming but I’m the only person in my classes who knows any programming or cares about programming at all 😭
It's also weird how programming is just. not covered in school
Oh yeah, but you don’t need it to be a hacker. You would be able to get away with knowing very little about computers for most things
ehh, only for websites that have pretty much 0 security
I think it’s weird how people doing cybersec would think that programming is “useless”
like if theres no attempt to secure it you could do something like an sql injection straight from the terminal
good morning
Good morning eivl!
gm
We have advanced chemistry in our curriculum, even though 99% of students won't touch that (for good reason) outside of school, while the average person is in front of a screen for multiple hours a day and still can't tell you how any of that works
My school only taught Visual Basic ;-;
And didn’t teach many of the programming parts of it, it was visual, but it was extremely basic
My school 'taught' us Java.
We had to learn certain snippets by heart.
off topic but would i be allowed to publish this #ot0-psvm’s-eternal-disapproval message in #1468524576479641744 because the original code was written by me but refactored + added to (a bit) by claude
Yeah that’s what they did but with html instead
lol
The quality of computing education I received in school makes me want to become an ICT teacher to give people a better quality of education
@peak relic we were discussing the utc and offset thing, i want to know now how do i set the timezone offset separate for every individual
same tbh
gm
IIRC you were doing the account class. You set it in the account instance as an offset attribute. Or timezone attribute
sure, just make sure you follow the rules, liike, it must be python, it must be open sourced, you must use the ai coding tag
alright ty
I don’t really know what I want to do though, either teach something or create something
unsure what you mean
you know what class attributes are, right?
yes
I just want to be the wise sensei you climb to the top of mountains alone to reach and I bestow wisdom upon you, the first spinjitzu master
show me an example
The one thing I wouldn't do in this economy is getting a degree
class Account:
current_time = dt.datetime.now(timezone.utc)```
current_time would be the class attribute, right?
yes
I’m very fortunate that my country has scrapped tuition fees so I’m able to go to university for a degree, but damn it seems so extortionate everywhere else
then make another attribute for offset or timezone.
very cool
Why leave people with sucha high amount of debt if they’re never going to be able to pay it off?
shouldnt we make a instance attribute
It's the same inmy country too.
Still, for CS graduates, the market is fully saturated
as everyone has different timezone
of course
so when you init a new instance, make sure to pass timezone when making that instance
This is why I don’t really know what I want to do
I originally wanted to be a game developer but that doesn’t seem like a very stable or fun job to have at the moment
hello
ty
to help make this clear, recall one of your old classes that you were learning about a Person class. And that person class has a name attribute. Same idea
can u upload a whole movie to github?
that would hit the git LFS
If you attempt to add or update a file that is larger than 50 MiB, you will receive a warning from Git.
GitHub blocks files larger than 100 MiB.
damn
im bored lol
build something
dunno what to build
!kindling
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
spam your friends with email
how does gmail flag mails as spam? is there any way to control that metadata?
nope don't think so
bro i am not experienced enough for 90% of these lol
bagels..?
i am still confused...
same
They're not telling you, for good reason
What sort of things have you made so far?
can you show me how you write your Person class that takes and sets a name value?
class Person:
def __init__(self, name):
self.name = name```
yea like that. but instead of name, you pass in the Account's timezone or offset.
how do i know his timezone...do i need to create a method?
you dont need to know. You let the user/client decide.
same way the users name, you dont know that, you let the user decide
looking at your assignment, it seems to take in a number of hours like -7
okay..but above message?
yes
Hello, world
yes... so you let the user enter whatever integer they want. you dont need to hardcode -7. Thats just an example
some common options are timedelta string and integer as datatypes
'+0200' is also a common string format
they didnt expresses much in the assignment about this, so which one i should type
pick the one you feels will be simplest. working with numbers is simple because you can use math on them
it doesn't matter much which you choose as long as you pick one and stick with it
okay..
Good afternoon guys , my 3rd day with python
well done, a great journey is ahead for you
i think my eng is wrong here..but you get the point
yeah thanks , python community is really great.
i have no problem , i dont think my eng is good either.
I'm thinking about buying claude subscription. But I don't have much of an idea about it.
What I want is
1 - get API and use can use it as chatbot in my projects
2 - it helps me in coding and I can chat about architecture, design, features etc with it (all preferably in my IDE which currently is vscode)
I'd be glad if you guys could share your suggestions and experience
claude code uses their own editor/ interface. I dont know if theres an extension in vscode that can use claude code
Are there any efficient methods to, given all prime numbers up to N, find the smallest prime greater than N?
agent what is API?

I could just iterate through the (odd) numbers and check for divisibility, but that I think is the least efficient option
Application Programmable Interface....
ohhh alr then , ty for telling me
I think you can do a pseudosieve
If N is not divisible by X, then N+X is not divisible by X
or, I think that's the case
wdym?
claude has a different payment structure than others, do you want an api to use an LLM in your appliction AND you want to talk or use anthropic model to talk to about code?
yo BIG TWIN hru today ?
I'm also caching the primes, so I'm thinking I can try and check like 4096 potential primes at a time
alright, up and working, meeting monday here
Yes
that's good to hear twin , keep working :)))
your claude subscriptions gives you the talking to the AI model part, and you have to buy an API key seperatly to use it in your application
i build a professor that yell at u and u have to answer his questions :)))))) ( 65 lines 😛😛😛😛😛)
Lets say we have a number N, and a non-divisor A
N % A = B, where B is nonzero (otherwise A would be a divisor)
Then N + A % A = B, because of the definition of the modulus
Anthropic - We Charge You Thrice And Still Make Losses
( AI got this wrong when I asked it, btw... )
a first name property (read/write)
does this mean i should make a method so that i can change the name later?
So what are you suggesting?
Breaking news: 'roll a die to determine the next word' does not produce factual output
You can "sieve" the next prime by adding each prime divisor to each number
For example, starting at 71
(N + A) % A, surely
!e ```py
for i in range(2, 71+1):
if i % 71 == 0:
print(i)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
71
yes
then we can consider 73 as our next possible prime
it can mean that. it probably means you should make name a property
ah that confused me for a second
thuri has message for pygen:
heck time
heck orbital dynamics
end of message
(71+2)
thanks thuri ❤️
ok
if that fails, we consider (71+3), then (71+2*2), (71+5), (71+2*3)
(see ot2 for context)
Find all the primes to some limit , there wont be many , save them to array ,
for finding do a simple binary search.
Hm.. that might just make the natural numbers and not work.
That's what I plan on doing
Ok, understood. Btw, apart from claude, do you have any better idea which
1 - solves my requirements of chatbot via API and chatting partner
2 - cheaper but also nearly same quality of claude's recent models?
1: claude can help you with this
2: start out with foundantianl models first
i think this is good solution.
you could download a model from Ollama and have it run on your machine for free and offline
One thing I did was look at how scipy does it
unless you're trying to push edges it's a pretty decent method
that would be my step two recommendation
Uh, but apart from only coding preferably i also want that llm to like access web to get Real-time data and could also reason
Um , I've no idea but can Ollama models do that?
yes it can
Oh i see, thank you
ollama is just handling the inference for you, or running the model you have
can i push later after commiting multiple times?
yes, thats what i do
make a few dozen commits and then push
make small git commits, then push them in one go later
btw i am using pycharm for it
cool
ok
Will this work the way I intend it to?
def counter_gen(n:int) # next() returns n and sets n += 1
Class User:
usercounter=counter_gen()
def init(self, usrname):
self.id = next(User.usercounter)
self.username = username
(I’m on mobile sorry)
It can, if you implement counter_gen correctly. Or just use itertools.count.
Alr so chucking things into the class definition works fine, is it bad practice to do that?
Hey I got a question about python can somebody please help me with one thing I'm trying to do something with the internet archive and supposedly there's a python code to bypass something on it and I don't know how to use it
If I had some dict mapping user ids to those users, would it be bad to have it as like User.userdict
!rule illegal to help bypass security
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
Okay I should have explained a little bit more no it's not a security issue
then what are you bypassing?
The zip file limit
Hello everyone,
I want to get into backend side of things
If possible, can anyone give me some tips, guidance, pointers on how to go about it ?
I know basic python, non tech background
I don’t really understand what you mean, but if you’re asking if you can use Python to bypass some restriction put in place, we probably can’t help with that
sounds odd. Can you share more info pls? Maybe in a help thread #1035199133436354600
Have you looked at Flask/FastAPI/Django?
i think fastapi docs are very very awesome , Just start making Some APIs first.
do you know what an api is? what are rest apis? http verbs? frameworks and libraries come later
Sorry I never reply to you but no it's not security issue it's not something illegal well I don't know if it is or not
This course is good to learn web fundamentals, which you will definitely need for backend work: https://www.theodinproject.com/paths/foundations/courses/foundations
Python serves as middleware for a database most often, core python is super helpful for a variey of tech roles, you'll also want to look at SQL and possibly aws.
tell us why you want to buypass it, it does sound like your trying to solve another problem
There's a seven zip limit on internet archives every time I tried to download something that's over 200 GB it's telling me it's too big for a on the fly zip
I am trying to look into fast api
yes, but the limit is not based on zip, its based on file system that does not allow larger files than 4GB. there is no way to bypass this
Okay so the python thing that I saw on a Reddit post saying it is possible it's not real I got link to it
I only know vaguely about APIs . Is there any resource where I can learn about this ?
if you controlled the server, you could change this, but siiince you dont, there are nothing much to do about it
api's are a fairly complex project, are you familiar with the basics?
dude idk what to do
zip64 will handle larger files than you can possible store on one machine
Sure trying to do that now
Ok
Not exactly 😅
How does zip compression work?
Nvm how does lossless compression work 😭
i had to look it up... 16EB
guys idk what to code lol
Thank you, will look into this
16 eB what does that mean
Incremental game about growing an ant empire
make a calculator but use Flet as your GUI
its what comes after PB, and that is what comes after TB, so around 16 billion gigabytes
Exabyte?
I think sending you into a library like fastapi before you're comfortable with data types and the like might not be a great idea. Using a library like FastAPI should not be your first step.
yeah
Basically just smart ways of encoding the same information, for example you might store something that means "repeat this 10 times" instead of storing the raw repeating bytes etc
I see, I do need to learn intermediate python like classes, oops, inheritance, decorators and so on I know a bit of sql
it bothers me intensely that wiki has a note next to every mention there about the prefix size, so they know, but they still use the wrong prefix
dude i aint THAT experienced
unfortunately i don't. my way of learning something is pretty reading based. so whatever i learnt didnt come from a single structured course or a video.
Oh okay now I get it
yeah, tripps everyone up 😄
the page for ext4 says 16-256 TiB with no note
I see, can you please suggest anything regarding this ?
Oh so is that why some things can get compressed into much smaller sizes than others, because they’re “compiled more efficiently”?
TiB is tebibytes right
Maybe can you suggest a book paper or video which deeply affected your understanding?
What if I dont code for the day and bed rot with my gf instead
yes, with the 1024-basis
Yeah roughly how repeating/pattern following some data is the easier it is to compress. Fully random data is harder to compress
Yeah that seems like a better idea , Good night everyone
Why not fix it when you see it :P
What if you teach your girlfriend to code while you bedrot 🧠🧠
There's not a great checklist or anything, but you should be able to write some basic code before you jump in to something advanced, I'd also suggest starting with flask. I prefer it personally and suggest it for beginners because it's a bit easier to understand, fastapi hides some of the conceptual work.
Interesting idea.....
because there are wrong people with strong opinions
The SI's imposition of decimalisation on computing is a corruption of computer science, and just because they're besotted with base-10 doesn't give them a right to redefine the units of binary computing
That's a fire take, but I can't say I disagree
aight lang time 🙂
we have some resources that we often recommend, or there I can suggest some simple projects that will ease you toward a better understanding
a 2.4% reduction to fit "base 10" is pure marketing goobash
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I don’t think Terabytes, Gigabytes, Megabytes or anything should be used in computing since they are base-10 and not super precise due to that. You can’t just use the prefixes incorrectly like that
No, the 1024 based and 1000 based ones are different units
1000 gigabytes in a terabyte
oh huh, guess I've never paid attention to that
Thank you, can you also please suggest maybe 2 projects which helps me to understand better
could have sworn a gig was 1024
kilo has meant 1000 for several hundred years (as a prefix, thousandish years for the number), and the binary prefixes came out in 1999
That's a gibi
Nah there’s 1024 Gibibytes in a Tebibyte
I start first day beginners with "guess the number between 1 and 10", then from there: rock paper scissors, fizzbuzz, hangman, tic tac toe. They're worth doing even if they sound boring, the actual coding can be pretty stimulating if you're still building confidence
I find it really frustrating
What's your point?
why do you find it frustrating?
I wonder why they dropped the base-2 convention
I just get confused all the time and some apps I’ve used show storage in base-2 whereas others use base-10
kilo is old, meaning it has strongly-established meaning that shouldn't be ignored, and that using stuff deprecated 27 years ago is silly
it was a sensible idea at the time, that scaled out of sense. it was due to marketing, not tech
marketing in the early 2000s
isnt there a kibi- prefix for 1024?
because at the time, we hit the 200GB treshhold, and marketing wanted to put 200GB on the box instead of 198.7
or whatever 200GB is in real terms
I think GB should mean Gibibyte, and KB to mean Kibibyte. Gigabytes and kilobytes shouldn’t be used commonly
Testing something out with an http proxy for example in terms of web apps is infinitely faster if you can throw a addon together with mitmproxy for example then bumbling through various UIs.
as long as it doesn't get as bad as the definition of a kilogram or a meter
or spend the same amount of time fixing it
clearly the best choice is to quantify bits in avogadro's number, which is a universal constant
unless your gold
...with a precise value that's only about 7 years old
Bro i can append to a file a bunch of times
and then boom the file has that
multiple times
i love file opening
Will start with that Thanks a lot 👍 . Start with flask right ?
programming is sort of a "choose your own adventure" situation but that's what I suggest. Also, don't use AI.
Flask isn't easier than FastAPI. The advice is to start with the programming fundamentals before you jump into web servers.
!learn
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff — an online book (also available to purchase as a physical book)
- Harvard’s CS50P course — video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course — text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
^ These are all good
choose your own adventure, but beware of softlocking yourself by getting trapped in tutorial hell or inflicted with the ailment of dunning-kruger effect by LLMs
"You were eaten by a Dunning-Kruger"
they break the game balance by making the learning curve super steep down the line
Got it will not use AI . Is it bad to ask AI for explanations as well ?
Thanks a lot 👍, I did half of CS50 and I will look into other courses as well
I have a 20 min rule, try to solve for 20 mins before touching ai. Otherwise I find myself switching to autopilot and don't remember shit.
You should try to understand stuff without it. It absolutely butchers so many concepts and it will be embarrassing if you follow bad information from it.
It's tricky. You have to avoid the trap of becoming overly reliant on it. I would suggest getting input and feedback from multiple sources besides it, like content written by humans, or chatting in this server.
not rlly your only doing bad if you make it do everything for you but asking for an example is fine
Even when it's correct, it can still be harmful, because you can end up in a cycle where you just accept whatever it says without thinking about it, so you end up not really understanding or learning much.
You stunt your growth for when it can't help you on something not in its training date.
Hey guys, I have a quick question!
hm?
Or something it just lacks the context to fully grasp.
Got it will try to learn up to date software libraries and will not use AI for coding while learning
Which is a failure mode of normal sources as well, the danger with ai is really that the answers are specialized for your exact issue. Usually when you find code snippets online you have to understand them enough to adapt them
Tangentially I hate when people take messages and run them through ai to understand them, it misses so much important information and leaves so much out.
AI is like the guy from Memento. Very smart and capable, but forgets everything you told it on a regular basis.
I run mine through for curiosity and it horrifies me.
Makes sense similar to pomodoro technique right ?
Oh never knew about
Since everyone is saying claude is very good at coding
claude is usually better than other AI models is what people say afaik
It still produces so much slop if you aren't smart enough to o choose what you keep.
♥️ definitely Will do
Claude is very good at coding, but it's good at it in a way that's very different from a human.
You have to understand what it's strengths and limitations are in order to use it effectively.
And most people don't.
I don't think pomodoro accounted for caffeine but something like that. No amount of stimulants will prepare you for some of the obstacles you'll encounter in coding though, sometimes you need help, other times you should take a break.
Got it 👍
Will not ask AI for coding while learning
smart
So, I am self-teaching python + doing the coursera Python cert from microsoft.
I am trying to train myself to understand not just how to rinse and repeat projects, but also, how to think about projects that I decided to do. I am only up to learning about while loops so I am not far. However, recently I was trying to build a simple ATM, Create a Pin Checker 3 attempts, Balance Withdraw and Dep, Balance Checker, Exit Button. If 3 attempts pass lock the user out.
And I made a really shitty attempts at it. So I used claude to kindof show me how to structure my code so I can think it through better, however I feel like I cheated myself out of learning and am now just copying the format claude chose to do things in.
Is this good or should I have just tuffed it through and not used claude for where I got stuck
Oh yeah, that's true
I assure you if you want to you can spend the time to produce better structured code than Claude gave you.
You're right. No amount of caffeine will prepare one for challenges
I just don't want to cheat myself out of the value of forcing my braing to think of a solution to a better code structre.
because I asked claude to make it and, it made it look so easy, perhapse had I taken the extra 30 mins I would have arrived at a solution similar
i mean you wouldve gained more experience not using ai but i do understand where your coming from and even after a few years experience with coding i still do that at times, but for the sake of learning just use flow charts to plan out your projects
As far as you don't copy paste the code, you've learned a format to use in the future.
Oh does it not summarise correctly?
I see I am not familiar with flow charts at all. I am at like ground ZERO, I just found out what github was like yesterday so I don't really even know how to begin with most of this, I am just trying to learn lol
great point thank you!
thank you btw!
If you summarize a message containing important information it won't emphasize enough and will leave stuff out in some cases.
thank you btw!
xuL's not wrong but everyone hates flowcharts, would prefer to just grind it out without ai personally
I wish i could ss to show you guys how crappy my code was compared to claudes.
Makes sense -- one of the reasons to learn indepth 👍
It was terrible
You also don't need flow charts or anything fancy. If you write good code it'll reflect your thought process and solve problems. Reflecting what you want among other things.
i love making flow charts icl, combine it with spotify and its a chill combo
Write good functions or classes in the shapes you think you want, pretend they exist, leave them empty, put the flow together in code, then implement them. Name them clearly. You'll get a better result just by playing with shapes.
True will adapt as I go on 👍
Yeah thats exactly my problem, I think about doing everything in the same block of code, and I sort of try to cram everything and it makes it more confusing, but i noticed claude makes clear seprations and literally just does one piece of the puzzle at a time and it sort of flows.
It's not like you have to just learn how to do everything on your own. But if you ask an AI, it might, like in this case, give you too much and remove the friction of learning. I'd suggest you ask for advice in here instead, from humans who can judge how much to reveal to you and how much you should try to figure out on your own.
You can easily do that yourself. You just have to simplify and see the tools available in your programming language to do it.
AI are trained to be as helpful as possible, and sometimes that means they end up being too helpful.
Very good point thank you!
gotcha thank you!
exec(‘exec(“print(1)”)’)
Are you an expert developer?
I highly recommending structuring on your own in response to the pains of your current design, and using ai to implement function bodies or show you how to do stuff to get stuff working, so you could change all of the internal stuff if not sure and keep the rest the same.
no lol, just starting out
Ahh i see, this is good thank you
But I also highly recommend breaking it down to focus on the details yourself. You can write wayyy better code other people can understand and actually solve problems so other ppl don't have to take much time to understand them. Using code as communication.
exactly
this was all good advice, thank you everyone
Then take your time and learn. You code look messy, that's how a beginner code should be. Mine might be worst than yours, so just learn and stop beating yourself
very true, awesome, thank you for this
That is a good idea but won't we forget which class we need to fill and so on as the number of files, services grow ?
If you make it flow well enough, I don't think so. You get to feel the pain as you work with it and make stuff easier to navigate for yourself and other people. Yourself an hour or a week from now is like another person. And If stuff is named clearly and simple and stuff is modular you can focus on pieces and surrounding ones in isolation and the complexity doesn't explode that much.
Did you say it in another conversation you have stored with it?
Got it, thanks a lot
nope, if I go into an private tab and then search gemini and type my full name in chat it says who I am and my school information
I think it should be in personalization mode - you can try and adjust the settings
Uhhh, that's more of an issue with your information being on the Internet I think than Gemini. It's probably pulling from search results. Go through the results yourself and go find where maybe.
ok
you can share personal info from your logged in user. if i asked gemmini it will not know that info
ohh ok
should I try it with my dads computer and see if it says my info
you can just open an incognito tab
oh I plan on working in C
most people here are new to python, but a decent amount of professionals tend to talk alot here
how should I best expose shader storage buffer objects and uniform buffer objects to APL?
do i count to new?
not at all, you have been here consitantly for many many days now
Python is a fun language to talk about.
many days..lol.ok
and you have houndreds if not thousands of messages
ty ty...😆
3470 messages
can someone help me please
what do you need help with?
ey, thank you for showing...i am close to pro
please ask your question such that it can be answered
Give the full context ,
ssure, but i dont have access to it all anymore, so keep that in mind. admins have access to many other channels, and i was an admin for many years
347988 messages visible to us mortals
226,635
soo much money in your bank well that doesnt sound good
you can also use discord search to see
#ot0-psvm’s-eternal-disapproval message
eivl's first publicly accessible message
there was another?
yeah, but lost to history at this time
Memories
Do you even python it was called
where? do you know how expensive those have gotten in 2026?
funny!
were you an admin there?
yeah
hey, i have a question regarding tests with fastapi
https://fastapi.tiangolo.com/tutorial/testing/
right now i have this test where im creating an entry to my Item table
the way my tests are setup is that im overriding my session dependency to use an in-memory database.. or at least that's what i inteded but what seems to be happening is that a memory file gets created at the root of my project folder, but okay
https://github.com/blankRiot96/hypo-inventory-api/blob/main/tests/api/v1/test_inventory.py#L13
my question is how do i isolate tests? i mean, let's say i have another test where i create a different item. i dont want to have to think about how my other tests have modified the database... or is that just how it's usually done?
also how do i do a cleanup Path("memory").unlink() after the tests are finished running in pytest
tests/api/v1/test_inventory.py line 13
router.dependency_overrides[get_session] = get_test_session```
src/app/core/__init__.py line 3
router = FastAPI()```
You can create a fresh in-memory database for each test case
That's how you'd normally do it for most tests
this is a rather cursed question, but alas:
should #-type comments be broken at column 72 (a la docstrings), or when regular code is?
Does this count as the official Python discord server?
i have a discord auto msg self bot can i make other people use it through a command without seeing the source in my discord server
probably
no, its not offiicial
its community run
No, we're not representing the PSF
its not run by PSF
So it’s the unofficial “official” Python discord server?
we are recognized by the PSF though @raw bramble
can anyone answer me please i need help
Oh okay. Paris
do you know what self bot means?
It's basically like, the PSF approves of the server, but does not back it and does not take responsibility for it
i'm considering reproducing a significant portion of the explanation of the current Easter algorithm to help with understanding the purpose of the original mathematician-style variable names
i try to, but also with word wrapping it's not as useful to me
i might be able to give some decent names, but how tf am i supposed to abbreviate
and by (7) we have enough to determine
l, a number between 0 and 6 inclusive which is one less than the number of days we will have to wait before there is a Sunday which is definitely after the full moon.
hm i need to look into how to do this. it sounds like the right way to do it, but im also concerned about performance
eh, ill be concerned about performance later
hi
An in-memory db is generally very cheap performance-wise.
hello can someone help me please can i allow specific people to use my discord self bot without seeing the source
!rule 5 🙂
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
Sorry.
nerd
yeah, most of us are nerds. Thanks!
yield from y is basically for x in y: yield x?
not tuff
If Discord got the idea in their heads that we were helping people selfbot, which is against their TOS and are, in my view, irrationally panty twisted about it, they would shut us down.
<@&831776746206265384> came to ask about prohibited topics and is seething about being reminded of rules .See #python-discussion message
who is 'us'
it is lazy
Python Discord.
bro thinks hes a part of the team
!mute 1320499527656013826 You will need to reread our rules. Self-bots violate Discord's ToS and so we can't help you with them.
Also, don't be rude.
:incoming_envelope: :ok_hand: applied timeout to @reef turtle until <t:1777285542:f> (1 hour).
yield from exhausts another generator
im not sure why you phrase it like that.
hello
balances need to be zero or higher, and should not be directly settable.
does it mean i have to create a setter?
^
vs ^
Guys what's the point of set {} one not the function
a dict?
{} alone is a dict, set() is a set
thats a set, are you asking about what you use them for?
Yeah
{} is an empty dict, an empty set is set()
it is an unorderd collection of unique elements
So basically just set()?
Ic
if you yield from y then y will be consumed, and the full thing will be yielded back to you
the question was if it consumes it on the first time it yields
if it consumes y then yielding its items
or yielding them lazily
thats why the term exhaust is better, yes that means it consumes it all first
no its not true i just tested it
def a():
cnt = 0
while True:
yield cnt
cnt += 1
def b():
yield from a()
for c, _ in zip(b(), range(100)):
print(c)
if it'd consume all of a() first it'd never be able to yield
(named a twice, worked though somehow lol, since b's call was before a inside the loop's creation)
why doesn't
from decimal import Decimal
x = Decimal("0.1") + Decimal("0.2")
y = Decimal("0.3")
z = Decimal(0.1) + Decimal(0.2)
w = Decimal(0.3)
print(x == y, z == w)
``` work?
How is that gonna work bruh
Because Decimal(0.3) is the decimal fraction of the float closest to 0.3
how does yield from foo() work and what is the lazy and consuming things you guys are talking about? I'm interested but I don't know about this concept
!e
from decimal import *
print(Decimal(0.3))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
0.299999999999999988897769753748434595763683319091796875
you know what yield is?
yep
the implementation parts is interested, because it is not a simple problem to solve. it uses send and throw to control the sub generator.
I know it pretty much for generators
if we are mixing terms, then i would add that it is an lazy exhaust, not an eager exhaust
like:
def foo():
x = 1
while True:
yield x
x+= x
so the question was if in yield from y the entirety of y gets consumed before yielding its items, and its actually lazy, means that it consumes 1 item at a time from y, on each time you're trying to get an item
interesting so you looked into the internals...
Oohhh, thank you
i wrote my own yield from before yield from was invented, it was very problematic at the time
i see... a lazy exhaust, never heard that term, makes sense though
hello
in python?
how you did it thats interesting
no problem
hello there :)
In what context? Negative values are not inherently exception worthy.
idk how to explain
Though were a function expecting a numeric object such as a float or int and also expecting positive, then yes, ValueError would be an appropriate exception to raise.
The type would be correct, but the value would not.
i'm good, thanks, welcome to the server!
but i want to raise an error when amount goes to negative
ValueError would be appropriate.
okay
I feel like this is a use-case for the walrus operator but maybe I'm not so sure
You could do py raise ValueError("Value must be positive.")
Hi im an amateur is it possible to give commands to my discord bot then it gives me placeholder which I fill up then it automatically sends those stuff to another channel for example I used a command, it gave me 5 placeholders let’s just say I filled them all with “hi” then the bot sends hi hi hi hi hi to another channel of my choice (sorry for my bad English)
can you give like an example by chance?
prob
How?
idk
you need discord.form
What is that
just a hunch : ). I usually don't even think about using the walrus operator lol
I am having lots of issues with python's module finding mechanism
When I deployed my code in gogle cloud compute engine
What's the standard practice for importing ? so no errors
It's all about use case. The right tool for a given tusk.
basically a custom screen where you can write info and then send it, it's used for applications for moderators and so on
Oh, how do I use it? Sorry for the trouble
iirc, the walrus operator sparks controversy within the python community
it's anti-pythonic IG
let me look it up, create a help thread in #1035199133436354600
and ping me there
It is an uneccesary thing, but a thing that allows for some very concise things that would otherwise take up a few lines.
Alright
guys, sort of a naming question
if you use a deque for a stack (for FIFO), you name is queue or stack
But then wouldn't the stack automatically become a Queue?
technically yes i guess
My first step to enter the master's admission at Kyiv Polytechnic Institute is done! ✅
i normally use deque for popleft, for FIFO, and name it stack
but i'm not sure, maybe its a queue
i mean, technically its a queue...
If it's LIFO, it's a stack. If it's FIFO/LILO it's a queue. Is that right?
@property
def balance(self):
if self._balance < 0:
raise ValueError("Balance should be 0 or higher.")
else:
return self._balance
def deposit(self, amount):
return self._balance + amount
def withdraw(self, amount):
return self._balance - amount
its not working
umm... so you say a stack is only LIFO?
Unless you're mid or bottom dealing.
what if you mid or bottom dealing but also fifo
I cast awareness of wasting time on phone
In a stack or heap, the last thing you push to it should then be the first thing you pop from it.
In a queue, the last thing you push should be the last thing that gets popped / the first thing you push should be the first thing that gets popped.
In a deque, you can push and pop to/from either end.
fair i guess
I'm open to being corrected.
It isn't strictly my area.
This is just what my understanding is.
i think at least in the fifo case u're right, calling it a stack feels weird
so say you use a deque and do popleft, calling it a queue instead of stack is more accurate i guess
queue = deque() in other words
import collections
deque = collections.deque()```
I'm so confused what were talking about here I've literally just joined this server
if u use it as a queue i think naming it as queue is more accurate
Sequential data structures.
welcome to the server, we talking about naming issues you could say, of variabbles
semantics
for reference: until now i always named it stack (but i think naming a queue stack is a bit weird)
today i started part 2 of automate the boring stuff , and start reading the regex chapter , after reading 10 pages , my head is hurting ...
how many parts are there
Depends what exactly your building, I managed to build my own website & other discord bots.. So I've got quite the experience for coding
Thank you!!
😁
2 parts , part 1 : basic python , part2: practical stuff..
i see, you're half way done then
I'm so unsure am I allowed to send my website link here?
For what purpose?
Or even showcase the discord bots that I have created
Unsure perhaps showcasing or for people to check it out & give feedback 🤷
i just speed read the part1.. for me real python start after part2 , where i dont anything XD.
take it easy i guess, no need for your head to hurt badly, take breaks, take your time with it
What's pyproject.toml or setup py ?
Hey, is there channel where someone is hiring python dev?
no, this is not a server for that kind of thing
yeah will do .
!unmute 1477177354387198062
:incoming_envelope: :ok_hand: pardoned infraction timeout for @little roost.
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.
Wasn't aware of that existed but also didn't know you can't type a few lines of code
our system wants to mute spammers, not people that accidently paste to much "code"
111 is not a few
Pasting a huge chunk of code into chat is disruptive, which is why we have the paste service
That's understandable however there is specific code that can detect different types between spammers & people sharing specific code
Might seem a lot but I had spaced it out so that 111 wasn't all code it was a mixture of words & code
That doesn't actually matter. A message that large is disruptive regardless of whether it's code or prose.
The channel name is “ python discussion ” so I had thought it would of been allowed
Well, use the paste service from next time.
you quoted the word "code"
is it because you think javascript isnt real code :P
can anyone please tell me how to create an empty dict in a class
If plain class, define it in your init method
If you want it to be an attribute on the instance, yes
try it without writing self and see if it gets saved or not
not deliberatly, but yes... lets assume it was 😄
self.mydict = {} in your init
name it something better than mydict
ahh.. .transactions.. thats a good name for it
should i follow the same if i have to record everyone's id in one dict
yes
ok
you are encapsulating data in your class
By 'everyone' do you mean: you want all instances of the class to modify the same dict? Or one dict per instance?
the first
ok
Aha, the Rincewindian dialect.
that made me very happy to read.. if you know you know
i am not 42 
still a good number
haha ok
.wa meaning of life
that is also the age when people suffer mid life crisis...not a positive thing, but i heard that
mildly unrelated, but the way you can create a mutable object in Java in "class" scope and it's per instance (as long as it's not static), irks me
but i get you
theres a million things about java that irks me.
(Recently realized List can be immutable which is just like, honestly for being the "oop lang" some of the inherithence chains are really strange)
like would having a ImmutableList base interface be too hard?
based wolfram alpha
There are widely used libraries like Guava which supply such types.
we should get a Rincwind duck emoji

theres a million things about java that irks me.
I like to say that "I hated java before, but now that I have had to use it, I... hate it even more"
right, the issue is less that I want a type that ensures immutable list, and more that I want a type that ensures it is mutable
The "I want to be the first person in a sequel to say F%#K!" Easter egg from the PC/PS1 videogame Discworld 2 - Missing Presumed.
The cryptic solution to this secret scene was first discovered and revealed to all in December 2011 - 15 years after the game's release! Visit the Adventure Gamers thread located here http://www.adventuregamers.com/f...
Then you can just use a concrete type, no?
Like ArrayList or something
Hex would be on point, but...ehh...
rip sir Terry
I suppose so, and its what I am doing now. Just a really annoying footgun
like if a interface has some methods, I would assume most implementations would well implement them.
The Duck Man is a thing.
I suppose? I don't recall running into issues with it, personally. Maybe it could be problematic in some contexts.
well if you write a method taking a List and expect to be able to modify it
or expect to be able to modify a list returned from a method, etc.
Hm, yeah, but hopefully you wrote a test that executes the method so it blows up before you even merge your PR.
And then you learn you can't do that with List.
yeah I noticed because I used List.of in my tests which turns out in immutable, if my tests instead had passed an ArrayList I would have never discovered it
I guess it's a bit unclear and subtle, which is a fair criticism.
hmmm...
why do we write assignment like x = y + 1?
wouldn't y + 1 = x make more sense?
yeah and like the List docs do call it out, so its not like its hidden.
more so that I assumed a List interface with a .add method would you know required .add to be implemented so I didnt read the docs too closely
no
tbf, it's kind of like collections.abc.Sequence in that regard
you write in math 5 + 1 = x or x = 5 + 1
- both are correct
- programming is not math
to mirror math notation, earlier languages did it first and we are stuck with it
y + 1 = xmore closely resembles the order in which things are done by the computer
thats where it originates i suppose, and its not about correct vs incorrect, its about which option is chosen
that doesnt contain any of the mutation methods tho does it?
mmm, true (probably)
like python has MutableSequence
yes (though arguably, that's not very obvious)
at least you can more safely assume that something type hinted as MutableSequence will allow mutation
that, certainly, yeah
I'll have to keep this in mind for myself, lol
List being immutable in Java
It isn't, though.
It has mutation methods and whether they work or not depends on the implementation.
x <- y + 1
Fortran and Cobol that did it first?
y + 1 -> x
yeah thats good too
"my language ™" would probally do both
Nah
oh also let x = y + 1, thats pretty unambigious too
x < (-y + 1) 🥀
no, I mean, I sometimes also use List.of, which then apparently will return an implementation that doesn't support those methods
true
python does the expression first and then left-to-right assignment
for iterable -> assignment_target: when
if the expression was at the left, it would've been evaluated in perfect left-to-right order
Ah, so you mean "List.of" returns an immutable instance. List is an interface, so List.of doesn't create a concrete List instance.
for <iter> as <variable>:
i dont think as makes sense, as would just be single assignment, like, aliasing
Sooooo for <iter> part called <variable>:
for x in xs reads good but it has the same problem as x = y + 1
for <iter>'s <target>:
Wdym x = y + 1 has a problem
scroll above
Idk the math notation makes more sense
in math equality is commutative. assignment is not just equality
math doesn't have a concept of assignment
How possible is it to find a CIS-speaking person here to learn Python?
there are atleast a few russian people here
CIS?
Commonwealth [of] Independent States
yeah
though im not sure how would "CIS-speaking" in general be a useful metric
knowing russian does not mean knowing like, belarusian, or kazakh
Why does the translator use this specific word)
you should really consider learning english if you want to learn programming
most resources and communities are in english
I understand, I have trouble even with technical English
i got somewhat "lucky" in that sense and learned english in childhood before doing any programming, so when i started learning programming i didnt need to also learn english
but the hopes of getting a job with a native language are currently outweighed by the desire to devote sufficient time to learning English
there are programmers who dont know english though, but its better to know english of course
(i know some that their english is pretty bad)
The inclusivist in me rails at English being a requirement of programming, but such is the lay of the land.
i wouldn't say a requirement but that it helps much i guess
Some non-English languages have it way easier than others too lol
I have never seen documentation translated into either of the two other languages I speak, but I see translations into Mandarin all the time
what about programming language diagnostics being translated
i read' some of pyright's ones in russian that fix was working on and it was so weird honestly
well, yeah, it's a bit of a mystery to me what List.of even creates, but whatever it is, it does not support mutation operations (according to Viv)
That's correct
List.of just returns an immutable list... the list structure raises. It's kinda clunky to me, but it replaced some workarounds (third party) that we'd use before.
maybe this is the missing (homogeneous) Tuple I have been looking for 👀
Hummus genius. A spread for every snack.
maybe if i english was my native language i would also find the programming english lingo weird
but since thats basically the english i learned it feels just fine to me
i prefer russian when watching anime though, i find it softer
movies in english though, russian dubs are weird. i guess they dont get onto the realistic image as well as they do for drawn animations
dubbing has gotten a lot of funding in the last 2 decades over here
20 years ago you had to watch with subs, anime was still a bit of a cult scene
kinda funny to hear entirely different characters in different animes voiced by the same person though
takes me back heh, conversation bout to be redirected though
what file descriptor is "conversation"?
its both stdin and stdout. hmh. weird stuff
tty0
Can i get some opinions its my first.
Непоследовательное использование вкладок и пробелов в отступах
I still haven't recovered from this one
smh, mods and rule 4
smh that's a quote 😔
“Inconsistent use of tabs and spaces in indentation.”
(it's a quote from the pyright localization strings)
SMH my head I thought it was gonna be a quote from some famous person
(they translated a lot of the error messages poorly in funny ways)
ahh...
Have you tried fixing them?
I think I patched a localization or two years ago
what would be the english translation of the translatio?
thats the thing, it translates back perfectly
but in russian it sounds really weird. you would never see that in a real sentence
yeah, that is fair
Literals always sound weird
Hello beautiful people!
Chat someone thinks I'm beautiful
Objection your honor. The defense claims we would never see that in a real sentence. However, we just saw it. In a sentence. Therefore it is real.
on your pfp are you the human or the dog
yes
You are.
The original is "Inconsistent use of tabs and spaces in indentation.", but the Russian translation assumed that "tab" means "a browser tab" and not "tabluation"
yeah, some details will be lost to translation
Says the catfish smh - using Ringtail pfp when you're Saber!
😛
well, it could use the word "табуляция" and it would still translate back as "tabs" while being actually correct
i think it was a poor automatic translation
Best slime ever
That's a very long tab
The proper English word is "tabulation", tab is a contraction
im not sure if "непоследовательное" is right either but i dont know what the better word would be
like yeah translates back well but i honestly couldnt decipher what the sentence means if i didnt see the translation beforehand
I think that's the right translation for inconsistent
this is clearly a ploy to make Russian developers slower at programming
words are bad
Oh wow
I put the word in Google and it no longer triggers automatic translation
Now its giving me an AI overview of the word, but its all in Russian
It also apparently does relate that word to \t
Табуляция — это метод форматирования текста и код (\t), перемещающий курсор на фиксированную позицию (обычно ~8 пробелов или 1,25 см) при нажатии клавиши Tab ↹.
the topmost result being AI overview by default is so cancer

Guys wanna know your opinion. What will happen if ai is forbidden?
I can say it's the end of my life, i made so much from it as an entrepreneur. But it will be new opportunities
forbidden?
if you want to disable that: https://udm14.com/
A quick way to get an AI-free search without any extra work.
people have been making things for decades without ai
oh thats nice
Anyone read the 2nd edition of Designing Data-Intensive Applications yet?
I've been trying to get hands on it
link
i should use that and filter out a bunch of common slop websites
ahh.. no i did not.. but i think i will get that
are you planning on waitiing to hear about it?
I was thinking of planning on waiting to hear about it

Based on my understanding of how books work, it's supposed to be a replacement of the 1st edition? Not part 2?
It depends a lot
