#python-discussion
1 messages Β· Page 295 of 1
it is , but make as much stuff by urself as u can.
!kindlinng
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
Personally, I think learning from a structured course / book is more efficient than random youtube videos
@onyx marlin use these for projects
Ty for your advice
His youtube videos are quite good and structured
Tho, they invite you to tutorial hell.
Should I be prefixing everything I'm not explicitly exporting from a package with an _, or is there a better metric I should be using?
@onyx marlin you can use the book , "automate the boring stuff with python" too, it's very good and teaches you about automation and scraping.
If you're making a library, then yes, it's a good idea to _underscore names you don't want to promise the stability of.
Where can i find this book?
Thank you
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Maybe some like it, some don't, I personally don't especially those extremely long, 12 hour long videos. I feel like many people give up before finishing it completely. I find that when topics broken down to smaller parts (like a course or book) have better attention span because people have a better sense of tracking their progress rather than tracking progress based on how much time they have consumed off the video. But that might just be me
@past shard found it!! Ty
It's free online
Never in my life have I fully completed those 12 hours long videos because mid way I feel so discouraged on how long it is
Sometimes the meaning of _ is ambiguous, I don't know if there's a good way to systematize it. For example, you might intend for an attribute to be used freely anywhere within a library, but not by outside users; and then you might have attributes that are only intended to be used within a single module.
yeah you can use that too
Some of his videos are good but meh
good but meh?
Ok. Thank you brother!
That's kind of what annoys me about __ apparently not being recommended (and for this, I've been trying to actually do things somewhat properly). I'd say for my case I'd rather be clear with what is externally usable, since a few of my other design choices stem from that approach.
I personally would not avoid __ for private attributes (intended to be used only within a class). Especially if you don't plan to support subclassing
Yeah, I can agree with that but, it's kinda a bootcamp for beginners to get into coding and the video is just all of his short tutorials combined into one long video. It prepares you for cool stuff you can do with one lonng guide.
do note that __ only works for class attributes/methods, not items in a module
bootcamps are memorable, but not the content
a few months you will remember that you watched a long ass video for 12 hours
but probably only 50% of the content
at best
That is true , but being actively involved even after the bootcamp is the main part because that will engrain the stuff that you learned in your mind.
yea
Yoo
yo how could i learn to code in python (nd on a scale 1/10 how hard is it)
!res start with a tutorial, and see for yourself how difficult it is.
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
we get a lot of questions along the lines of "how hard is it to do this?" and the only fair answer is "We can't tell you, because that's all going to come down to you"
thanks
I was (mostly) able to understand window functions and even used them to make some pretty nice queries i needed for my project. Took ALOT of time trouble shooting though.
I talk python
Syntax Error on line 1: 'I talk python'
loooool
specifically, I think cs50p is the best starting point. Make time for it at least a few times a week, and engage with the content: watch the videos, read the notes, play with the example, and do the exercises
and recognize that you're not really learning python, you're learning how to program and python is the vehicle. that can help clarify what's worth deeply understanding vs just memorizing
this may be the most helping comunity i ve seen
depends on what you want to do, and as mentioned how hard it is varies between people, but learning enough of the syntax required to start learning specific applications of the language is maybe a 4/10 on my scale! the problem-solving is harder than the syntax
thx guys
I'd also recommend this after an intro course/book/whatever: https://www.composingprograms.com/
it's more about how to think about designing programs and working with and building abstractions (which is the real gist of what software development is). It's an updated version of the wizard book using python and is for a class taught at Berkeley @merry pilot
Sounds like something I recommend, but without a link - I always tell people to use pen and paper and plan their things, instead of just trying to write code without thinking. And I mention how i use that in my bigger projects as well, it's not a sign of beginner vs advanced, it's about planning
is there a way to delete a file without it going into my recycle bin? i have a script that generates a bunch of files and then deletes any old ones and it results in my recycle bin having like 4000 files in it after i run it enough
rn im using os.remove
It's not easy, but it's not the kind of thing where you're either a super genius who can handle it or you aren't. If you put in enough time and effort, you can learn it.
Doesn't os.remove already do a "permanent" delete?
Documentation of os.remove says it removes them permanently
weird, maybe it's an arg or something, lemem check the docs
This is the best helping community you've ever seen
I wouldn't have even started if it weren't for these good friends of ours
what im doing is i have a script that generates font bitmap data and i have an option to save the bitmaps to files, so i can look at how they turned out
but i sometimes change the character set, so i have it delete all the old bitmaps in the folder before rendering
hi
Odd, I'd have to look at the code, since I doubt it's os.remove doing it.
lemme see
Doesn't os.remove like remove the code?
It removes a file.
Sorry am dumb lmao
im just doing
cwd = os.getcwd()
if(save_font):
old_chars = os.listdir("chars")
for i in old_chars:
os.remove(cwd+"/chars/"+i)
probably better to use like os.path.join but i couldnt be bothered at the time
Could you clear the recycle bin and run the code again? Perhaps it's just older files and not your code.
maybe
shutil.rmtree go brrrt
very possible
pathlib btw
ik that exists
i just didnt feel like it xd
github is a site where you store projects and stuff
it allows multiple people to work on a project more easily
np
and git is basically a software that github uses, it's used to manage updating and working on software
so like if you mess up when you write some code and you wanna go back to an old version, git can help with that without you having to manually make backups
also i can confirm it was that i had manually deleted some of the files, os.remove is working as normal
i probably should have checked that first lmao
remember not to put parentheses around if conditions
also use pathlib
? wait why not
if statements don't need parentheses, so including them just makes your code noisier.
yeah i know htey dont need it i just do it for clarity idk
got used to it after writing in other langs
I also write other langs but I don't pollute my Python code with them, smh /lh
well, make sure that you stop if you end up writing python in a team, so you don't irritate your teammates and make you change it.
anyway, if you used pathlib
directory = Path.cwd() / "chars"
if save_font:
for path in directory.iterdir():
path.unlink()
btw, yeah, if you're trying to remove the entire directory (which you seem to be doing, maybe shutil.rmtree (scary AF though, make sure to be really sure that you're removing the right directory) does actually also help with the recycle bin stuff (which is weird anyway, but still)
it wasnt actually os.remove it was me not realizing i had manually removed some files lol
silly mistake on my end
sure i would like that
i ll take a look
https://github.com/Leshiro/jisuke what do you think of the readme file i personally really like it now
what can i make with python
Python is a general-purpose programming language. You can make virtually any computer program or application with it.
what kind of applications
Any applications
That's what general-purpose means
You can browse through the topical channels on this server to get an idea
It's not necessarily suitable for all kinds of applications, but it's still possible
You could implement an extremely slow-running Elden Ring in Python given enough time and effort
Is there any free tiktok api or tools that provide tiktok profile info and other things
Have you looked at https://developers.tiktok.com/ ?
I'm assuming you have to rent an API key
If free access to that info is not provided through the official API, it's safe to assume that any other means would violate Tiktok ToS
which means that we can't help you with it on this server
!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.
oh okay.
I'm making a discord bot what would send live stream notifications and notifications for video uploads and account summaries at the end of the day
I can't really fill all of the needed things cause i don't have them
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
can anyone guide me for GSOC
alot of things
pong
Does anyone know how to make a looping perlin noise map?
Dancing snake
So it can be seamlessly tiled
for games?
In this case I wanna use it for the background
Its the space and Ill use it to vary the tint of the background
so it needs to be tileable
I dont know how to make a perlin noise map that loops over
It should work in a way that basically reconnects to itself at the end to the start
?
not sure what you mean
Python ones
one sec
Guys, how do I redo an if statement?
tell us more about why it need to be redone. Sounds like you need a while loop.
ok actually just doing modulus on the inputs makes it... seamful
I need it to redo because if i misspell the word "calculator" it lets me redo the input until i get the word right
ok, so it will be something like while <word is misspelled>: <ask for word>
How can I keep a bot online if my computer turns off?
I know I have to run the code in like a
You cant π
You keep your computer on, or you use another computer (either another one you have or a hosting service).
Just kidding, you can
Maybe yes
You could do it that way, or pay for a service
In the case of a raspberry pi you'd need to keep it on
Any external hosting service just handles that for you
do as amy said or recursion can be used
Yh, but if I did a variable for the input how do i keep redoing it with while loop, if and the variable input?
can you show us how you would check if the word was misspelled? Let's say you have a variable word.
Try this, dont copy paste
Word_spelled = bool(False)
while Word_spelled == False:
Word = input("Enter the word calculator")
if Word.lower() == "calculator":
Word_spelled = bool(True)
you can use False, no need for bool(False), and then while not Word_spelled:
Replit?
lastly, Python usualy doesn't use upper-case for variables.
Its my phones autocorrecy
Me too π
Replit isn't a hosting service from what I know, also doesn't handle your bot token securely
you can turn that off, right?
Its turned off automatically in my IDE but I typed the code in discord sooo
Is there a problem with starting your variable with upper-case?
yes: other people will comment on it, and it will distract you from getting your answer.
Its a convention, not enforced but followed by everyone
No but it doesn't read the variable as one
Is There A Problem With Using Caps in ENGLISH?
ok i was worried for a moment but i got something that works i think
you just take regular perlin noise, but in the input noise function you take the modulus of the coordinates
Nope
As its for screaming
Yes There Is: It looks weird, and PEOPLE won'T understand Why You Are Doing It.
it hinders communication
Butt using CAPS IN ENGLISH is not according to the rules
Its for goofing on what other people SaY or always for SCREAMING
def random_gradient(x, y, repeat_size = 16):
a = x % repeat_size
b = y % repeat_size
r = hash(f"{a}{b}")
return math.cos(r),math.sin(r)
using hash() for this isnt optimal since it's not deterministic but it'll do
it will introduce a seam
using high dimensional mapping is the right way
don't you want the noise to be continuous?
I am not sure what were the requirements of the guy
looking at the code, it seems like two x values very close together could get noise values far apart, because hash() is discontinuous? But I could be missing something.
Log in with a browser, get your session cookie and curl it passing the cookie as a parameter and it works
the noise can be anything
what i posted isnt the full perlin noise function, the gradient takes in the noise and smooths it
all that rly matters is that it's reproducable for that run of the program and that there's no internal state
hi guys! im going to make a super light weight but really fun to use IDE for python. its not gonna be as bloaty as pycharm and certainly not as boring as vs code. Any suggestions fellow python users?
wdym by fun?
going to have glowing text + ambient music and gotta brainstorm more
any features u would like to have? any extensions that you use in vs code that u like to see replicated here? (strictly python only for now)
I like to use math module

auto completetion, formatting, and diagnostics are always appreciated
ai based autocomplete? or the usual one?
lsp based is fine
!topic
There are three off-topic channels:
Use any of the three, it doesn't matter.
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
isnt this about python π
How I feel after staring at code for 5 hours instead of studying:

how is it related to the features though?
sure thats a necessity.
You need to import it from outside and it does some stuff normal python doesent do

Anyone ever get so frustrated with a portion of their code that they just delete the module and want to start over? lmao
yes
Bro HELL YEA
I essentially did that with my microphone/audio/Whisper code
Because it was nonstop phantom transcriptions, no matter what I did, with webrtcvad
Python be telling me that there's a indent error when the fricking code IS LITERALLY INDETTED CORRECTLY,
I don't delete the code tho, i just crash out
But I'm also a newbie, and real time audio/transcription is one of the most stressful/harder things to deal with apparently
well yeah
you're essentially plugging in a wave into your program and somehow finding words in that wave
So I'm just going to have to suffer in trying to figure it out or is there anything that can help with that lol
Doing Open Source Contribution is hard.
Finding Projects that are sweet spot in difficulty and interest is harder
whats some beginnef level examples (no boring click games)
Calculators
have you taken a python class/worked through a textbook/etc yet?
no hence why i asked to make sure if i wanna go thru w it
I don't see that being super productive without some programming background
??? u good?
yes
R u deadass?
yestrday i was helping my little brother learn python for 5 hours and he only new the print("hello world") can someone pls tell me a good way to teach him faster?
atbs
yes, if you don't have any idea how to program, staring at code is a bad place to start
cs50p is great
Investing a week of regular time in that would open up a ton of ability to usefully read code
Cs50p
I mean... Have you worked through it?
thanks i have done python for over a year now and i still only know <!DOCTYPE html>
<html>
<head>
<title>Google Sign-In App</title>
<script src="https://accounts.google.com/gsi/client" async defer></script>
</head>
<body>
<h1>Welcome to My Site</h1>
<!-- 1. The Configuration Div -->
<div id="g_id_onload"
data-client_id="YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com"
data-context="signin"
data-ux_mode="popup"
data-callback="handleCredentialResponse"
data-auto_prompt="false">
</div>
<!-- 2. The Visual Button Div -->
<div class="g_id_signin"
data-type="standard"
data-shape="rectangular"
data-theme="outline"
data-text="signin_with"
data-size="large"
data-logo_alignment="left">
</div>
<script>
// This function handles the response from Google
function handleCredentialResponse(response) {
console.log("Encoded JWT ID token: " + response.credential);
// Send the token to your Python backend for verification
fetch('/login/google', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id_token: response.credential })
})
.then(res => res.json())
.then(data => {
if (data.success) {
window.location.href = "/dashboard";
} else {
alert("Login failed!");
}
});
}
</script>
</body>
</html>
Whats this
that's not python
oh sorry that was javascript
Thats html
and javascript
And JWT.
with javascript
yeah
Uhh, how should I get back into Python..? I need it for Discord bot devving but yeaah, I never went in-depth into it.
why re learn ?
it's been so long since I've ever used it
if you already know it , you can glance over ur previous notes and get a good feel for it
no need to start at 0
I lost all of it
how long ?
Exactly
started since 8th grade and stopped since 10th grade, which means it would be 2 years now
Since u already know it, cli projects to recall stuff
alr, do you recommend it for Backend purposes?
I'm starting with Flask
Yh, but depends on what u are building
Flask is good for beginners, minimal, makes u learn how web works
did you make any projects back then ?
yeah
..such as
it was all just in the terminal
useless scripts, and I wanted something bigger so that's why I moved to JavaScript then later started using TypeScript
i was just trying to get a feel for what concepts you knew in python
but sure , start at 0 if u want to , it would just be a bit of waste of time to start at 0 if u already knew stuff , but if u didnt , then start at 0
I don't think am starting at 0, I jumped directly into learning Flask
do you know classes ?
decorators , functions
actually u dont need to know much about decorators , u wont be making any yourself
seen classes before but never actually implemented it once
and about functions, yeah
Yh, jst some basics of classes, since beginner flask is all function based routes
i suggest giving it a go , its one of the fundamentals , a lot of libraries use classes
true , flask is pretty simple
that's why I want to learn it just to learn more about Backend Development instead of using ExpressJS and more
Yh, once one is comfortable then one can learn more in depth classes for class based routes
Good choice
I've always used ExpressJS, I did grasp a few concepts but I couldn't expand, because I wanted to use TypeScript for ExpressJS and setting it up either creates hell lots of errors when put into production or something else
a pain especially trying to find out what it meant by TypeError: argument handler must be a function
i hate AI so much bro
i asked claude code to fix a simple seg fault its been 20+ minutes
ima just do it myself atp
How is ur strength of Python compared to TS
Itβs time to google
Would've saved yourself 20 mins
yep
(or took 20 hours)
well, I'd say I'm more familiar with Python than TS
I got some serious doubt of how much the AI Coding agents will respect the archictecture of the program when editiing multiple files..
sometimes it does, sometimes it doesnt
it depends how complicated the thing i want from it actually is
Also if the archictecture is "custom" (not something that has been seem too much in github or the general open code) i think it will be even messiere
Then get good at it, since u are heading the backend way, jst play around with flask with template, then later as an api, break stuff n learn
claude code does a decent job but yeah i do agree
Thatβs the worry
I only used chatgpt prompt what i want in smaller pieces, i asked a few times for the whole foundation of a project (like build a hexagon archictecture for x purpuse) but i had later to code a lot of stuff on my own and also asked for smaller changes
Btw i aint paying for A.I (i only used chatgpt, gemini and deeepseek free chat options)
chatgpt isnt integrated into coding enviroments (mayb its possible through moltbot or something idk) so it usually sucks (or is just annoying) to prompt for large projects
claude has areally good free option but you cant use claude code and theres a message limit
It may be easy if you pay for the API (tokens)
yeah
So i aint even vibecoding correctly
π
Using I.A usually kills my learning process and its making my skills dulll
So i'm really missing coding stuff by hand like before
it's called openclaw now
not moltbot
openmeme is the correct name
what's a hexagon architecture???
https://alistair.cockburn.us/hexagonal-architecture from the very creator of this design
Is it okay to sleep 13 hours a day cuz Iβm unemployed college student
Iβm always tired so its whatever
More sleep is better cuz I donβt gotta deal w this world
Unlikely, sleeping for too long (regularly) contributes to similar health risks as not sleeping enough
If you're constantly tired, might be worth it to check with a doctor
They'd probably suggest other things to look at
Nop Iβm healthy on paper
Could be a mental issue too I suppose
Pick up a hobby or a sports activity to do regularly, go out, yk, do something besides strictly college
All sorts of healthy
Well 13 hours of sleep a day is not healthy
Make projects with Python (very topical for this server and especially for this channel)
Iβm seeing a psychiatrist who has prescribed me some non working ssris for now
I have an appointment w him in like a week but idk
that site won't load for me, maybe it's silently failing on me because I'm using a VPN, anyway, I just looked it up on google, went to wikipedia, will read from there I guess
well, mention this I guess
I don't think we can give any advice that'd be more valuable that your medical doctor / psychiatrist
I did man
(also, this is #python-discussion)
I swear its all useless
I went to sleep at like 3 AM
And woke up at 5 and something PM
Python is boring for me, I prefer sleeping
So I donβt have to deal with w this world
I donβt like this world at all
irregular sleep schedule might also contribute to disturbances in your sleep pattern
I was more so saying that this might not be the channel for this discussion
!ot
#ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Man I feel the same regardless, but how does ur schedule look like?
U go sleep and wake in the same time always?
I dont even have a schedule XD
moved to #ot2-never-nesterβs-nightmare message
cc @alpine dragon
.topic
Me too actuallly
i dont have energy for anything x.x
hi
Greetings
o/
i wanna do a music bot
and i have
from youtube_dl import YoutubeDL
But when i run, it says no module found
what i do?
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
you aint slick
Ironic how YouTube has ytdl tutorials on it
@spiral karma no module for the import? You might have to install the library if you do not have it
i have it, but i should put smth in requirements.txt?
No you have it you're good
How to erase a message in python?
Depends on the message
An input
Well you can write a space character to replace it or use an escape code to do it
Wdym erase an input message
I mean that if i do an input instead of covering the whole screen it just erases the input and makes me write in the same line
!d getpass
Source code: Lib/getpass.py
Availability: not WASI.
This module does not work or is not available on WebAssembly. See WebAssembly platforms for more information...
maybe you want this, but I'm still not fully understanding I think
Cli or β¦
It should be like /r and smt
Ohh the carriage return?
It's \r and then whatever characters you want to overwrite on that line
Maybe, dont know much like you all do about python
So its \r and the variable of the input?
Well actually this isn't a Python specific issue per se
Experiment yourself because I don't know what you mean by "and the variable"
\r doesn't delete any character. It just brings you back to the beginning of the line so you can write over stuff
So i have a variable for the input so i can reuse it later and doing \r how do i reuse the input variable for it?
What you type for an input() is given to the program so you can capture it in a variable to be re/used. No need to do any printing for any of this
Well here's one
my_input = input()
print("Uppercase:", my_input.upper())
Does it delete the first input?
No
Ok, not pretending but i need it to delete the input π
You can run it and see if it's what you want
I think the input function is called once, so what ever u type into it is the only one alive when the program is running
I know what it does, i know sufficiently to code
Like what you type in for it?
But not all of python
Again you can print \r and then a matching number of spaces as the input
\r sends the cursor to the beginning of the line
I have for now a programm that its only function that is a calculator. Since its designed to have a lot more functions i need to say what function i want to use deleting the input and giving me the what i need
You can overwrite the line with whitespaces and ask for input again
Oh but I guess this won't work because input() requires a line break to work
If you're doing a more complex terminal user interface, use ncurses library
nah, use textual
What that?
or just do subprocess.run("clear", shell=True)
textual
!pypi textual
If you're doing a TUI app you should use a library like textual like people suggested here.
If it's just "delete the line of input" you could use an escape code to go back one line and delete it
Now thinking about it it's probably going to be two escape codes
There this ansi code \033[A you can print to go up by one line the same way as \r to go to beginning
not the recommended way tho
Textual huh? Lemme try that
Anthropic is apparently using react for their tui lol
Does textual work in Coding Python?
1
it's written in Python and you interact with it via Python
^
I have an app that simulates python since im on android mobile
if it has a terminal ui it should work
isnt there a file type i can include on github which shows what librarys people will need to use my project?
which app
Ok
Its called Coding Python
I think you're talking about a pyproject.toml and/or requirements.txt
ahh it might be requirements.txt
i just wanna make some half decent documents for my not very complicated autoclicker program
cause again im sure when people look at my github and wanna see my progress, they probably wanna see i was documenting from early on
You mean Pydroid3?
Dependency listing isn't really documentation... Maybe you mean a RAEDME.md?
yeah im writing my README rn
Cool
im writing a bit of context about why i made the application, then ill give some information about the application itself
pyproject.toml/requirements.txt is also important. Usually you leave out dependencies and only include one of these files to install them from
what do you mean leave out dependencies
hello I wanna ask tiny question
sys β System-specific parameters and functions
This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. Unless explicitly noted otherwise, all variables are read-only.
are they talking about something like environmetn variables but in python's "shell"
You shouldn't track and add dependencies in your git repository
you mean like import ...?
He meant, you shouldn't include the binary installation of your libraries (like your .venv folder) in your git repo
Whatever you pip install or whatever
It's not offtop yeah ?
yeah pretty much
Yeah so in order for people to then be able to run your project you do add one of those pyproject.toml or requirements.txt files so they can set up an environment themselves
okay got it thank you
what have you been searching for?
What are variables in sys
like the list of variables sys has in it?
too slow
yeah but confirm that this term is general scientific one - like the audit I just learned about and proposal
I found both computer science and uhhm economics definition of that word
I do like elders
okay bye
I am very grateful
<@&831776746206265384>
Then use selenium and bare with the side effects
bare?
Bear
im doing it
also should i make selenium download ublock using the official website or use wget to download it
Are we only allowed to post questions on #βο½how-to-get-help or if they're very short can we write them here?
short here fine
you can't post questions in #βο½how-to-get-help
funny
Oh sorry I meant #1035199133436354600
apology not accepted /s
import pandas as pd
from scipy.stats import quantile
CL_Data = pd.read_csv(r"\NYMEX_CL1!, 1D_62cc5.csv") #removed file path
returns = CL_Data.close.pct_change()
pos_returns = returns[returns > 0]
neg_returns = returns[returns < 0]
pos_returns = pos_returns[pos_returns > pos_returns.quantile(.9)]
neg_returns = neg_returns[neg_returns < neg_returns.quantile(.1)]```
For some reason, `neg_returns` and `pos_returns` have the exact same index. Am I calculating something wrong?
So basically neg_returns and pos_returns get the exact same values and index even though I'm trying to filter them by >0, and <0
That's just the file path formatting for the platform I downloaded the csv data from
It won't affect my numbers, my issue is that
neg_returns.index
and
pos_returns.index
Get the exact same value
But I filtered them...
You probably want to name a column?
pos_returns = returns[returns.colname > 0]
neg_returns = returns[returns.colname < 0]
@runic flower is your site open source?
Aha I see.
pos_returns = CL_Data[returns > 0]
neg_returns = CL_Data[returns < 0]
Not yet, the codes been undergoing some amount of upheaval, I'll need to clean it up a bit first.
It's uh... huge
I'll ping you in OT
I think my code may be correct? I rechecked the indexes they're not the same anymore after rerunning a few things, and even though the statistial stuff are the exact same
Positive Continuation: 38.46%
Negative reversion: 38.46%
Negative Continuation: 61.54%```
As the output, I think that's just a coincidence.
I think I just didn't rerun everything by accident, mb
Thanks for your help guys
hi guys
im making an ide for python. #ot0-psvmβs-eternal-disapproval for sneak peek!
Hello guys
What is ublock for?
You'd probably just install the extension and add it to the web driver configuration
Or I suppose downloading it once through the WD would work as well
@inland karma if you're up for doing it today, please say either here or in DMs
best in DMs as I might not get a notification otherwise
for making selenium not use 4gb of ram
Hi i'm new at python
Hype train into achieving a master's science degree at Kyiv Polytechnic Institute in the next 2 years! π₯³
Hi
Does anyone know how python works?
π₯Ή
In what way do you mean?
I have 0 knowledge of python and i'm interested in learning coding
π₯Ή
I usually don't recommend using videos for learning programming. But it shouldn't matter since you're a complete beginner. Try picking up a tutorial from YouTube.
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Try something from the resources list
what should l use
As I've said, any tutorial from YouTube should suffice.
Or try out the book, "Automate the boring stuffs". I've heard good things.
But you dont recomment yt instead what do u recommend
Python is difficult?
no
Oh you meant in that sense. Of course I would recommend a book.
Why a book instead of a tutorail
Do u make money with python
Quite the opposite, actually.
well u can if you want
<@&831776746206265384>
How?
I personally don't prefer learning from videos because when I try to learn a certain project, they do things in ways that I don't prefer doing. Just a preference.
I think coding is nice
Maybe learn the basics for now instead of thinking how you'll use that to earn bucks.
wdym
I will
Ignore it. They're probably shitposting.
:incoming_envelope: :ok_hand: applied kick to @fallen yoke.
whats up chat
Teeny Peeny, lmao. What a name.
So books and docs mostly or?
Yes. Or a mix of both. Doesn't really matter as long as you learn.
But for absolute beginners, I'd say videos are just fine.
yeah for sure
what books though
I also find I learn more by reading and working through docs.
@frail scaffold Here you go.
I concur. Documentations for the win.
yeah tutorials are passive and boring
Do u think tutorials are passive and boring ?
well, if you just watch them, I can definitely see how they might feel that way
They're... alright. I mean, there are some really good ones.
I mean, I like to listen to and watch tutorials in the background while I do other stuff. It is good to get a primer that way before digging in. Data with Baraa really helped me through a lot of concepts but nothing has been as good as turning off wifi and sitting down with a learning project and some downloaded md files + the sdk.
People can be passive. It's about what you do, not what you use
What do you think?
Yeah true honeslty for me l cant stand step by step tutorials even books
Very true
Id rather think and break the problem into smaller parts and try and solve each myself
Some tutorials I like. This one is good: https://numpy.org/devdocs/user/quickstart.html
hello
I accidentally pasted something that was in my clipboard but that I didn't intend to send here. I meant to send this:
- Automate the Boring Stuff is a really good book for complete beginners and it's free to read online.
- If you prefer to watch video tutorials Corey Schafer's playlist is also really good.
- I also recommend Harvardβs free online course CS50P: Introduction to Programming with Python.
- Python Programming MOOC 2026 is an alternative online course with lots of integrated practice problems you can do directly in the browser.
Yo I'm in y11 and I wanna be a software dev but I only know python and I wanna learn another language but I need to balance it with school though yall got any advice?
just start
There's no point in learning multiple languages just for the sake of it. You're much better off just making more projects using Python, of gradually increasing size and complexity.
Hey yall What are your thoughts on coursera courses for python
Oh ok thanks
I don't think they're necessary. There are a lot of good free resources.
You're better off mastering one language. Migration gets easier when your foundation is strong.
I, on the other hand, tried Java as my second language after python when I was still a beginner. You could try looking into that if you want.
Even if the free sources donβt give me certifications? Or does that no matter
They matter very little.
guys what does βsnekβ mean?
Context?
its a tag
the server tag of this server
Oh ok thank you
π 
It's just a tag. Meant as a joke since python is a species of "snake".
Like how about when I look for a job. If I donβt get certs how can I prove I have knowledge. I know people say having a portfolio helps but canβt anyone just copy stuff and make up a portfolio?
it looks cool i will take it on my precious profile
I dont think certs are worth much and making projects are more meaningful for resumes and help your skills more
Honestly, it's extremely difficult to get a job without a degree.
Is there a reason you can't go to uni and study CS?
Im kinda struggling to pick a new learning project now. I have a solkd handle on syntax, oop, control flow, error handling, data structures/data structure manipulation. Idk I got started bc I have an ai homelab but I dont care about the ai stuff now that I understand it better. Just cant come up with anything to get excited about.
!kindling
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
College is too expensive. Donβt really
Have time for it either. Thatβs why I took the cert path so I can do it on my own pace
Try making a game. It's really easy to pick up and quite fun too. Check out the pygame library if you're interested.
The expense part can be done using grants, loans, scholarships, or a combination. Most universities will have a financial aid office to talk to.
Putting in the time is just something you need to do. The other people applying for the jobs you're applying to will have put in 4 years of university, you need to as well
Should we be suggesting pygame-ce instead of pygame across the board these days? Asking as a non-pygame user.
i am in my new home with no electricity how can i charge my phone without powerbank or nthg
in my biased opinion, yes
Shoot. My bad. You're right. CE is the better and most used version.
unfortunately we haven't figured out a way to generate electricity from thin air yet
depending where u from try community college its cheaper
we haven't?
what about dense air then
I'd say so. It avoids problems with installing it on more recent versions of Python
i guess except windmills
Well, there's wind power.
though i dont know how well they work in thin air
Unfortunately Iβm a felon so wonβt be able to get financial aid and stuff like that
try community college
yeah i dont know what to tell you about that
you guys didnt, i tought python made that possible
nah only rust has that feature
i am installing rust on my phone

do you have 50 potatoes, 100ft of 20ga wire, a usb cable, a soldering iron, and some basic electrical tools?
transform the heat of your body into electrical energy
Thatβs why I thought going for certs would help but if itβs the same as taking free courses then I wonβt bother paying for the courses. Just wanted some feedback from the pros
A gas powered soldering iron I presume?
a soldering iron?
Thank you so much!!!!
Do you have a couple of hundred dollar bills to pay for the electricity?
not 50 potatoes but 20 i have a usb cable that is from usbA to usb lightning
Or just to burn, to drive your tubine?
WE DONT HAVE ELECTRICITY YET
certifications and free online courses are essentially worthless in the SWE field. previous related experience is the most valuable, with degrees as a second
Sorry to hear that. Not trying to discourage you, it's very possible to learn programming on your own, but it is a fact that the job market is very rough right now, even for people who do have degrees, so I just want to be upfront about your chances of actually getting hired.
literally just go to like any public building
Yeah, thatβs why I asked if you had money to get it
its 22:08
and?
everywhere is closed
just go to bed then not having your phone charged for one night wont kill you
this is literally not even an issue
Wait til morning π§
Wait til evening π§
Seems like you have no choice.
thing is, we won't really be able to find out if it didn't actually kill them
it is how it is
what if my mobile data runs out do we have free no cc needed mobile data?
You could eventually buy a hand crank powerbank.
I have no idea where this conversation is going. Lmao.
Anyway, I'm off. Goodnight, guys.
its going to the mountains
"Man Dies in Mysterious Circumstances After Phone Runs Out of Battery and Electricity Bill is not Paid"
Unliklely. But what's your data quota? If you avoid video, data is a lot lower.
I took it that the electricity isn't yet arranged/connected.
4GB
Kansas City, Antarctica
Acute social media withdrawal syndrome?
is it my storry
??!
hope not
good night guys, i will write here when i get to work
ASthMWA
Does scipy.optimize.linprog just not work at all for integer linear programming? It has an integrality argument that is ALLEGED to treat a variable as an integer, but in reality it just BRAVELY ignores this argument.
The documentation says that it uses highs (a C++ ilp solver) as a backend for ilp problems, but it returns floating point garbage. This happens if I let it default to highs or manually specify method="highs". Eg:
A_ub = [[617700, 1234977], [-7069232, -14133623], [1757440, -57677832], [4694092, 70576478]]
b_ub = [0, 0, -1, 9444371]
lsoln = linprog(A_ub[-1], method="highs", A_ub=A_ub, b_ub=b_ub, bounds=(None, None), integrality=1)
lsoln.succes: True
lsoln.x: [-2.61384659e-07 1.30737094e-07] # scholars will note these are not integers
lsoln.fun: 7.999999999989568
Is there a way to make scipy actually do this, or do I have to use a different library?

is this c or python?
scipy is a python library
okay π i dont know
well, that doesn't make for an exciting headline
we must imply the poor guy was also... poor
thats me
i am poor
a game does sound fun. I had an idea to combine "learn by teaching" with programming by making a teaching rpg. Like your "class" is literally instantiated as a subclass of your character and you have to write functions to attack, move, and use your inventory (which is a list you have to instantiate after unlocking). Idk.
Interesting
I think I'll try PuLP (different python library) instead, it really is so stupid that scipy has an integrality flag but it's just completely broken, like, why not just remove it if it does not work π€
guys please ping me after i go to sleep i want to wake up to notifications
Do it! Love games like that.
@gloomy radish are you asleep yet?
no i sleep in 4 minutes
How will we know when you fall asleep?
an rpg-7?
i dunno i will get my phone of in 3 minutes
yes
not much screen and stuff but mostly rp
I have a sick idea with some of the new stuff I learnt last class
that would teach different kinds of lessons
π
It's very possible. There's been literally hundreds of D&D-inspired games.
DnD do not disturb?
I am thinking of a up to 8 players and i think i alr got how the player database can work
like... the history of rpg games is just "somebody forked dnd"
Dungeons and Dragons
namely to watch out for backblast, how to aim the thing, what else?
Mm, yeah, I think the idea of xp and levels originally came from D&D.
goodnight
Yeah, it did.
depending on how you use the term level
cuz the first time it was used i think is tetris stuff
Wait just a moment so we ping him so heβs definitely asleep
or yk the original pong
In the sense of level-based character progression.
I think the earliest use was in working tools
then yeh
So all games with xp and levels draw on D&D indirectly.
Ping
Ping
u up?
Ping
Pong
just got a hall effect keyboard
Hi
Hi
lol for some reason reactions are enabled
it is the latest and greatest update
oh hell yea
yay
now the pins are out of date
woah
Python isn't very fast, especially for something as complex as a widget toolkit
GUI usually isn't done from complete scratch, since your operating system has some widgets built in, but sometimes people do just grab OpenGL or similar and get drawing - this can cause accessibility issues, break some input methods and such.
TUIs are pretty straightforward, swap the terminal to the appropriate modes, and do the positioning as required.
Yes, but it's quite slow
how fast do widgets have to be? What are yours doing?
I've seen a couple people do perfectly serviceable TUIs and GUIs in Python
Batgrl, kivy for example
I do expect that work went into performance there that you'd perhaps get away with in C++, but it's definitely not a major obstacle.
75fps, I had a flexbox-like layout engine and css parser for styling
For fun mostly
I also know Javascript and I'm learning Nim
"60fps CLI in react"
Yeah, you do have to talk to OS to open a window and draw on it
The emojis are back? π€©
The OS also has e.g. a textbox that behaves "correctly" for the platform (text navigation, copy paste, special input methods and such)
You don't have to use it, but then it's usually polite to reimplement the native behavior
Hiii guys , is there free alternatives to cursor , Antigravity ?
If i do not ?
Thank you
I want to rewrite my widget toolkit it in Nim
I've never been this close to a headache but not a headache before XD
also it's just fun to learn something new
Yeah
Nim is compiled
so it's a whole lot faster
Oh yeah, I'll need to fix it lol
I tried out Nim and was somewhat let down by it. The language compiles to fast code and it isn't hard to learn, but it's full of design decisions that felt compulsively quirky, and it's just not getting much uptake compared to, say, Rust. And the direction of the language is dictated mostly by one guy who is rather opinionated about it.
YOOO
Really with programming in Python correctly you mostly should just be following PEP style guidelines wherever possible
PEP 8 is like 90% of the style guidelines
the others are just little things that are good to follow
yeah
sup
i never had to read peps except a few specific ones
I would rather use a formatter than write perfect PEP8 code
yeah formatters and linters help with it
but with time you automatically write on your own without their help lol
quick question: i have a project im planning on working on but im unsure about how to do a specific part should i ask this in here or put it in python help. The part i need help with is a rather short thing
If it's a quick question you can ask here
but if it's more involved go to #1035199133436354600
first google and try reading official documentatin
@pallid garden Your actually really new here
look it up the docs
How would you guys go about writing a heavily sanitized code executor? I am running with my python-rpg game idea but I obviously can't just let players have raw execution. I'm thinking of something like parsing, linting the code for safety, running it a separate process with try-except soup, and then checking if the results are valid with the game rules and then just comparing the new value to the game state and updating the game state. This way the code has to work, can't crash the game, and still does what it is supposed to? Or am I overcomplicating this?
This isn't an easily solved problem. Sandboxing Python is inherently difficult
That seems hard to do
i think i'm missing context here but why does a game need to run arbitrary user code?
Uh the idea is to make a game where players use python to write things they want to do before they can do them. Like their character "class" is literally a class, inventory is a list and they have to write functions to manage it and equip stuff. It's a learning game.
huh did reaction permissions change in this channel ? 
yes
Wdym?
Omg
wait how do you read the output file of python -m profile with the -o flag?
only staff could react before
Yeah π€©π€©π€©
i see. maybe you design your game as a python library that users can call into?
ironically, this change actually reduces staff permissions
we can still flex image perms if we need to
That's an interesting idea. I still need to figure out how to convert player code to game state safely tho.
Applied for a data analyst role at cern π
From stdlib, you can use the pstats module.
you wouldn't need to worry about it
How do I get the list to print out the tuples of the zip object instead of a reference to the zip object in #bot-commands message
thanks
dont use zip
??
You'd need to iterate over the zip object for you to get tuples.
lst = [(c, r) for r in e]
:hmm
the reaction restriction to pydis-and-discord-wide emojis did not apply to staff before. now it does. this may not apply to all staff, like mods or higher, but for us helpers, it does
Ohh I understand, also how to become a helper?
see #roles
perhaps you can answer that question, being a director, stel. are all staff levels no-external-emojis here?
staff (with nitro) should still be able to use external emojis
I just need a role with color , I'm scared of losing this color :(
Also when is this role getting removed?
you can give us a nitro boost, or give us money on patreon for our prize chest.
isn't the aoc role usually removed come the first week of february
we'll sunset the AOC stuff Soon.
Yeah I was wondering that
I mean I think it's easier to get the contributer role tbh , and I've no money :(
the contributor role is the only one you can "work for", I guess
@glacial ginkgo You have check RLMS (recursive language models) they run repl with AI generated code and they do sandbox the code, you may look how they do it
The gym > python
who says you can't have both
life does
can someone help me in #1475285983166595234
Yup
I can see someone has already replied
i know people who're jacked and cracked
i went to the gym once 6 years ago ask me if im joking
@upbeat sleet You can stop trolling now, thanks.
you should join me and @slender urchin at Diamond Gym
3000 reps of rhabdo π£οΈ
Aboo wake up youβre dreaming again
Such a flex ! ππ€ͺ
sassy boy πͺ
Suggest more topics here!
??
look at the examples, copy one, build on it until it matches my needs
I have a question, check #ot0-psvmβs-eternal-disapproval
dude i was the 0th percentile BMI for my age range
read the docs
by looking at docs/good tutorials (im looking at you tkinter)
what do you think an interviewer might ask for a python fastAPI interview
what async does
maybe what kind of middleware is appropriate for certain scenarios?
@uneven harness take a look at this message for detailed resources
ive no idea im going to have to look it up
yeah that's going to be something i'd ask probably
Remember, no ChatGPT.
Soβ¦ youβre a corpse?
yh
The lightest person alive for a given height is the one person who's the 0th percentile, I would think
And the heaviest is 100
do ya'll use coding agents for programming?
no
never ever?
Not anymore, but only because I'm still very new to programming and actually learning how to build the little stuff I was vibing has helped make me better. I still don't think I want to 100% vibe but I plan on eventually using ai completions to speed up my work once I'm confident I really know what I'm doing.
i do nowadays for web design stuff that i hate doing
No because that removes the fun out of programming imo
Use it when you're an intermediate, not for vibe coding, but as an Assistant and code reviewer for bugs / optimization areas.
vibe coding seems to good to launch a quick mvp
huh? i use it for vibe coding aswell lol new models seems to work fine for basic use cases
like making dashboards and other stuff or similar complexity slightly harder even!
do you tell it how to structure the code or how you will be running it or what dependencies to use or purely vibe coding?
1st and 99th percentiles.
i also think i'd need to build a habit of reading lot of ai written code π©
Not if you paid me.
having specifications, the tech stack, your prefered libs is nice since you can add them to the prompt
If you're heavier than 100% of other people, that's the 100th percentile, is it not?
just do a saas man
Percentile is from 1 - 99. It's weird.
you can have 0 percent right?
yes but then im not sure if its "vibe coding" bcz.. when you're vibe coding you shouldn't care about Anything.
and just seeing it work
well the term is very poorly defined
???
whats 0% of something
nothing
wht does saas have to do with this π
0 percent, yes. 0th percentile, no.
some people use vibe coding to mean fully ai generated with no technical input from the user, some mean vibe coding as in just using ai for most work, some call using ai at all vibe coding
bro doesnt know
Karpathy <- person who coined it, said you shouldn't care about code at all when you're doing it
Yeah i'm not sure, if its a project that you do not want to throw it to the garbage quickly, you will have to maintain it in the future so you may care about the tech stack, the libs, architecture
the heck are you on about π have you ever actually shipped anything? i still don't know what does saas have to do with what we're talking about.
You can still vibe your way into the mvp, but you may add guardrails for best results
Coding too hard bro I still don't know def broo
just do it
!d def
8.7. Function definitions
A function definition defines a user-defined function object (see section The standard type hierarchy):
do you speak english π
ngl they should change def to fun
as my second language
Well, yeah, to be specific, it depends on context.
thats one of the most stupid things i've heard from someone lol, why would they do that π ?
because its fun
What the fuck is object oriented programing
everything is a object
Huh
no need to worry about it tbh
are you in a frame of mind to learn about it?
basically a specific way structure your projects
basically you have a thing with information and "methods" (actions)
why do you ask?
Yeah bro
Can we de debate oop in this channel or its a heated subject? @cerulean ravine
OOP is a method of combining data structures with the functionality that they need.
its like if c structs had the possbility to add functions in them
we can talk about it, not sure it will be a debate.
we've been bundling data like that since before OOP was a thing, whats so "oritented" about it?
Why would it be a heated subject?
Because mostly definitions of oop are deadly wrong..
oop is actually kinda poorly defined, the definition has shifted a lot over the years. Tho python is generally considerd to be very oop heavy
You can add functions to C structs. Sort of.
wym sort of?
because its an abstraction of the world,you can see that everything is an object (irl),with its own attributes and methods that interact with eachother
You can add pointers to functions to the struct and then when you instantiate you need to actually point them at the desired functions.
OOP was not classes or methods (modula, c++ style that has infected every language), it was about objects that could change their own state based on MESSAGES that they could comply or not
im pretty sure there is an academic paper thing about oop
right, and methods are a very ergonomic form of message passing
Was there an issue with my definition which does not mention either classes or methods?
"messages" was how Alan Kay first talked about it, but that is not the way people talk about it now.
The concept evolved, as many things do.
can we make functional programming the new meta?
def means define, it is used to define (create) a function, a function is just a block of code which you can call more than once however you like. A function takes some inputs (called as arguments) and returns a value, a function is called by its name with () (called as parenthesis)
example:
def add(number_1, number_2):
result = number_1 + number_2
return result
result = add(2, 3)
print(result)
You can call the function add with different inputs as many times as you want. In this case, the function helped you save the logic of addition of numbers in a single place without needing to repeat the same addition logic whenever you repeatedly need it to add numbers.
C structs with methods is just an improvement or a evolution of the Module concept, with iinheritance (bad) and interfaces (implementation definitions, nice)
tldr; its like math functions (y = ax + b)
Real.
I prefer to expect the learner as knowing literally nothing, and be as explicit and english as possible, that's why i even used explicit long variable names over abbreviations.
A functional core and imperative shell maybe, deterministic / pure functions
thats an expression not a function
f(x) = ax + b
or if you want formal mapping
f:x -> ax + b
lambda x : a*x + b
has this helped at all?
Idk this bro I don't understand bro
What don't you understand?
No bro
yeah you gotta have an actual usecase example like that don't usually click anyway
Surprising bruh everyone else would of understand by now
Please don't call me "bro". If you tell me what you don't understand, I can see if I can explain such that you do.
its totally normal not to get it at first lol
you know how to solve a quadratic equation? (or at least remember)
Could you clarify what exactly do you not understand in this?
First of all, relax your mind, do not think you wouldn't understand or this is scary or anything that is negative.
Re-read what i wrote in the message, see the first word or a few words together, then come back and look if you understand it or not. Note down what you did not understand and i will help you understand it.
not sure hows that related to the use of def
Bro I was coding for like 3 weeks and 4 days now
all good
what were you coding?
Guys I am overwhelmed by the amount of options l have
I made a quiz type game
nice
you know how to get the area of a triangle?
how so?
No
Tho it's helpful for those individuals who have done math (assuming they're fine or fluent with it) to learn programming from a mathematical perspective and similar analogies.
what part did you struggle the most with?
oh how do you know its a thing in python? who told you that
ngl programming is very similar to math,thats why i like it
?????
are you just saying random things??
this is #python-discussion
I was reading the online python compltior book
im trying to learn him how to use functions by approaching math
Functional programming is very like math, i don't find the multiparadigm programming languages we have today to be like math
you don't need def to measure the area π
How long did it take u to learn def?
A few minutes.
Don't worry about comparing yourself to others
My brain is this slow bro taking me hours I don't know still
keep going
def is just a keyword that is used for defining a function.
you don't need def for any of the things you've said above
you will get it,friction is the part of learning things
this is why you should stop asking questions like this
I ain't spending 10 days learning def
I think you're probably deliberately self-sabotaging at this point.
tell me something that you know from math
What does that mean?
Basically, you use def to define a resuable block of code that can return data back. For example, you can have a function that multiplies an integer (number) by two and returns it back for use later or in the moment.
def multiply_by_two(input):
output = input * 2
print(f"{input} times two is {output}.")
return output
number = 4
multiplied_number = multiply_by_two(input=number)
1+1 = 2
its easier for me to explain using it tho
Yeah, I don't think Mellow is one of those people in my message. And programming in Python, at beginners' level, IMO, is more explicit, easier than writing the equivalent or similar in math.
hey guys
ideas on how to get chatgpt to read a problem effectively and meet all its requirements?
that sounds off-topic. this channel is about Python
Explain it more simpler bro
I can't tell if this is ragebait or not at this point π
