#python-discussion

1 messages Ā· Page 61 of 1

pallid garden
#

well yea

junior vigil
#

but if you made it in an app, and your coding skills is that good then yeah

#

since i kinda have an image of how i want my app to look like, but i dont want to code that for days then it ends up looking like garbage

swift sparrow
frozen narwhal
#

I don't remmeber the guy that sent me the python turtle docs, but it helped so much thank you.

mild sequoia
#

there was a guy in here earlier building a game w/ a turtle module as the intro to the ui, i wonder how often the turtle module comes up

junior vigil
half pewter
#

not often really

junior vigil
#

"for me"

half pewter
#

it's a fun little exploritory app

#

library*

half pewter
#

people tend to gravitate toward tkinter/pyside or pygame

tiny oyster
junior vigil
#

just told me "make the UI normally" then if you feel like improving "improve"

tiny oyster
junior vigil
# tiny oyster What was the problem?

no problem except that my UI looks shit, my program is almost complete i just got to make Boiler plate UI and let an API do all the work for me

pallid garden
#

UI design is not exactly straightforward

#

it requires some creativity for sure

tiny oyster
junior vigil
#

but i cannot reach the 2nd step unless if the 1st step is good, and if there was no way i can properly design my UI then i might lose the possibility for bonus points

pallid garden
#

draw it out on paper

junior vigil
#

i just want somewhere i can design my UI with graphical stuff, sure i can block stuff out but that's not what i want

pallid garden
#

i still dont understand what you want

tiny oyster
pallid garden
#

figma is also blocks

#

everything turns from blocks into actual designs

mild sequoia
#

doesnt the ui program change based on if you are developing for ios/android/windows?

tiny oyster
#

Why don't you ask in Figma server or UI community?

junior vigil
# pallid garden i still dont understand what you want

look, what i need is an app/website that allows me to design my apps so that:

  1. i can block out ui [as in see where each block of text/image go]
  2. make the most perfect UI reperesentation so that when i code i know exactly what to research and google to make that effect work
  3. doing that on paper wont let me hit step 1 and 2
junior vigil
edgy krakenBOT
#

10. Do not copy and paste answers from ChatGPT or similar AI tools.

hot abyss
#

My bad

spare quest
#

!rules 6

edgy krakenBOT
#

6. Do not post unapproved advertising.

half pewter
#

kind of a rule 6?

hot abyss
#

ok let me delete it

half pewter
#

anyway, since you're asking what we're tired of...

pallid garden
#

i struggle to think of a piece of code that i rewrote

tiny oyster
#

!rules

edgy krakenBOT
#

The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.

hot abyss
#

So, how to advertise something?

tiny oyster
hot abyss
#

like any platform or somewhere else?

visual juniper
#

reddit maybe

pallid garden
#

somewhere else

spare quest
half pewter
hot abyss
pallid garden
visual juniper
half pewter
#

dunno what that means but I think I'm missing some context

hot abyss
pallid garden
#

people keep saying that LLMs are good for boilerplate code

#

i just havent found a case where i couldn't abstract it out into its own function

#

im sure it's useful for some people

visual juniper
golden mortar
pallid garden
#

i dont really consider that

#

i just do it (which may not be prudent)

golden mortar
#

Abstractions tend to increase code complexity.

#

And that can make it harder to maintain and extend.

hot abyss
#

I think it is useful for just to create a layout for the type of code you want but in the end you have to make some changes on your own. How correct am I?

golden mortar
#

Bootstrapping a draft to work from is one of the major things I use LLMs for.

pallid garden
#

my english is not really good enough to understand what bootstrapping means in the context of a draft

golden mortar
pallid garden
#

i just use uv init && uv venv

golden mortar
#

I mean the code itself.

#

I find that it's often mentally easier to change something that exists than to create something from a blank slate.

pallid garden
#

personally it's the opposite for me

half pewter
#

Not worried about your grey matter though?

#

Not to question your intellectual capacity but I find that LLMs sort of trigger auto-pilot

spare quest
tiny oyster
inner river
#

Hi

tiny oyster
#

Hey

half pewter
#

Hay is for horses and me

tiny oyster
half pewter
edgy krakenBOT
#
Resources

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

golden mortar
tiny oyster
pallid garden
#

i think it's also the fact that i enjoy writing code

spare quest
golden mortar
#

If the LLM introduces a concept I'm unfamiliar with, I read about it from a 3rd party source before I use it, sort of as if I had found it through googling, which I frequently did in pre-LLM eras.

visual juniper
wet lotus
#

did i spam anything

#

?

#

i was hacked sorry guys 😭

visual juniper
wet lotus
winged shale
wet lotus
winged shale
#

Hack him back

wet lotus
wet lotus
winged shale
#

Also use 2fa if you can

wet lotus
visual juniper
#

2FA should be mandatory in 2025

wet lotus
winged shale
grizzled solar
#

Idk why everyone whose account has been compromised always has 2FA turned off
For hecking, a token is needed which 2FA cannot protect so how does it work?

harsh swallow
#

Uh... What token is needed for hacking?

grizzled solar
#

I mean to get control of someone's account, a token is what is needed, right?

grizzled solar
#

And even if 2FA is enabled, having the token cannot save it

harsh swallow
#

You mean like discord and stealing a token? That's different approach to attack than actually cracking a password or checking reused passwords from leaks from other sites

visual juniper
grizzled solar
#

In that case, how do they umm forge the "click the link in email to get access" thing

harsh swallow
#

Token stealing on discord is akin to stealing cookies for a website. The attacker already has to be on your machine and the site/app has to have little protections (e.g. some invalidate a session if useragent is different or you use different ip)

grizzled solar
#

Like when I don't have 2FA enabled, I get an email something like "New Location detected"

visual juniper
#

i think you are mixing up tons of different things

harsh swallow
visual juniper
#

2FA means , even after you enter your password for login , it wont log you in untill you authenticate yourself in some other way

this "other method" can be anything , an app or an SMS or whatever

grizzled solar
slow rivet
#

Or getting a malicious program running on your computer.
Or tricking you too scanning a malicious qr code using the discord app

visual juniper
grizzled solar
warm ridge
visual juniper
warm ridge
visual juniper
sand hornet
#

So, I have to admit that there are some things some companies refuse to protect. Discord and user token reuse is an attack vector Discord refuses to do anything about (trust me, I’ve tried to get them to care).

Logging in to Discord: That said in order to login to Discord (as any random user), username + password with optional 2FA is one way. They also have the QR code thing (don’t scan random QR codes and approve sign ins that way).

Creating malicious emails: If you see an @discord.com email in the from, you’re probably fine. Go ahead and click that link. However, if you see something unfamiliar there, maybe don’t click that link. Instead, send that over to junk/spam. Emails are basically glorified MS Word documents. They can have links, they can have images, they can even contain JavaScript. Email, by far, is one of the worst things to exist when it comes to security…and yet we use it every day like it’s normal. NC_melting_face

ionic oak
#
print(__file__)
``` this prints out `c:\Users\User\Desktop\python\real programs\test.py`, how do i make it print out `c:\Users\User\Desktop\python\real programs` no matter where the file is located?
harsh swallow
# grizzled solar It's either email + password + 2fa or email + password + click the verify ip ("n...

Uh, no. You're mixing a lot of stuff.
Email is a kind of second factor. It may show up additional info like ip and location, but the code sent is still a kind of second factor.

You said "forge" email with that link before - this is not forging the "click here to login/click to verify ip", it's always forging emails like "someone tried to login to your account, we blocked it, now log in via this link so you can see more info" - and that link is normal fake login page, where they steal your username+pass (phishing).
That forged email is not connected to 2fa AT ALL.

And that's the case of attackers stealing password (not "token") where 2fa actually saves your arse - because unless the attackers are already checking your password at this same moment, they can't ask you for 2fa code.
And some second factors only work for given website (physical keys like yubikey, for some protocols used in second factor) or show that additional info like ip/location so it also saves your arse.

That's why 2fa is good. Going around 2fa or somehow getting the user to give the attacker that second factor is usually hard

swift sparrow
#
import os

file_root = os.path.dirname(__file__)
ionic oak
idle sorrel
#

i was switching database from local db.sqllite3 to postgreesql how do i import those data in postgree sql?

harsh swallow
# ionic oak ```py print(__file__) ``` this prints out `c:\Users\User\Desktop\python\real pro...

You can use pathlib.Path to turn such string into an object you can easily manipulate.
So import pathlib and then SCRIPT_DIR = pathlib.Path(__file__).resolve().parent - I use resolve to make sure it's absolute path, then take parent to get the directory
Then files in the same directory will be SCRIPT_DIR / "filename.jpg" etc. Path objects work anywhere where you'd normally pass a string path, so you don't need to modify anything else

rare gazelle
#

what are your thoughts about this:

def find_numbers(text):
    return list(map(float, re.findall(r"[-+]?(?:\d*\.*\d+)", text)))
golden mortar
#

How long-lived are Discord session tokens?

jagged belfry
edgy krakenBOT
jagged belfry
#

oop

#

nope that doesn't work lol, you do need that .parent..

golden mortar
#

Sounds like a pain in the ass

#

"regular"?

sand hornet
jagged belfry
#

TLDR

#

if the discord client itself doesn't log you out, the token lasted that long

#

because there's no difference between what the client can do and what someone who has hacked your client can do

golden mortar
#

But if a token is stolen, is the refresh token typically stolen as well?

jagged belfry
#

and I don't recall being logged out of my discord because of expiration forever

sand hornet
golden mortar
#

It's still a bunch of admin work

sand hornet
#

Literally doesn’t work if Discord doesn’t properly secure their endpoint. It’s one more thing in the mix that introduces more security vectors

golden mortar
#

Are you talking about automating the password change?

#

I would guess Discord uses captcha to prevent setting passwords automatically

jagged belfry
#

But I know they changed it in the last few years, splitting out MFA and stuff. MFA tokens are structured differently now

#

regardless, it doesn't really matter, because discord doesn't do anything fancy like store your refresh token in the TPM. It's just in the JS like everything else.

#

If they have it, they're you. The only way out is a password reset. Which is deliberately not automateable via cloudflare

#

Practically speaking this is a pointless security boundary. Nobody is intercepting discord requests between you and their server, and if they are, then you're already fucked because they can MITM TLS and serve you whatever javascript they want anyway.

jagged belfry
#

Protecting tokens

#

"What kind of encryption protects me if someone has a knife to my throat" it's pointless

sand hornet
#

Treat this like it’s 2003. Nobody uses SSL certificates for their banking website. C’mon everybody just uses the ATM. You log in to a site on your laptop using public WiFi (rare but it existed). You think nothing of it, and log out then head to work. You can’t stop thinking that someone was looking over your shoulder while you type that password in and decide to log in once you get to work to be certain. Now, you could’ve sworn the savings account showed $49,000 but for some reason that looks like $47,000. So, you’re a bit confused and call the bank to confirm. They say it’s at $47,000 so you ask them to freeze your account until you can change your password and visit them in-person to have a new card issued.

What do you do in this instance? You know that;

  • Your bank put your account on freeze for the day to retain you as a customer
  • Either your credentials online were stolen, or the credit card was stolen
  • as the only thing you can recall doing that day was logging in to your bank on public WiFi, was it that WiFi network’s fault? Was it the banks fault? Who would’ve known that this could have been an issue?
#

I’m asking you to go along with it. It’s designed to act as a way for me to be able to explain something in terms of security, this isn’t what we’re discussing either but a literary device to bridge a communication gap.

jagged belfry
#

Then I think rule 5 applies

sand hornet
#

It is considered against Discord TOS. It would be breaking rule 5.

pallid garden
#

if i understand tokens correctly, once they expire you use it to refresh the token and get another one, but there is a time limit before which you have to refresh the token otherwise you will have to login

jagged belfry
#

The TLDR of security boundaries is you must have, at some point, a token that represents the user and can do anything the user can do. Any restrictions applied to said token also apply to that user. This is why there's things like session resets and security logging, because you can apply those to users and they won't be upset.

A refresh token enforces persistence. You can have a token with the restriction "must regularly check in" by changing the user representation token to a refresh token, and only allowing the temporary token for some time. Akin to badging in at an office. But the same principle applies: once someone has the refresh token, they have full access. And the user must regularly expose and refresh said token

#

The reason we have auth tokens at all is because passwords get shared

#

auth tokens do not

pallid garden
#

people would share auth tokens if they could

jagged belfry
#

this allows you to reset an auth token or use an auth token that isn't by chance shared with other services or reused beyond what you want. It also allows you to force a user to "log in" to authenticate with their "I am me" proof (password).

sand hornet
# jagged belfry auth tokens do not

Well, Discord’s implementation creates a refresh token and bearer token on each sign in. Refresh tokens are a cookie that you can use to get new bearer tokens in their case..

jagged belfry
sand hornet
jagged belfry
#

And of course if you were userbotting you could just use regex to tokenscrape and hijack all of those accounts in realtime

rare gazelle
#

i've now done it like this:

def find_numbers(text, accept_int=True, accept_float=True):
    # global text_numbers  # not changing its value

    current_result = []

    if accept_int is True:
        if accept_float is True:
            current_result.extend(
                (
                    float(number)
                    if '.' in number
                    else int(number)
                )
                for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text)
            )
        else:
            current_result.extend(map(int, filter(text_numbers.__contains__, text)))
    elif accept_float is True:
        current_result.extend(map(float, re.findall(r"[+-]?\d+\.\d+", text)))

    return current_result
jagged belfry
#

We didn't need to because we had a real bot do it

mild sequoia
# pallid garden people would share auth tokens if they could

the amount of ceo's/executives that request to remove themselves from mfa or request bypass because they are too important is astronomically hilarious (and also a reason during security breaches that insurance companies who provide cyberinsurance will ask for the 2fa/mfa logs to prove they were secured at time of breach, otherwise no payout)

jagged belfry
rare gazelle
jagged belfry
#

idk what you're doing so idk if it applies

#

cool

rare gazelle
#

like 5.2 to give both 5 and 2 as ints also?

jagged belfry
#

It just does first match

#

so I think 5.2.2 will get you 5.2 and 2

rare gazelle
#

yea thats fine

#

i wonder if my regexes are tight though

jagged belfry
#

Looks fine, assuming you just want 5.2 and +5 and -5 and 5 cases

ionic oak
#

if an error is "raised", can the program still run? i'm for the program to try to detect a darkmode button in an app, and if it fails, locate a lightmode button
but rn when it fails to locate the darkmode one, it just kinda gives up? im not sure as i still dont fully understand the "raising" thing

jagged belfry
#

Other random thoughts are handling of 5e10 or 5,000 or 5_000

#

or the weird standard some contries use of 5.000,00 for 5000

rare gazelle
jagged belfry
#

But otherwise it looks good

swift sparrow
fresh sentinel
#

Anyone got any ideas on a dc bot i can make

jagged belfry
#

some people use periods as the thousands separator

#

and I swear some location doesn't do sets of threes either

ionic oak
jagged belfry
#

localization? hell

rare gazelle
#

šŸ’€

sand hornet
fervent matrix
#

Sorry wrong reply, mobile is a bit wonky

jagged belfry
#

!e print(int("²"))

swift sparrow
ionic oak
swift sparrow
rare gazelle
ionic oak
ionic oak
jagged belfry
#

!E ```py
print(int("ą„¬"))

edgy krakenBOT
jagged belfry
#

!e ```py
import re
print(re.match("\d", "ą„¬"))

edgy krakenBOT
# jagged belfry !e ```py import re print(re.match("\d", "ą„¬")) ```

:white_check_mark: Your 3.14 eval job has completed with return code 0.

001 | /home/main.py:2: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option.
002 |   print(re.match("\d", "ą„¬"))
003 | <re.Match object; span=(0, 1), match='ą„¬'>
swift sparrow
ionic oak
swift sparrow
#

you could wrap the whole thing in a function and have it return None on fail

swift sparrow
#

!e

try:
    print(x)
    print("Inside Try")
except NameError as e:
    print(e)
print("After try/except")
edgy krakenBOT
swift sparrow
#

you can see here the program continues after the try/except block

ionic oak
#

i dont fully understand it so i'll look into it, tysm!

swift sparrow
#

instead of erroring though, it goes into the except block (which is just printing out what the error message would have been)

ionic oak
#

so the except is preventing the program from crashing?

swift sparrow
#

yes

#

try is where you put the code that could potentially error

#

except is what to do if the code inside try errors

#

but you could see I specifically had except NameError because I only want to handle NameErrors. If any other time of error were to occur, I would still want to know

ionic oak
#

and if it succedees, it just does it?

swift sparrow
#

yes

#
import pyautogui

try:
    pyautogui.locateOnScreen(...)
except pyautogui.ImageNotFoundException as e:
    ...
#

so for you, you would set it up like this

#

obviously fill in the ... with the actual details

ionic oak
#

oh my lord that's a livesaver

#

thank u soo much

rare gazelle
golden mortar
#

But you can use the former without understanding the latter.

ionic oak
mild sequoia
rare gazelle
#

lets just pretend that doesn't exist

ionic oak
swift sparrow
ionic oak
swift sparrow
#

yeah

ionic oak
#

wait nevermind i just realized its not a good idea

swift sparrow
#

it will just overwrite the previous one which is fine

ionic oak
#

oh

swift sparrow
#

it's no different from reusing loop variable names

ionic oak
#

okay thats good then

swift sparrow
#

it doesn't matter if the code has already moved on

golden mortar
#

You can always reuse any name in Python.

swift sparrow
#

don't overwrite names that you still need to access

#
for i in range(5):
    print(i)

for i in range(5):
    print(i * 2)
mild sequoia
#

is that a bad habit to avoid? or is it just sometimes needed?

swift sparrow
#

it's perfectly fine to reuse i here because I've already moved on from the first loop. Unless I really need a reason to access the last iteration of the first loop

swift sparrow
jagged belfry
#

for loops and other common stuff reuse clearly wins

#

but for "I have a name in the module and one in my function" it gets sketchier

#

It'd similarly be insane to use i1 to i100 because you were afraid to reuse a loop variable

swift sparrow
rare gazelle
#

well... what about this:

def find_numbers(text, accept_int=True, accept_float=True):
    current_result = []

    if accept_int or accept_float:
        for number in re.findall(r"[+-]?\d[\d,]*(?:\.\d+)?", text):
            current_number = number.replace(",", "")

            if '.' in current_number:
                if accept_float:
                    current_result.append(float(current_number))
            else:
                if accept_int:
                    current_result.append(int(current_number))

    return current_result
jagged belfry
#

tbh I just avoid having names in my module namespace

golden mortar
rare gazelle
#

maybe i should do not in and check accept_int first, not important though

jagged belfry
swift sparrow
rare gazelle
#

ok, a parameter

swift sparrow
#
selected = []
for item in editor:
    if item.is_checked():
        selected.append(item)

for item in selected:
    item.do_something()
rare gazelle
#

i dont know

swift sparrow
#

I do something like this often (pseudocode-ish)

rare gazelle
#

😔

jagged belfry
#

You can't unfortunately

rare gazelle
#

i can include some paramter that decides the approach

jagged belfry
#

You may be able to ask chatgpt about the context

#

Huh. A real use case for AI

charred tusk
jagged belfry
rare gazelle
#

😢

jagged belfry
#

@sweet bobcat please don't use us for advertisement

sweet bobcat
#

Okay

jagged belfry
#

Did you read or have you read? Are you lead or are you the lead?

charred tusk
rare gazelle
#

makes me wanna go cry in the corner

jagged belfry
#

Reed read the reed read as Leed led from the lead with a lead lead.

rare gazelle
#

😫

swift sparrow
#

I'm pretty bad at always using f for opening files. I'm starting to use f_in for reading and f_out for writing

charred tusk
#

I did that on accident way too many times back when I was a young pupper

jagged belfry
#

That all belongs in the template

jagged belfry
#

But then.. wouldn't that

#

examines own brain

swift sparrow
#

uhhhhhhh

jagged belfry
#

!e ```py
with open("main.py") as if:
pass

swift sparrow
#

i_f and o_f

edgy krakenBOT
jagged belfry
#

Yeah I thought so so why do I remember that

rare gazelle
#

doing the regex for every third being , is bullshit

charred tusk
swift sparrow
rare gazelle
#

maybe i'll just throw , to the garbage

#

and not handle it at all

jagged belfry
#

That's what I would do

charred tusk
#

char for char in text if char in string.ascii_digits
Just discard everything that isn’t a digit

mild sequoia
#

can you normalize the data by replacing it with . ? this way its in a format you prefer? (apologies if already answered)

timid kite
#

Yall, i have a question, can somebody suggest some innovative and complex projects i can make for a competition? I have 2 month deadline(20th of february) i can try to do in C/C++/C#/Python or Html/css/js. Competition allows web or desktop application and there is no theme.

mild sequoia
#

(sounded like you had financial data but if its just something else, total nvm)

charred tusk
#

!projects

edgy krakenBOT
#
Kindling Projects

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

rare gazelle
#
def find_numbers(text, accept_int=True, accept_float=True):
    current_result = []

    if accept_int or accept_float:
        for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text):
            if '.' not in number:
                if accept_int:
                    current_result.append(int(number))
            else:
                if accept_float:
                    current_result.append(float(number))

    return current_result
#

alright no comma handling anymore

jagged belfry
#

...

#

I open my mouth like a demon

#

Do you desire handling things like .5?

rare gazelle
#

no

silent whale
#

Guys is it just me, or Error Handling makes about 60% of your code?

rare gazelle
#

ENOUGH

#

xD

jagged belfry
#

then looks good to me šŸ‘

rare gazelle
#

fuck .5

rare gazelle
#

or 5.

mild sequoia
#

5,

pallid garden
#

in a real world scenario you are assuming your user is stupid

rare gazelle
#

😔

pallid garden
#

and in many scenarios they are stupid

rare gazelle
#

ok 5. and .5 are actually python valid makes me wanna do it, me mad now

silent whale
mild sequoia
#

PEBKAC exists for a reason in IT

pallid garden
silent whale
rare gazelle
#

lets try handling .5 and 5.

ionic oak
#

not sure if this is a python question, but i can't install opencv? pip install opencv-python gives out an error, i'd look at the log but it doesnt exist

silent whale
abstract ibex
pallid garden
#

not just a nother

mild sequoia
rare gazelle
#

i think that:

r"[+-]?(?:\d+(?:\.\d*)?|\.\d+)"
dim goblet
#

Yhh

sand hornet
pallid garden
ionic oak
ionic oak
mild sequoia
#

are you running install as a superuser or admin?

silent whale
pallid garden
dim goblet
ionic oak
pallid garden
pallid garden
mild sequoia
#

if you are in a position to run it as admin i would attempt so in case its writing or hitting files that require admin/super user

pallid garden
#

there are a bunch of libraries that havent been updated to support 3.14 yet

pallid garden
#

what's your question

dim goblet
#

Nothing much

silent whale
#

lol

rare gazelle
#

it'd match empty strings, not good

ionic oak
dim goblet
pallid garden
ionic oak
#

if so then yes

pallid garden
swift sparrow
pallid garden
#

you can open your code in another code editor and it will still work fine

dim goblet
pallid garden
dim goblet
#

Alright

#

Thanks for that

ionic oak
dim goblet
swift sparrow
#

you can install a library globally to your python, or to a specific venv

rare gazelle
#

i think that's good

ionic oak
rare gazelle
#

actually i dont like it, i'll just remove the option to find .5 and 5.

#
def find_numbers(text, accept_int=True, accept_float=True):
    current_result = []

    if accept_int or accept_float:
        for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text):
            if '.' not in number:
                if accept_int:
                    current_result.append(int(number))
            else:
                if accept_float:
                    current_result.append(float(number))

    return current_result

thats it

wary terrace
#

yo

#

guys can u try out my new brlaint_calc. i updated it to v2

swift sparrow
ionic oak
jade robin
#

in some cases package the interpreter along (iirc sublime does that)

swift sparrow
#

So anyone with my code + the software can run it

ionic oak
#

makes sense

wary terrace
cursive wraith
#

where can i learn about linked list and operations

reef cosmos
#

Halo

dry yacht
wary terrace
#

guys

#

it has the repo link too

inland karma
#

what kind of feedback are you looking for?

#

@wary terrace

wary terrace
inland karma
#

well... the option to make aliases is great, but just use the bcalc as the default name, its short and easy to type

#

the included spec file for whomever whants to run pyinstaller locally is great. though i dont really see the need when you made such a good entrypoint

grizzled solar
wary terrace
inland karma
#

shell completion is essential if anyone would ever want to use this as a shell command

#

look how uv does it, its a good example on how to make multi shell support for auto completion

wary terrace
#

okay noted.

#

now can u tell me how useful it is too u?

inland karma
dry yacht
# wary terrace can sm1 please chekc this and give me feedback https://pypi.org/project/brliant-...

It's not necessarily bad, but would you ever use your program over a regular calculator?
I mean, I maybe can see some rare applications for the matrices and vector stuff, where I wouldn't know of an easy website to perform those, but the rest .

But yeah, the actual code is very simple, except for the alias manager, and I personally don't really like it when some scripts are trying to execute commands with sudo

wary terrace
#

its safe ofc u can check

inland karma
inland karma
jade robin
#

i often just use python -c

inland karma
wary terrace
inland karma
#

does it support convolutions @wary terrace ?

wary terrace
wary terrace
#

what is why am lookin for feedback

sacred cypress
inland karma
wary terrace
#

but i always specify

inland karma
wary terrace
sacred cypress
#

this project is raising some red flags for me, a lot of the implementation seems very simplistic with just some wrapper stuff for sympy and whatnot, but a lot of code devoted to creating binaries in .local/bin and various sudo permission stuff

sacred cypress
#

just at a quick glance

wary terrace
#

u can try it on a vm or smth

inland karma
dry yacht
inland karma
#

aliases does not work in my shell

neat pawn
#

I am unable to get colorful logs in windows pycharm

#

Even after using coloroma

wary terrace
#

idk man.

neat pawn
#
def setup_logger(
        name: str = None,
        log_file: str = None,
        level: int = logging.INFO,
        to_stdout: bool = True,
) -> logging.Logger:

    color_map = {
        "black": "\033[30m",
        "red": "\033[31m",
        "green": "\033[32m",
        "yellow": "\033[33m",
        "blue": "\033[34m",
        "magenta": "\033[35m",
        "cyan": "\033[36m",
        "white": "\033[37m",
        "reset": "\033[0m",
    }

    class ColorFormatter(logging.Formatter):
        def format(self, record):
            color = getattr(record, "color", None)
            msg = super().format(record)

            if color and color in color_map:
                return f"{color_map[color]}{msg}{color_map['reset']}"
            return msg

    if name is None:
        name = os.path.splitext(os.path.basename(__file__))[0]

    # Create folder for log file
    os.makedirs(os.path.dirname(log_file), exist_ok=True)
    log_path = os.path.join(log_file)

    # Base logger
    logger = logging.getLogger(name)
    logger.setLevel(level)
    logger.propagate = False
    logger.handlers.clear()

    # Standard non-colored formatter for file logs
    file_formatter = logging.Formatter(
        '{asctime} [{levelname}] [{className}] {message}',
        style='{'
    )

    # Colored formatter for terminal
    color_formatter = ColorFormatter(
        '{asctime} [{levelname}] [{className}] {message}',
        style='{'
    )

    # File handler (no color)
    file_handler = logging.FileHandler(log_path, encoding="utf-8")
    file_handler.setFormatter(file_formatter)
    logger.addHandler(file_handler)

    # Console handler (with color)
    if to_stdout:
        stream_handler = logging.StreamHandler(sys.stdout)
        stream_handler.setFormatter(color_formatter)
        logger.addHandler(stream_handler)

    return logging.LoggerAdapter(logger, {"className": name})```
wary terrace
#

well i think the linux version i havent tested it yet.

inland karma
#

multiple shell support and tab complete for commands will make it useable

neat pawn
#
if __name__ == '__main__':
    logger = setup_logger(log_file="logs/app.log")

    logger.info("This is a normal info log")

    logger.info("This should be green!", extra={"color": "green"})
    logger.warning("This should be yellow!", extra={"color": "yellow"})
    logger.error("This should be red!", extra={"color": "red"})```
edgy krakenBOT
#

brliant_calc/plotting.py line 21

y = eval(func_str, {"__builtins__": None}, context)```
median osprey
#

hey guys

inland karma
#

powershell bash zsh fish and maybe some of the other nushell or whats it called

#

but the four first is a miniumum imho

dry yacht
inland karma
gleaming knoll
neat pawn
wary terrace
gleaming knoll
inland karma
# inland karma not even uv?

<SHELL> The shell to generate the completion script for [possible values: bash, elvish, fish, nushell, powershell, zsh]

inland karma
dry yacht
wary terrace
#

okay everyone

neat pawn
wary terrace
#

rlly thx for ur feed back

inland karma
dry yacht
inland karma
sacred cypress
#

idk this project really giving me red flag vibes lol

gleaming knoll
# dry yacht Are you really defending `eval`?

yes, why are you attacking it? there is no actual problem here, you're attacking an imaginary scenario that is not happening in practice
you could atleast explain when is it bad instead of not allowing to use it anywhere

inland karma
#

on windows you have the old ancient cmd, windows powershell and powershell

#

you should be useing powershell imho

wary terrace
#

my idea is basically like vim but with calculator, get used to it... and then it becomes rlly fast to calcualte using that

inland karma
#

but the terminal is the app that runs the shell @neat pawn use Windows Terminal

#

and open the new Powershell and test using it

inland karma
dry yacht
wary terrace
cyan wolf
#

i am fed up of mugging up

inland karma
#

but if not, install it from source cargo install --path crates/numr-tui

pallid garden
#

cargo????

wary terrace
#

okay

gleaming knoll
pallid garden
#

rust mention !1!!1!1!1!1!1!1111!!

inland karma
#

No result found for 'numr' from Official buckets. Try modifying the filters for possible manifests

dry yacht
inland karma
neat pawn
#

I wanted it pycharm, pycharm does have emulate terminal option

inland karma
inland karma
gleaming knoll
inland karma
neat pawn
wary terrace
#

which operations shall i implement? and what shall i use except of eval?

pallid garden
#

oh no

inland karma
pallid garden
#

i just said clone unironically

dry yacht
inland karma
#

its not self evident when eval is a good tool and when it is a bad tool

wary terrace
inland karma
dry yacht
inland karma
#

do you want me to write a short example using a few operators?

wary terrace
wary terrace
dry yacht
gleaming knoll
wary terrace
inland karma
gleaming knoll
dry yacht
# wary terrace uhh can u tell me the operations i shall implement?

I literally said in the message you reacted to:
"""

well tell me what operations shall i implement
That's already the wrong approach.
"""

and you respond with:
"""
can u tell me the operations i shall implement?
"""

It really doesn't appear as if you read my message

inland karma
wary terrace
#

sorry

inland karma
#

!e

from operator import add, sub, mul, truediv

op = {
    '+': add,
    '-': sub,
    '*': mul,
    '/': truediv,
}


def calculator(a, b, operator):
    return op[operator](a, b)

print(calculator(1, 2, '+'))
edgy krakenBOT
gleaming knoll
dry yacht
#

^ And also a bad implementation

gleaming knoll
#

have you tried actually using it for any calculation?

wary terrace
cyan wolf
#

eval("sys.exit()")

stray sleet
#

where can I start learning DSA

gleaming knoll
# wary terrace yes many times

and all those commands that do a single operation seemed fine? and not having variables?
wouldn't it be much better to have nested expressions and variables? like a python REPL, basically, but math specific

cyan wolf
wary terrace
edgy krakenBOT
#
Resources

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

dry yacht
edgy krakenBOT
#
Resources

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

sacred cypress
# gleaming knoll except when beginners say "i am developing a calculator" they really do not mean...

looking at that person's project, I'm just kinda weirded out by the disparity between the simplicity of the code implementing an actual calculator, e.g.:
https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/vectors.py

..vs
https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/alias_manager.py
why all this convoluted functionality to go out of your way to write executable scripts (trying to run subprocesses with sudo and whatnot) for every platform etc. for something that is a very simple project otherwise

does that really not set off some red flags?

try:
                # Create a temporary Python script to write the file
                temp_script = Path.home() / f".brliant_calc_temp_{alias_name}.py"
                script_content = f'''import sys
from pathlib import Path

alias_path = Path(r"{alias_path}")
wrapper_content = "@echo off\\nbrliant_calc %*\\n"

try:
    with open(alias_path, 'w') as f:
        f.write(wrapper_content)
    print("Alias created successfully!")
except Exception as e:
    print(f"Error: {{e}}")
    sys.exit(1)
'''
                with open(temp_script, 'w', encoding='utf-8') as f:
                    f.write(script_content)
                
                # Run with sudo
                result = subprocess.run(
                    ['sudo', 'python', str(temp_script)],
                    capture_output=True,
                    text=True
                )
stray sleet
gleaming knoll
dry yacht
#

Wait, I was quoting you to yourself. Lmao

#

@wary terrace Do you know what complex numbers are?

cyan wolf
#

alias_path = Path(r"{alias_path}")

does this work

gleaming knoll
cyan wolf
#

oh r is for rawstring

sacred cypress
valid ferry
#

i need the best course out there to learn AI (LLM, Agent AI, Langchain)
i already made a mentalhealth chatbot that i trained it with pdf files and i used langchain, i saw my friend make an agent and i found it intresting
im originaly a backend developer
i know AI is big thing
i wanna know what field suits me and a recommendation to a good course i can take

dry yacht
valid ferry
#

so i took lots of math courses

dry yacht
valid ferry
#

bachelor

dry yacht
#

okay, so you know most math basics, just might need to take 1 additional course or so specifically tailored for AI.

But that's good, you actually "have a chance", as opposed to many, MANY others inquiring about becoming an AI developer in this chat

steady rain
#

making agentic stuff is just normal software development. it's not actually AI development.

golden mortar
#

It's developing with AI, not developing AI

steady rain
#

you're basically making a flowchart for an existing LLM to follow. you don't need to know anything about model development to do this.

valid ferry
#

idk im a fresh graduate idk much or what field i should deepen

dry yacht
steady rain
valid ferry
#

what field do u think suits me the most?

cyan wolf
valid ferry
#

ok what does an ai developer and a developer who use ai does

dry yacht
cyan wolf
dry yacht
cyan wolf
#

well goodluck lol

steady rain
valid ferry
#

im just asking to explore things i didnt ask u to teach me anything

cyan wolf
valid ferry
#

no

dry yacht
cyan wolf
dry yacht
#

The Lebanese Pound (LBP) .
LBP/USD = 0.000011

cyan wolf
#

i think if you like programming and problem solving. you could choose both

#

or what you like

valid ferry
#

and ofc i have a chance u dont decide that someone doesnt have a chance @dry yacht

silver plover
dry yacht
silver plover
#

CS50 for AI, for instance, is great at the fundamental ideas... but is just a taste of the field.

rugged star
#

i was working on my python LLM project and accidentally deleted a whole folder with a lot of data in it. is there a recycle bin in linux enviroments

silver plover
rugged star
visual juniper
dreamy parrot
visual juniper
#

imagine tomorrow you turn your laptop on and turns out your SSD got corrupted
GG

cyan wolf
#

git to the rescue

silver plover
visual juniper
#

( i wanted to say more like data backup in general but sure)

onyx python
cyan wolf
#

you probably did shift delete

visual juniper
onyx python
raw bramble
#
UnitedStates = Nation(
    name="United States",
    economy = 4,
    military = 4,
    diplomacy = 2
)

def roll(country:Nation,stat:str) -> int:
    stat = stat.upper()
    if stat in ["ECONOMY","MILITARY","DIPLOMACY"]:
        rolled = randint(1, 20) + country.stat
    else:
        print(f'{stat} is not a valid stat')
        return 0
    return rolled

print(roll(UnitedStates,"economy"))

Is there a way to make the equivalent of country.stat work

silver plover
#

They said linux, so I'm assuming "rm"

raw bramble
cyan wolf
gleaming knoll
rugged star
raw bramble
onyx python
#

Or do you want stat to become an alias for military? nvm šŸ˜… got confused by the dot

raw bramble
#

?

gleaming knoll
#

it might make more sense for nation to store the attributes as a dictionary and then you just access the dict
getattr is on the weird metaprogramming side which you shouldn't need in normal code

raw bramble
gleaming iron
#

what is that command that brings few nice resources for beginners please

rigid sapphire
edgy krakenBOT
#
Resources

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

edgy krakenBOT
#
Resources

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

gleaming iron
#

tyvm!

north chasm
#

Yoo

rigid sapphire
onyx python
compact loom
#

im actually losing my mind after day 1 of aoc

gleaming knoll
compact loom
#

part 2 is hell

wise yarrow
#

we try not to say that around here

frail stirrup
#

whats aoc

peak relic
slender urchin
#

Please be polite

peak relic
gleaming knoll
frail stirrup
#

i suppose this is meant for more polished programmers

peak relic
#

Not really

compact loom
#

its the maths

#

the maths is hurting my brain

frail stirrup
#

its an entire article vro

peak relic
#

New programmers can also do AoC. Helps exercise problem solving

golden mortar
wise yarrow
compact loom
#

does this mean im sub beginner

#

cooked

peak relic
golden mortar
frail stirrup
peak relic
compact loom
#

no im still trying to do part 2 lol

golden mortar
peak relic
#

✨ progress ✨

wise yarrow
golden mortar
peak relic
#

especially if you are doing it in a different programming language

#

If you bet that I would do it in Rust, I would struggle too

frail stirrup
compact loom
#

i just dont understand what im doing wrong here

#

i cant figure it out

wise yarrow
#

anything specific you're struggling with?

peak relic
#

Is there not a AOC channel for this?

golden mortar
gleaming knoll
frail stirrup
peak relic
#

huh... I don't see it

compact loom
#

yeah but nobody responded and i just wanna get this done 🫠

peak relic
#

oh the aoc channels are hidden from me

#

strange

rigid sapphire
golden mortar
onyx python
rigid sapphire
#

I'm guessing best way to do it is just make a function in class?

golden mortar
rigid sapphire
frail stirrup
#

i will jsut not worry about it

#

i cant code a calculator independently yet

golden mortar
golden mortar
abstract ibex
#

imho it doesn’t use a framework

gleaming knoll
#

probally some funny perl scripts on the backend and vanilla js

slender urchin
#
If you're curious about how Advent of Code works, it's running on some custom
Perl code. Other than a few integrations (auth, analytics, social media), I
built the whole thing myself, including the design, animations, prose, and all
of the puzzles.```
#

From a comment in the html source

rigid sapphire
gleaming knoll
#

yes

abstract ibex
#

imho the creator gave a presentation on how he made it which u can find on youtube

gleaming knoll
#

you probally mean iirc not imho, thats not an "opinion", thats just something you remember

abstract ibex
#

it's my new ragebait tic

onyx python
#

does the advent of code thing let me submit incorrect answers?

gleaming knoll
onyx python
#

or will it tell me if Im wrong?

#

noice

slender urchin
#

You do get a cooldown if you get it wrong too often

peak relic
#

Bruteforcing the answer can't be the answer obviously

gleaming knoll
#

if the answer was a bool though.. just try twice at worst

slender urchin
peak relic
#

šŸ“ I guess it works sometimes

rigid sapphire
# gleaming knoll yes

So gettattr(self, str) is bad?

self.military = int
self.economy = int
self ... = int

if x in ("military", "economy"..):
    return randint(..) + gettattr(self, x)
    print(..)
    return 0 
#

I think it depends if the Len(stat) is too big then you might wanna use a collection?

gleaming knoll
#

getattr is unusual to see in normal code, if you have control over the structure of the data its easy and not weird to just use a dict if the primary way you access it is through a dynamic key

rigid sapphire
gleaming knoll
#

metaprogramming, e.g. the implementation of dataclass

rigid sapphire
#

Where is it used?

#

🐻_ _

abstract ibex
#

🐻 😭

#

imho we don't have enough context to say if it makes sense here

ancient sequoia
#

@rigid sapphire it's also used in frameworks like django. basically the way to access a DB or generate html forms is made by a metaprogramming layer

#

because it let's user define a lot of custom information and rules

#

but back to your point usually a class is a known set of public information and methods (its interface). and you use that certainty to access that information with '.' (that's another way to say what @gleaming knoll said)

ivory flicker
#

as a beginner to python - what editor/tools should I use that is used in the real job world? I would like to be consistent in what I learn on and what I would potentially using in real life. I would like to dabble in data analysis/science/engineering and web app/software development

pastel sluice
pallid garden
#

definitely turn off LLM autocomplete

#

especially while you are learning

serene bridge
#

hello guys

#

anyone teamup for coding ?

abstract ibex
#

what if u had something like this bro

class NationBase:
  name: str
  economy: int
  military: int
  ...

class Nation(NationBase):
  pass

class NationSpec(NationBase):
  def roll() -> Nation;

usa_spec = NationSpec(
  name='United States of America',
  economy=4,
  military=4,
  ...
)

usa: Nation = usa_spec.roll()
#

(imo)

ivory flicker
pallid garden
#

vscode is popular in the industry because it's very easy to ssh into a private server instance to develop, while keeping the company code in a private instance

pallid garden
pastel sluice
serene bridge
pastel sluice
#

you can start with VS Code and gravitate out from there

pallid garden
#

it's a compiled binary of the same source code without the microsoft stuff

gleaming knoll
serene bridge
#

uhm

gleaming iron
#

and u dont wanna code with either

serene bridge
#

brh

pallid garden
#

discord's automod is like rolling a die

gleaming iron
#

tru

abstract ibex
ancient sequoia
#

has anyone manage to team up with someone online and get a nice project out of it ?

#

everytime i tried, we stopped at the 'fantasize' stage

pallid garden
#

it's uhhhhhhh a bit different from your average hobby project though

ancient sequoia
#

@pallid garden i mean with someone a bit random and starting from scratch (not contributing to something already rolling)

#

just curious

pastel sluice
#

I don't want to work with people I don't already know well

pallid garden
#

well they all start from somewhere

ancient sequoia
#

true

#

i was just curious if you guys had tricks to not get stuck early

pastel sluice
#

if I have an OSS project, and a regular stable of contributors prove themselves to be dependable and clued-in, then I might consider taking them on board more directly. but the idea of just hooking up at random with people and saying "let's make something" is likely to be as off-putting to them as it is to me.

abstract ibex
#

if she pair programs before the third date she's not ur wife bro she's for the streets

pastel sluice
abstract ibex
#

completely agree

steady rain
pallid garden
#

i had a brilliant counter joke but i cant share it here... sad

pastel sluice
abstract ibex
#

i only said what others were insinuating (imo). personally i disagree with the sentiment wholeheartedly. i think openness to engaging in collaborative programming is an admirable trait

dull dune
#

you are mistaken

ivory flicker
#

okay so I guess I'll use vscodium. thanks - was deciding between that and pycharm.. now I also understand I should have some portfolio or get used to some other tools like git/github/jupyter/etc that kind of stuff - is there another industry standard here? I want to be comfortable using the same tools as industry

pastel sluice
dull dune
#

because vs code is the industryy standard, as much as I might have some issue with taht

abstract ibex
#

no it's not

ivory flicker
dull dune
#

ah! true, if that's important to you that's all good

visual juniper
gleaming knoll
dull dune
#

but bee aware you won't be able to use pylance, the most popular python LSP

ivory flicker
dull dune
#

but there are some good altenrativse, pyrefly is new but has been prety good IME

pallid garden
#

ruff is a good lsp

dull dune
#

it only does type checkign and linting, right?

pallid garden
#

also pyrefly is a type checker

dull dune
#

does it also do definition lookup, etc?

pallid garden
#

yea

#

and...

visual juniper
abstract ibex
pallid garden
#

it's blazingly fast šŸ”„šŸš€ because it's written in rust

#

~~ 20 ~~ 0 minutes without a rust mention

dull dune
#

^ that is true, it's hard to express how mcuh better the astral tools are in terms of sheer speed than what we had before

idle fulcrum
#

morning y'all

ivory flicker
pastel sluice
idle fulcrum
#

info asking your personal info is stretch

pallid garden
#

more importantly is you dont get a trillion dollar company trying to sell you coding with autocomplete-on-steroid

charred python
#

The pylance extension doesn't load in vscodium?

pallid garden
gleaming knoll
#

or become based

pallid garden
#

or become blazingly fast šŸ”„šŸš€

idle fulcrum
#

I can't complete it

rugged star
#
def looper():
    from folder_watcher import watch, already_ragified
    while True:
        global ragifying
        folders = watch("./DandD/")
        to_ragify_folders = [f for f in folders if not already_ragified(f)]
        ragified_folders = [f for f in folders if already_ragified(f)]
        if ragified_folders:
            for folder in ragified_folders:
                add_to_storage(folder.name, Status.RAGIFIED)
        for folder in to_ragify_folders:
            add_to_storage(folder.name, Status.RAGIFYING)
            Ragify(edition=folder.name).run()
            ragifying = True
        if ragifying:
            ragifying = False
        else:
            time.sleep(10)
```i feel like i could and should simplify this
idle fulcrum
#

not going to be very fast šŸ™

pallid garden
#

or rawdog python with no LSP or type checker

#

the IDLE experience

abstract ibex
#

imo vscode is not an killer tool at all..?

pallid garden
#

it's not

charred python
#

Its just an editor with nothing special... Except LSPs. Which started with vscode.

pallid garden
#

it's just an industry standard for ssh-ing into a dev box

abstract ibex
#

that is one nice thing about python... itdoesn't lock u in IDE like java/c# where u are severely handicapped if u dont use the ordained slopware

ancient sequoia
stray field
pallid garden
#

i have never used pycharm

visual juniper
abstract ibex
#

bro

pallid garden
abstract ibex
#

we have Live Share at home...

stray field
visual juniper
#

altho the telemetry can be disabled in settings afaik , i remember doing smth like that

pastel sluice
#

(I have the VS Code telemetry turned off user-wide)

ivory flicker
visual juniper
#

yeah , if you turn it off, i dont really see any point in using codium tbh

pallid garden
#

codium's logo is a lot cooler

solemn venture
ancient sequoia
pallid garden
abstract ibex
#
$ ssh me@dev.box
$ tmux a -t collab

(imho)

stray field
solemn venture
#

tho there still is a big advantage to guaranteeing the user doesn't have to think about if they need to pay for a feature or not xd

gleaming knoll
visual juniper
stray field
gleaming knoll
# pallid garden ?

vscode and vscodium have the logo in the corner
i remove it using css

.window-appicon, .window-title, .titlebar-container {
    display: none;
}

in /opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.css

visual juniper
#

or better, a cat gif ?

pallid garden
pastel sluice
# ancient sequoia ok. behind my question, there's a curiosity about team dynamics. how to make pro...

that's really a community curation question, and not so much a project question. how would you bring together a group of people for any common purpose to enjoy doing things? you'd start with a shared interest, but you'd want to also ensure everyone is mutually respectful, responsible (they show up consistently), etc. in other words it's not an easy issue. think of how hard it can be just to get a group of four friends to decide where to go to eat on a night out!

visual juniper
gleaming knoll
ancient sequoia
pastel sluice
ivory flicker
#

yeah I just wanted to practice version control, etc.. not that anyone would be collaborating with me, but just getting familiar with the steps/processes/etc because on the job you would

pastel sluice
ancient sequoia
#

@ivory flicker in case you never saw them, there are few websites to simulate the usual git operations and get the basics mastered

abstract ibex
#

there is something beautiful about

he/him
and
i dont believe in pronouns
discussing mutual respect and shared interests in software communities 😭

gleaming knoll
rugged star
#

is there a way to instantly write a TextIOWrapper or do i have to do file.write()

dry yacht
gleaming knoll
ancient sequoia
#

'/s just in case

abstract ibex
#

i think they are asking if something like file.instant_write() exists

dry yacht
rugged star
# gleaming knoll what how would you write without writing

sorry maybe i shouldve given more content with gradio i get demo = gr.Interface(fn=process_file, inputs="file", outputs="text") which gives a path i want to get that file into ./x/y/z cant i use like fs cp instead of open(new_path).write(open(given_path).read())

dry yacht
#

So, you already have the file but just want to move it?

rugged star
#

/tmp/gradio/74b40ed4803bf1bfe5e53b994290f2c109edf80654bfdeb3e5f5332daeabfab1/5esrd.md

#

as an example

abstract ibex
#

demo.copy('./x/y/z')

#

imho

dry yacht
abstract ibex
#

outdated imo

rugged star
abstract ibex
#

the modern way is Path

ancient sequoia
#

pathlib is sweet

abstract ibex
#

Path('/tmp/gradio/hash/5esrd.md').copy_into('./out_dir')

#

new in 3.14

mossy sigil
#

Hi

rugged star
abstract ibex
#

use 3.14 imo

dry yacht
rugged star
abstract ibex
dry yacht
rugged star
#
def process_file(file):
    filepath = pathlib.Path(file.name)
    shutil.move(filepath, pathlib.Path("./test/") / "testfile.md")
    return True
```did it like this, where ./test/ and test_file.md will be changed ty @dry yacht for reminding me abt shutil
dry yacht
dry yacht
abstract ibex
#

3.10 has .hardlink_to('./test/testfile.md')

rugged star
dry yacht
rugged star
#

but anyways it works so case closed :D

dry yacht
#

šŸ‘

pallid garden
#

every time i see move i think of move semantics

kind elm
#

guys why my code won't work

compudtinth-term n;
iffsect := set( = set n)
current :f / n^ add l)
(factles := fir=^2_(ad 0)
cprodtect: if feir rand^(* 2);
cproduct := for == n" _*) 1;
current = f(nt "n lb;
cartet = prrent - facd))
curtet = current * / and);
retult = prrent - factor;
citett current:;_producct; +- walelt;
( result; )
pallid garden
#

this doesnt look like python?

kind elm
kind elm
#

hmm

untold mortar
kind elm
#

none..

#

i mean out of existing ones

#

someday, someone will find this code snippet and make a language for it

untold mortar
#

llol

charred python
#

No they won't

kind elm
#

given enough time.. they will

abstract ibex
#

based

grizzled solar
kind elm
grizzled solar
#

Nope

#

It is more likely that we reach the heat death of the universe

grizzled solar
#

šŸ‘

pallid garden
#

space is infinite, and so somewhere in the universe, vacuum fluctuation has caused a pc to appear instantaneous in space containing a compiler that will successfully your code

#

right now

#

boltzmann-infinitecat compiler

grizzled solar
#

Isn't it bold to assume space is infinite?

charred python
#

It's at least 75% infinite.

pallid garden
#

if it's not, whatever contains it must be, and if that is not infinite...

onyx python
kind elm
onyx python
#

Infinite or finite
One of the unanswered questions about the universe is whether it is infinite or finite in extent. For intuition, it can be understood that a finite universe has a finite volume that, for example, could be in theory filled with a finite amount of material, while an infinite universe is unbounded and no numerical volume could possibly fill it. Mathematically, the question of whether the universe is infinite or finite is referred to as boundedness. An infinite universe (unbounded metric space) means that there are points arbitrarily far apart: for any distance d, there are points that are of a distance at least d apart. A finite universe is a bounded metric space, where there is some distance d such that all points are within distance d of each other. The smallest such d is called the diameter of the universe, in which case the universe has a well-defined "volume" or "scale".

#

I do know the storage space on my harddrives is, unfortunately, very finite :C

kind elm
#

uh.. why am i restricted off the reactions

tropic temple
kind elm
#

Uh... Moderating reactions.. what are staff even on

#

who exactly needs reactions to be moderated

#

i don't like this logic, but most discord servers allow reactions

tropic temple
#

people can write all sortsa stuff with emojis :p most rules have history behind them

grave tree
#

We had a lot of incidents where people would abuse reactions and break rules via reactions

grave tree
#

Other channels in this server have reactions turned on

kind elm
grave tree
# kind elm then punish them

We did, but it's also difficult to moderate. There's not a log of reactions added to old messages and it can be very computationally and request expensive to have a bot track it

grave tree
#

This is a busy channel so we like to make it not difficult to moderate this channel

kind elm
kind elm
#

it's busy because i'm yapping in here

robust ledge
#

Welcome to the server.

grave tree
tropic temple
#

it's basically just in this channel why are you making this out like a whole thing 😭

kind elm
#

well this server is not dead but it's not active enough for that to be real

kind elm
grave tree
#

We have found it to be effective and you just joined so....

kind elm
#

if somebody reacts with wrong reactions on ancient messages.. Who gets hurt from that

grave tree
opal shale
#

i made my first pygame. game

pastel sluice
#

we don't like reaction spam in a very heavily trafficked channel

steady rain
#

@kind elm I don't think we're going to agree on this. can we just talk about python?

robust ledge
grave tree
opal shale
kind elm
robust ledge
grave tree
kind elm
#

where peopels get pinged for each messages sent

kind elm
#

it would make sense if you'd only restrict it to low level people

grave tree
icy apex
#

I’ve done one of those actually it was quite easy and didn’t take a lot of time

#

What could I do to further progress in my programming skills?

onyx python
steady rain
icy apex
onyx python
#

theyre not super easy though šŸ˜… I just gave up on part 2 of day 2 lol

icy apex
#

Yeah I’m quite a beginner

kind elm
#

if you have a lot of experience in something it means you went further

robust ledge
# icy apex Yeah I’m quite a beginner

The trick is to keep programming. Just build things that interest you. Silly things, tricky things. Anything that you don't already know how to build will improve your skills.

kind elm
#

for example you can try to make an encryption algorithm

#

or a hash function, it's far more simple

charred python
#

Or a compiler for InfiniteCat's horrible programming language.

untold mortar
#

accurate

dry yacht
# kind elm or a hash function, it's far more simple

err... I would disagree with the hash function part.
Sure, you can relatively easily develop a hash function, but odds are like 99.99999% that it'll be a (very) bad hash function.

As for the encryption algorithm:
I 100% agree that implementing one is very good practice, but developing a secure encryption algorithm requires knowing "advanced" (i.e. above school level) math

kind elm
#

Hash is far simpler because you can put anything and you don't have to care if it will be reversable or no

#

but yeah encryption requires advanced knowledge

#

here is a random prime number 8709234423033500272170260657444400773

#

almost 10**37

dry yacht
# kind elm doesn't have to be a secure one

If it's not secure then it's not an encryption algorithm.
Something similar, basically the same, which I believe would be far more suitable, also for learning how to think like a programmer, is a compression algorithm.
I think a compression algorithm would be much better than the hash function (for reasons I explained), and better than the encryption algorithm because you can actually develop it on your own with relatively little previous knowledge and it provides so many more layers to go from simple to harder things, like e.g. you could start with purely text-compression, i.e. techniques you could use to shorten sentences/words on paper, but later go on to encrypting things as individual bits.

kind elm
#

yeah

#

i still think hash algorithm is simple

dry yacht
#

It's a little obscure without having somewhat of an understanding what hashes really are and where and how they're used

kind elm
#

a control sum

#

you take an input of large length and produce a semi-unique fixed-size output for it

dry yacht
#

Yeah, but that doesn't really tell a beginner anything.
For me hashes/control sums only really started to make sense after I've seen a few real world uses for them

kind elm
#

the most important use is whe nyou send a data you append its hash to it, so if a single bit was corrupted during transferring, it's easy to see

bleak moth
charred python
#

yea, a bad hash and a good hash both look like random output. It's not a good task for being able to visualize your work.

bleak moth
#

That was an interesting use case.

kind elm