#python-discussion

1 messages · Page 285 of 1

cedar silo
#

pythonation is a solid arabic python community if you need one

slow rivet
#

soooo, whats everyone working on these days

past shard
cedar silo
ember bramble
slow rivet
past shard
past shard
cedar silo
grizzled solar
#

Ashuh

warm girder
#

wish there was a nicely typed async client for gitlab

wise imp
# slow rivet soooo, whats everyone working on these days

I set up my home "lab" (moved from DO to self-hosted (using CF free tier for the dns proxy thingy)), trying to finally get a blog up
I moved, cuz I wanted to get some more cores in case I need 'em and as I found out, the droplet (what DO calls a VPS) pricing is apparently per vcpu and I got like a droplet with 2 vcpus and it said 12 dollars a month, it was 24... anyway, the laptop I'm hosting it on now has a lot more RAM and more CPUs than I would reasonably want to spend to match in a VPS
so that was an adventure, had to set up a VM (I mean, my stack is dockerized, but still, wanted a separate and dedicated server machine), configured a WG tunnel for remote access, had to createa dynamic DNS service (literally what the ISP recommends when asked about a static IP)
fun stuff overall
I wanted to work on the blog system before I moved, but I moved cuz I wanted to have more resources for that blog system
so now trying to finally work on the blog itself

slow rivet
past shard
warm girder
#

what home automation do you folks have

slow rivet
wise imp
#

hmm, I should maybe switch the host OS to Proxmox for that sweet monitoring (and VM management) stuff it comes with

warm girder
#

oh esphome

slow rivet
warm girder
#

whats the cf tunnel for

slow rivet
#

accessing all this remotely

warm girder
#

I see why not tailscale

wise imp
#

lemme find something

slow rivet
#

I already have a domain with cloudflare, so just easier setup

warm girder
#

oh fair enough

wise imp
gaunt badge
warm girder
#

I would prolly just go with tailscale for having my devices on a private network

wise imp
#

eh, fine, I'll just share a screenshot

warm girder
warm girder
cedar silo
#

that ai gearbox analogy is actually painful to read lol

cedar silo
warm girder
#

its just a wire guard wrapper (a nice one)

warm girder
# slow rivet

how many servers/nodes do you have btw or are you just running proxmox on pi itself

slow rivet
gaunt badge
slow rivet
#

I made a DIY smart oven using a arduino and esphome, that was fun

cedar silo
wise imp
# slow rivet I mainly use home assistant, with a few supporting servers running along side it...

I should probably look into CF tunnel now that I see it mentioned...
cuz currently the flow is this

dynamic dns updates cf's records with my router's current public IP (I need this for anything to work really, but anyway)
when I want to connect remotely, I run a script that gets the origin IP from the CF API because it's behind the CF proxy (orange cloud, so I can't get it from the DNS records themselves), this script then updates my WG config file
then I up the wg if and can finally connect
but yeah, all of this means I have a port being forwarded from the router and the host to which the traffic is being forward to does no filtering of the connections coming in from that port, since I don't know what IP I might be connecting from

I suppose with CF, I could basically lock it down even more

slow rivet
wise imp
#

I mean, I have HTTPS between CF and origin right now already, but yeah, a tunnel would further simplify things I guess

cedar silo
copper walrus
#

I need help, I am making a hangman game but how do I make it like
Print this

H" _" _ "l o

cedar silo
copper walrus
#

I am begginer

cedar silo
past shard
#

yo

#

I am readinng this book called Hands-Onn Machine learninng and I just came across this Math formula that I don't understand a single bit of It's called RMSE

#

I can't properly copy it

rapid bridge
#

root mean square error?

past shard
#

yes

cedar silo
cedar silo
# past shard ohhh

yeah and since it squares the errors, it punishes big misses way harder than small ones

past shard
cedar silo
rapid bridge
#

Given a numpy array y that represents the label (that is, the thing the model is supposed to have predicted), and y_pred representing the actual prediction of the model, the RMSE for that specific input would be computed as

np.sqrt(np.sum((y - y_pred) ** 2))
past shard
cedar silo
past shard
#

I have one more problem, the author often refferences shapes like : outliers are exponentially rare (like in a bell-shaped curve), the RMSE performs
very well and is generally preferred. annd : sometimes called the Manhattan norm because it measures the distance
between two points in a city if you can only travel along orthogonal city blocks.

spare linden
#

Hello guys, can I ask, how do you guys learn python? I feel stupid that I always have to google stuff and not remember how to solve problems 🙁

cedar silo
spare linden
half pewter
#

lol that is the correct answer

cedar silo
visual juniper
half pewter
#

or just not do leetcode ever

past shard
visual juniper
#

then the harder problems you want to tackle, u might want to start doing DSA

visual juniper
spare linden
#

You guys get what I'm saying?

sage mural
visual juniper
half pewter
#

lol just walk out of the interview "get out of here with your leetcode bullshit"

spare linden
#

Or is that where I just learna and go

golden mortar
#

Learn the basics from a book or course.

spare linden
golden mortar
spare linden
# golden mortar Learn the basics from a book or course.

How did people originally learn python if not for the documentation? And let's say I'm trying to solve a problem, like random guessing, instead of hard coding it, is it bad that maybe I just found out about the random function?

half pewter
#

in all seriousness though, saul is right, interview questions is the only need you're likely to have for leetcode challenges. In my professional experience, it's very rare that you'll need to write an algorithm yourself.

golden mortar
visual juniper
# spare linden I feel like I know all functions, through university projects and courses.

if you want to start at 0 , then pick a course / book
if you like youtube , go to corey schafer channel and go through his python playlist
if you like books , use https://automatetheboringstuff.com

and u said you dont remember when to do the dict.stuff() etc , you cant really memorize that , there is no other way than just writing code ,looking it up , doing this over and over again untill you start remembering it subconciously

cedar silo
spare linden
#

I feel stupid that I just use what's already available, for example the

import random

Get a random number between 1 and 10

num = random.randint(1, 10)

cedar silo
golden mortar
past shard
limpid meadow
#

Everyone has to google things from time to time. Those with more xp maybe a little less but everyone has to check things now and then

spare linden
golden mortar
# spare linden you could look into how something like a random number generator works under the...

Random number generation is a process by which, often by means of a random number generator (RNG), a sequence of numbers or symbols is generated that cannot be reasonably predicted better than by random chance. This means that the particular outcome sequence will contain some patterns detectable in hindsight but impossible to foresee. True rando...

cedar silo
spare linden
#

I guess it is the way

golden mortar
past shard
spare linden
spare linden
golden mortar
#

Where to look depends on what you're studying

#

realpython.com has tons of great articles on all kinds of Python topics

visual juniper
spare linden
golden mortar
#

You only need to understand some general fundamentals

#

Like how seeding works and how a PRNG behaves. You don't really ever need to learn to implement one unless you're just curious.

cedar silo
spare linden
#

What are your opinions on full stack developer courses that promises you “to be a full stack developer guarantee” kind of stuff.

I’m always thinking about joining but I’m afraid that I can just learn it all by myself

golden mortar
pallid garden
#

i don't think it's worth the time

inland karma
past shard
spare linden
#

Alright thank you @pallid garden @golden mortar @past shard for anwsering my questions, appreciate it very much

#

Hopefully after this I’ll be on a smooth learning path for Python.

Learning Game Development too, which is super fun 😉

hollow citrus
#

eivl did u see i published the spinner program as a package i named it image ultis maybe il add other stuff to the package like an image converter

inland karma
#

i did not see, share the full name please

inland karma
#

add some install docs and usage docs in the README would you?

#

add both pipx and uv

hollow citrus
inland karma
#

but uv lets you do that as well

spare linden
inland karma
#

if i just use the command, i expect it not to give an error, thats somethiing you can fix to make it better

#

have you setup publishing to pypi via github?

hollow citrus
inland karma
hollow citrus
#

i dont think so i think i have to do t hat manuallyt

inland karma
#

its something you can look into...

shadow bear
inland karma
#

hello

kind oak
#

I thought raycast for just for screenshots

edgy dagger
kind oak
#

it does loads of things

edgy dagger
#

السلام عليكم ورحمة الله وبركاته

kind oak
#

I dont think your suppose to speak arabic though

edgy dagger
kind oak
#

but actually stop, its not allowed.

edgy dagger
inland karma
inland karma
inland karma
#

but your doing really great @hollow citrus 😄

kind oak
#

@inland karma how to enable the thing where the screenshots are auto copy? (raycast)

inland karma
#

are you using the clipboard history?

hollow citrus
#

im not gonna like to use i used chatgpt to write my readme i did change some things its just ive never wrote a readme bbefore so i needed some help

cedar silo
hollow citrus
#

im publishing the new readme its good now it uv and pipx as requests and usage examples

hollow citrus
#

i gave 2 examples which is more then enough for a small program

inland karma
hollow citrus
#

ye i realized # hi

#

hi

inland karma
#

yes hi

hollow citrus
#

hi

solemn rain
#

i am going to quit programming

inland karma
#
# or bash commands 
rotate-image --help
celest osprey
solemn rain
#

because am not programming

hollow citrus
#

saved me 5 minutes of having to delete the dist and egg and rebuilding

hollow citrus
inland karma
#

yes.. and one for install

#
pipx install image-utils-spin
#

and for uv

#
uv tool install image-utils-spin
hollow citrus
#
pipx install image-utils-spin

✅ uv

uv pip install image-utils-spin
``` i did already
inland karma
#

excellent

hollow citrus
#

this is installation

#

technically they can do ```
rotate-image --help/h


```or py script.py --help/-h```
cedar silo
inland karma
#

usage commands should be litterly true

#

rotate-image --help/h does not work does it?

hollow citrus
#

ye

#

il put a comment telling that they can use -h

#

instead of putting that in the ```bash xd

upper dirge
#

is there a shorter way to get "string".encode().hex(" ",-2)?

inland karma
#

i tried --help/h and i got an error saying unrecofnized argument. with a nice message :
usage: rotate_image [-h] [-i IMAGE] [-r ROTATE] [-s SAVE] [--force] [positional_image] [positional_rotate] [positional_save]

this is what you should have when you only do rotate-image

hollow citrus
#

✅ bash commands

rotate-image --help

or

py script.py --help

you can use -h or --help

good?

dry yacht
cedar silo
dry yacht
solemn rain
#

how to be smart

dry yacht
hidden laurel
#

Hi. I got my friend some libraries via .whl files, but it's not working. would it work if i just sent him my py install's site-packages folder & told him where to put the files?

hollow citrus
slow rivet
kind oak
hidden laurel
#

he only has a USB

kind oak
#

I think so @inland karma

inland karma
inland karma
kind oak
#

wait

inland karma
# hollow citrus k

once you have done this once, you can use this repo as a guide for any other repo you want to do the same with

kind oak
#

nope?

inland karma
#

hmm... strange.. maybe we take screenshots differently

#

how do you take screenshots?

kind oak
#

command shift 5

inland karma
#

ill charge my macbook, and test

kind oak
#

then I tap on the screen

kind oak
inland karma
#

i use all three

#

my main driver is linux right now

#

i have two macs, two windows laptops, one linux laptop and two linux desktops

#

and a bunch of servers in my homelab

kind oak
inland karma
solemn rain
inland karma
#

i dont think you live close to me

kind oak
solemn rain
#

joking. who gives his laptop to a stranger 😭

inland karma
#

i give away old hardware i dont need

solemn rain
#

you mean for free?

inland karma
#

why on earth would i charge for trash? yeah for free

solemn rain
#

rams are expensive

#

nowadays

inland karma
#

i have a few lying around! 😄

solemn rain
#

woh

kind oak
solemn rain
#

how long you use a device before you replace it

upper dirge
inland karma
inland karma
kind oak
#

a laptop from 5 years ago is not trash

solemn rain
#

mine is 4

inland karma
kind oak
#

m1 pro macbook released in 2021 is definatly not trash

solemn rain
#

but aren't you cautious of the hdd data

inland karma
#

i know how to delete it safely

kind oak
solemn rain
#

okk, i don't even give away my broken phone. thinking someone can hack my internal storage data

#

the phone is not turning on

inland karma
#

well, you can do lots of things in this domain to protect your privace, and batteries die after some time unused.

slow rivet
#

well depending on where you live there are trusted stores that take in electronics and will safely delete stuff and either re-sell it or properly dispose of it

inland karma
#

and modern phones has encryption on by default

solemn rain
#

true i still don't do that

past shard
inland karma
#

i have a home lab, i dont need to reuse old hardware

past shard
past shard
inland karma
#

i have three servers, and one of them is quite large

past shard
inland karma
#

yes, but my home lab is my personal stuff

shut marlin
#

Here's a question i started learning python and my question is what is the best code editor currently i use jupyter

past shard
inland karma
#

its all personal preference

shut marlin
#

Hmm

inland karma
#

if you like jupyter, use that

shut marlin
#

Ok

inland karma
#

if you like the other notebook use that

#

if you like emacs, use that

#

and so on

shut marlin
#

I see

past shard
inland karma
#

every editor has its purpose

dry yacht
inland karma
#

some might be better depending on your situation, but there are no best one

cedar silo
past shard
inland karma
#

i would not say that

inland karma
#

but that is up for an argument

celest osprey
#

preference really

inland karma
#

beginners should not be handed easy solution while they are trying to learn

#

it should be just easy enough to get you started

celest osprey
#

I liked vscode's simplicity but pycharm has a lot of good resources since it specialise in python

inland karma
#

and nothing more

#

that is why thonny is the editor for beginners, and the editor you should recommend beginners

shut marlin
#

Oh btw so i used to code in LuaU (roblox programing language) as its a game engine it had like an auto fill option doesn't python have something like that r does only jupyter editor not have that

cedar silo
shut marlin
#

Hmm it didn't work when i tried let check again

desert oar
cedar silo
past shard
wise imp
#

what editor lets you run a file automatically?

inland karma
inland karma
#

it is just simple out of the box

#

while thonny is

desert oar
inland karma
#

i dont disagree, im just saying there are only two editors out there that is taileroed for beginners...

#

one of them is thonny

#

if you like it will depend on your preferences

past shard
#

and the other

inland karma
#

because thats what an editor choice is, personal preferences

#

pycharm is a specialist tool

#

thonny is a beginner friendly editor

inland karma
cedar silo
inland karma
#

arguably the best debugger

past shard
#

I have never tried the debugger

inland karma
past shard
inland karma
past shard
inland karma
inland karma
past shard
visual juniper
inland karma
#

if you put a breakpoint() in your code, python will enter the python debugger automatically for you

past shard
inland karma
#

or you can just use it normally

#

!docs pdb

edgy krakenBOT
#
pdb

Source code: Lib/pdb.py

The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame. It also supports post-mortem debugging and can be called under program control.

The debugger is extensible – it is actually defined as the class Pdb. This is currently undocumented but easily understood by reading the source. The extension interface uses the modules bdb and cmd.

past shard
visual juniper
#

661*

past shard
charred tusk
#

Oh hey evil you’re still awake

shrewd pine
#

Still?

charred tusk
#

6h15m ago I went to bed when he got here

shrewd pine
#

It's only 1 pm

past shard
#

random question

charred tusk
#

No need to ask to ask

past shard
#

why are global variables worse than local

shrewd pine
#

broader scope

slow rivet
charred tusk
#

Hard to keep track of

past shard
#

oh

slow rivet
#

and in general its just easier to reason about a program when you assume a function only touches what you give it

shrewd pine
#

local variables in a huge function is similarly bad

solemn rain
rapid bridge
#

It also tends to make reusing functions more difficult

cerulean ravine
solemn rain
shrewd pine
#

I don't really see that as a strong case against globals

cerulean ravine
upper dirge
#

why is the first so much slower than the second?

[i%j or (s:=s+j,n:=n+1)for j in o]
for j in o:i%j or (s:=s+j,n:=n+1)```
solemn rain
#

because python interpreter got 🤯

rapid bridge
#

Given a large o, the first will reallocate the entire list multiple times

solemn rain
#

oh

#

big oh

pastel sluice
#

read-only globals are okay. globals that have their meanings reassigned are hard to keep track of.

cerulean ravine
dry yacht
shrewd pine
solemn rain
#

i am learning turtle any tips

#

my school has turtle gui as an entire module

shrewd pine
upper dirge
charred tusk
steady creek
#

How can I learn the basics like in a hour or 2

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.

charred tusk
celest osprey
#

basics is very general, and how fast people learn varies

solemn rain
#

thats not 2hrs

pallid garden
#

you need to first learn C for 10 years

inland karma
#

do you already know programming?

solemn rain
pallid garden
cedar silo
upper dirge
solemn rain
#

i know the syntax i don't call myself a programmar

desert oar
steady creek
pastel sluice
dry yacht
steady creek
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.

solemn rain
upper dirge
solemn rain
steady creek
upper dirge
#

I've been watching a few videos with C recently though and it's quite interesting

past shard
solemn rain
past shard
upper dirge
steady creek
#

Should I learn lua instead of python?

solemn rain
pastel sluice
shrewd pine
solemn rain
celest osprey
#

The mindset shouldn't be "learn in a certain timeframe", different people take different time. If you really want to learn the language, it will take time

steady creek
inland karma
inland karma
upper dirge
solemn rain
inland karma
#

python makes learning programming easier

steady creek
solemn rain
past shard
solemn rain
#

like me

split patio
steady creek
solemn rain
pastel sluice
solemn rain
desert oar
cedar silo
pastel sluice
#

we're here to help people, not to get laughs at the expense of their ignorance. that's how I feel.

steady creek
cedar silo
pastel sluice
#

@steady creek it's about as easy to begin learning either language. we're biased, we recommend Python

solemn rain
desert oar
past shard
past shard
desert oar
shrewd pine
solemn rain
past shard
solemn rain
past shard
upper dirge
#

I also want to golf it so instead of doing

for i in range(1,10000)
 for j in range(1,i)```
I'm just looping to 10k twice
#

that's the big slowdown

solemn rain
past shard
solemn rain
#

making games involves logic you can understand

#

not business logic

inland karma
#

also one of the hardest things

pastel sluice
#

even simple games like Pong have surprising complexity.

desert oar
solemn rain
#

i don't mean graphical games

#

terminal games

inland karma
#

thats why recommending making a game is a huge mistake

past shard
spare linden
solemn rain
pallid garden
#

wait, how did assembly -> game development???

pastel sluice
spare linden
cedar silo
shrewd pine
past shard
pastel sluice
solemn rain
pastel sluice
solemn rain
#

can we monetize these games in pygame?

pastel sluice
solemn rain
#

where

spare linden
pastel sluice
desert oar
#

Guys,, what do you recommend for daily problem-solving practice?(platforms)

solemn rain
#

aahhh

spare linden
pastel sluice
hidden laurel
#

i'm trying to get the blender package as a portable .whl file, but i dont see any on the install page. Do i have to build it from source or smth?

pallid garden
#

is "casually" a synonym for "off-hand" pithink

past shard
#

What are the best tasks for python freelancing in your opinion

shrewd pine
spare linden
shrewd pine
pastel sluice
spare linden
past shard
#

this is what sharing a server looks like

#

as you can see with the example above

solemn rain
charred tusk
hollow citrus
inland karma
#

you have not done the trusted platform registry on pypi

shrewd pine
solemn rain
#

what kind of pleasure the code golfers get from making code unreadable 😭

upper dirge
#

it's fun

shrewd pine
#

so you only need to check d <= n//d for divisor pairs

hidden laurel
pallid garden
#

what kind of pleasure do golfers get from hitting a ball into a hole

solemn rain
shrewd pine
spare linden
#

Same like kicking a ball into the top corner of a goal net.

solemn rain
#

golf ball?

#

oh football

shrewd pine
wise imp
pallid garden
solemn rain
#

wdf

inland karma
wise imp
#

hmm, really thought that would land better

cobalt flax
#

What does unresolved reference mean?

spare linden
pastel sluice
pallid garden
upper dirge
#

this is what I got, I'm trying to see if I can get rid of the len

o=range(1,10000)
for i in o:sum(x:=[j for j in o if i%j<1])%len(x)or print(i)```
cedar silo
solemn rain
#

where do you get this error

wise imp
hidden laurel
charred tusk
spare linden
pallid garden
cobalt flax
cobalt flax
#

i have current_stage though!!

pallid garden
#

essentially you try to solve a question with the least bytes of code possible

autumn forge
pallid garden
#

it's not meant to be representative of daily development

solemn rain
#

i think codegolfing can be useful skill in obfuscating code.

spare linden
pallid garden
charred tusk
pallid garden
charred tusk
hidden laurel
upper dirge
spare linden
#

Damn using symbols to emoji is weird

pallid garden
spare linden
pallid garden
#

that's just where people post their challenges and other people solve it

solemn rain
#

using AI

pallid garden
past shard
#

yo

solemn rain
#

yoo

past shard
#

I got a problem

solemn rain
#

whats ur problem

edgy krakenBOT
#

pyproject.toml lines 16 to 22

dependencies = [
    "panda3d>=1.10.15",
    "panda3d-gltf>=1.3.0",
    "pillow>=12.0.0",
    "pyperclip>=1.11.0",
    "screeninfo>=0.8.1",
]```
cobalt flax
# pastel sluice and the error?

line 53, in get_guess
current_stage += 1
^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'current_stage' where it is not associated with a value

autumn forge
#

most answers on cgse use some kind of golf-oriented language anyway. It isn't particularly insightful unless that's what you're into

wise imp
shrewd pine
cobalt flax
#

I thought python scope went L E G B

#

local, enclosed, global, built-in

pastel sluice
cobalt flax
#

I defined current_stage earlier!!

upper dirge
solemn rain
#

whats that

pallid garden
pastel sluice
wise imp
cobalt flax
#

How do i do that

upper dirge
pastel sluice
wise imp
pallid garden
pastel sluice
#

and more recommended.

solemn rain
#

is there a language for golfing

pallid garden
wise imp
past shard
#

I am trynnna learn lm with this book Hands-On machine learning and I am on the second chapter of the book and while tryinng to create a method to create a test set : ```py
import numpy as np
from zlib import crc32

def test_set_check(identifier, test_ratio):
return crc32(np.int64(identifier) & 0xffffffff < test_ratio * 2 ** 32)

def split_train_test_by_id(data, test_ratio, id_column):
ids = data[id_column]
in_test_set = ids.apply(lambda id_: test_set_check(id_, test_ratio))
return data.loc[~in_test_set], data.loc[in_test_set]

housing_with_id = housing.reset_index()
train_set, test_set = split_train_test_by_id(housing_with_id, 0.2, "index")

upper dirge
#

my least favourite language I've ever had to use has gotta be prolog

autumn forge
upper dirge
#

that shit drove me insane

wise imp
autumn forge
#

there's also uiua, which has a cool website

cedar silo
wise imp
past shard
#

My problem is solved

solemn rain
#

did u use AI

upper dirge
#

I might have a look at J, every golfing lang I've looked at before just seems impossible to learn

past shard
wise imp
solemn rain
#

what was the error

past shard
#

It's solved

autumn forge
cobalt flax
autumn forge
#

really gives you an insight into the mind of its creator

upper dirge
cedar silo
autumn forge
#

yeah, having assignment in the function body is what makes Python treat it as a local variable

solemn rain
#

var = var + stuff

autumn forge
#

it is somewhat unintuitive

past shard
solemn rain
cobalt flax
#

and is the best way to assign a variable within a function making a parameter specifically for that variable to be passed in?

autumn forge
cobalt flax
solemn rain
pallid garden
#

dont use globals, it makes it really hard to track

cedar silo
solemn rain
wise imp
cobalt flax
pallid garden
#

99% of the time you dont need globals

pastel sluice
#

if your function relies on some kind of mutable state, you want to pass that state into the function

pallid garden
solemn rain
#

then it will be like prop drilling maybe not drilling

past shard
cobalt flax
#
 global current_stage
        current_stage += 1
        print(f"Wrong! You have {5 - current_stage} guesses left!")
``` idk it looks nice
pallid garden
#

whatever

#

suit yourself

pastel sluice
cobalt flax
#

cant hurt too much to use global right?

past shard
#

you only do this when prescribed

pallid garden
past shard
autumn forge
cobalt flax
past shard
past shard
pastel sluice
pallid garden
pastel sluice
#

the more you rely on globals to do anything, the more difficult it becomes to manage your project's state reliably

cobalt flax
#

hm ok

pastel sluice
#

and again, if you're passing a lot of values into a function, that's a sign you may want to contain all that state in an object.

cobalt flax
#

well if you're right i'll do the convoluted thing

steady creek
#

What should I learn as a complete beginner (know SOME things) to start

autumn forge
#

I think you just have to accept the wisdom that global variables are a bad idea

pallid garden
#

if your project has anything more than a few hundred lines, you are going to accidentally mutate global variables

pallid garden
pastel sluice
pallid garden
#

you just havent learnt it yet

spare linden
autumn forge
#

as you build larger projects the choice to avoid global variables will make more sense

pallid garden
#

this is like saying python is hard because you havent learnt python

cobalt flax
#

yeah i shouldnt have that attitude about learning a convention that most programmers use

pallid garden
#

it's not even a convention

cobalt flax
#

i just started using snake_case with this project im doing actually

pastel sluice
pallid garden
#

it's objectively easier to read

solemn rain
#

!d globals

edgy krakenBOT
#

globals()```
Return the dictionary implementing the current module namespace. For code within functions, this is set when the function is defined and remains the same regardless of where the function is called.
steady creek
#

Guys I Said what should I learn as a big beginner to start.

solemn rain
#

!d global

edgy krakenBOT
#

7.12. The global statement


global_stmt: "global" identifier ("," identifier)*

The global statement causes the listed identifiers to be interpreted as globals. It would be impossible to assign to a global variable without global, although free variables may refer to globals without being declared global...

pallid garden
#

where are people learning globals anyway?

#

what resource is teaching people about globals

pastel sluice
pastel sluice
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.

pallid garden
solemn rain
pallid garden
#

i hope there isnt

steady creek
pastel sluice
pastel sluice
wise imp
#

hey, globals are not inherently bad

sullen dust
# pallid garden i hope there isnt

Ig tutorials written by ppl who know how to use but dont really understand globals or any bad practice, it kinda gets the job done so they end up using it

pastel sluice
#

globals are fine when they're read-only

#

the less you mutate what a top-level name points to, the better

pallid garden
harsh anchor
charred tusk
#

Alright
Finally at work
Dammed maintenance decided to do the fire drill literally as I was walking into the building
Time to test the thing

pallid garden
#

but i always put them in some namespace

wise imp
harsh anchor
pallid garden
#

im just going to shutup

solemn rain
harsh anchor
#

what if it doesn't make sense inside the class

solemn rain
#

then inside the top level of the module

charred tusk
wise imp
charred tusk
solemn rain
charred tusk
# hidden laurel huh...

Oh I just realized
Yeah it's a "bring your own Blender"
You have to tell Ursina where Blender is
They're completely seperate

hidden laurel
#

well i'm gonna disable internet rn and do a stress test to see if it's absolutely required

edgy krakenBOT
#

ursina/scripts/_blender_scene_to_ursina.py line 13

blender_executable, blend_file = sys.argv[:2]```
charred tusk
hidden laurel
#

kay

#

also i was gonna put modernGL as a .whl file, BUT it seems like it's not available

#

for py 3.14

#

i came on here & saw smth about building from source

#

so should i do that? and if so, how?

spare linden
#

Anyone here ever fix an issue in GitHub of a repository?

cedar silo
spare linden
cedar silo
supple eagle
#

don't wanna mess other people's codes

cedar silo
spare linden
wise imp
supple eagle
#

rlly?

spare linden
cedar silo
spare linden
supple eagle
spare linden
solemn rain
#

i need guidance

pastel sluice
#

just ask your question

solemn rain
#

i have exams in python and am not studying

wise imp
pastel sluice
solemn rain
#

i am procrastinating

pastel sluice
#

close Discord

solemn rain
#

but i don't want to go and read my text book

#

its so boring

pastel sluice
#

we can't help you with that. that's on you

solemn rain
#
Colors and RGB Systems, A case study. Image Processing – Basic image processing with inbuilt
functions. Graphical User Interfaces – Event-driven programming, Coding simple GUI-based
programs : Windows, Labels, Displaying images, Input text entry, Popup dialog boxes,
Command buttons, A case study.```
spare linden
solemn rain
#

this is what i need to learn

cedar silo
solemn rain
#

earlier chapters i completed in like 10mins because they were basics of python

#

now here comes graphics

wise imp
#

"basic image processing with inbuilt functions"?
what built-in functions are there for image processing?

muted rampart
#

The longer it takes to start, the longer it takes.

wise imp
#

I suppose you could conjure something up with tkinter, I'm sure it has a way to export graphics

solemn rain
wise imp
#

unless you're expected to parse image files yourself

edgy krakenBOT
#
I don't think so.

No documentation found for the requested symbol.

solemn rain
#

ooh

wise imp
#

you're thinking of PIL.Image (probably?)

#

not a built-in though

#

!d PIL.Image.Image

edgy krakenBOT
#

class PIL.Image.Image```
This class represents an image object. To create [`Image`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image) objects, use the appropriate factory functions. There’s hardly ever any reason to call the Image constructor directly.

• [`open()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open)

• [`new()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.new)

• [`frombytes()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.frombytes)
solemn rain
#

not builtin ?

wise imp
#

nope, gotta install it

charred tusk
#

PIL? no

solemn rain
#

so what should i do. should i watch yt on tkinter and turtle or read the boring pdf

charred tusk
solemn rain
#

and it feels outdated too

gleaming marten
#

You should go study

spare linden
charred tusk
solemn rain
gleaming marten
#

Not when you're offtopic

charred tusk
#

you're 🤓

solemn rain
#

i am going to watch youtube

gleaming marten
#

(edited) 🤓

cedar silo
solemn rain
#

and it feels outdated

solemn rain
#

which is boring

#

and outdated

#

and lot of text

#

less code

cedar silo
dense hawk
astral osprey
#

Hello there

inland karma
astral osprey
#

I am new to this community
I am a python learner

Happy to be here
I am also ready for collectorative projects 😁

hidden laurel
inland karma
#

you can just download all dependencies from pypi and install them offline

charred tusk
inland karma
#

yeah, the blender package has been dead for some time now

#

but remember to get the right platform and version of all dependencies since you cant rely on pip @hidden laurel

hidden laurel
cedar silo
hidden laurel
#

now i came here to get modernGL from the github page, since there's no version for py 3.14

#

how to install it from the github directory?

inland karma
#

does the git repo have a 3.14 version?

wise imp
hidden laurel
#

can't find one

inland karma
# hidden laurel can't find one

then you cant use 3.14 with moderngl unless you build it from source. but that does not mean you can use an unsupported version

#

i could build moderngl from source

hidden laurel
#

but i could also use pyopenGL maybe?

#

then again it feels much harder to set up

inland karma
#

i dont know what you are doing

cedar silo
inland karma
#

if you already know how to write opengl code, then it does not matter much, if you dont know, i suggest you use moderngl

inland karma
#

here are ursina and moderngl installed on 3.14

hidden laurel
#

soooo modernGL would be preferable?

inland karma
#

i prefere it, but i dont write much opengl

#

its simpler to use

hidden laurel
#

right

inland karma
#

just remember to get all requirements, and also do the installation on the same platform so you can see what requirements you need

hidden laurel
inland karma
#

thats a decent guess, i will assume yes

#

at least for these two simple things

hidden laurel
#

so modernGL and, for a fallback, pyopenGL

#

could i build from source on windows?

inland karma
#

you have to test that

#

windows will always be the odd one out

hidden laurel
inland karma
#

you clone the repo and pip install it

#

like described here

hidden laurel
inland karma
#

remember to do this in a venv, so you dont a mixup with your installed packages

hidden laurel
#

nvm

inland karma
#

here you see the result after building from source @hidden laurel

hidden laurel
#

uhhh

#

not building from source?

inland karma
#

but ofc, you have to do that on windows, or, distrobute and install from source

inland karma
#

i used setuptools and build to do it

hidden laurel
#

i opened git bash in the folder i wanted to clone it to

#

didn't work, said i didn't have the correct key

cedar silo
inland karma
#

you did not clone it correct

#

you should use the process i shared

cedar silo
inland karma
#

and siince your using windows, you should just use your windows terminal

#

only repos you have ownership to, are repos you can clone with ssh @hidden laurel
thats why i shared the https version with you earlier

hidden laurel
#

it's working

cedar silo
inland karma
#

remember to test the whole install from whl process in a new venv without internet

hidden laurel
#

pip uninstall everything i have installed already

supple eagle
#

loops are so op sometimes

inland karma
#

you can also just make a new venv

hidden laurel
#

cuz i don't use python much

inland karma
#

then a new venv is simplest

hidden laurel
cedar silo
inland karma
edgy krakenBOT
#
Virtual environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
inland karma
# hidden laurel how?

this tags has all the details, iif pandaxxs message is not clear enough, you have to read all of this

#

all words

dry yacht
foggy patio
#

in this dummy code, (i am begineer in python) it shows an error for comparing int with lists:

class Student():
    def __init__(self, name=None, marks=None):
        if name is None:self.name= [str(input("Enter Name: ")) for i in range(1,4)]
        else:
            self.name=name
        if marks is None:self.marks = [float(input("Enter Marks: ")) for j in range(1,4)]
        else:
            self.marks=marks

    def sinfo(self):
        print(f"Name:{self.name}")
        print(f"Marks:{self.marks}")
    
    def remarks(self):
        ko=self.marks
        if ko>=90:  return "Excellent Work!"
        elif ko>=80:    return "Almost Perfect"
        elif ko>=70:    return "Scope for Improvement"
        elif ko>=60:    return "Needs More Effort"
        else:   return "Serious Underperformance"

    def grading(self):
        pass
    
print(f"Your Grade is:{Student().remarks()}")
inland karma
#

@hidden laurel how did you know what dependencies to pick if you did not use a venv already?

inland karma
dry yacht
foggy patio
#

error

Enter Name: ss
Enter Name: ds
Enter Name: ds
Enter Marks: 98
Enter Marks: 56
Enter Marks: 12
Traceback (most recent call last):
  File "c:\Users\Srinjoy\Desktop\Untitled-1.py", line 25, in <module>
    print(f"Your Grade is:{Student().remarks()}")
                           ^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Srinjoy\Desktop\Untitled-1.py", line 16, in remarks
    if ko>=90:  return "Excellent Work!"
       ^^^^^^
TypeError: '>=' not supported between instances of 'list' and 'int'
inland karma
#

well.. good luck, im off! ping me if there is anything more i should answer!

naive ermine
dry yacht
naive ermine
cedar silo
naive ermine
#

Check if any of the marks are above a limit? Check if all of them? Check the average etc

dry yacht
cedar silo
naive ermine
foggy patio
cedar silo
dry yacht
hidden laurel
charred tusk
#

run awayyyy

hidden laurel
hidden laurel
#

it's not hard

hidden laurel
wise imp
# charred tusk _run awayyyy_

how frequently do you tell others at your company to stop picking up random USB sticks from the ground and inserting them into company computers?

silver plover
hidden laurel
#

checked again

charred tusk
#

ah
pyroject.toml
That's much better

silver plover
dry yacht
# foggy patio oh wait u can do that... my school taught python to the absolute basic level so ...

Also for IDE hinting stuff like this I would recommend you use type-hinting. E.g. if I just put this above the __init__ function:

names: list[str]
marks: list[float]
```then my IDE immediately gives me yellow warning squiggles for the `ko >= 90`, `ko >= 80`, `ko >= 70`, etc. lines with this warning message:
```py
Expected type 'list[float]' (matched generic type 'list[_T]'), got 'int' instead 
#

So this tells us the same thing as your error, but before we even have to run the program

charred tusk
wise imp
silver plover
charred tusk
#

We use USB sticks to put datafiles into multi-million-dollar machines
One of the machines is so old it has a floppy->USB converter in it
The department supervisor literally just has a cup of USB sticks in their desk drawer

wise imp
#

at that point it might as well be a safety measure to actually use floppy disks instead

charred tusk
#

oh we have many

dry yacht
#

I hate USB-sticks. I never need them, until I need them for the most random thing possible, and of course by that point I have no clue where any of them are anymore.

charred tusk
#

I keep one on my key ring for exactly that reason

dry yacht
#
  • the 2 that I do know of just don't work (properly) anymore
wise imp
#

I back up my most important files to usb sticks, which are highly renowned for their long-term data storage reliability

silver plover
wise imp
#

just random usb sticks gathered from around various conferences probably

charred tusk
#

I also have two cups of them in my desk because another department's machines demand specific brands/sizes

wise imp
#

goes to make a cup of coffee
destroys data worth millions

dry yacht
charred tusk
silver plover
#

That would trigger me. I'd at least have a clear policy with distinctive USB sticks such that they may only be used in machine A or B.

#

Do you want a stuxnet? Because that's how you get a stuxnet.

charred tusk
#

I meannnn

#

you know my job

dry yacht
hidden laurel
#

btw i built moderngl from source

wise imp
#

you just know that shen is that one lone brick on the right side holding up all the cybersecurity demands of that company

silver plover
hidden laurel
cedar silo
charred tusk
hidden laurel
#

how?

#

oh right

hidden laurel
silver plover
cedar silo
hidden laurel
cedar silo
charred tusk
#

I'd totally buy 6in USB extensions just to use those

#

I may appropriate company funds on the upcoming April Fools day

hidden laurel
cedar silo
hidden laurel
#

intel UHD graphics 520

#

got it right

copper walrus
#

When should I start implementing UI (I'm 20 days in learning python)

cedar silo
wise imp
hidden laurel
dry yacht
vestal jetty
copper walrus
brave blade
#

okay guys; i made gambling simulator but there are 5 slots and multiple combos!
It's kinda long, so where can i share it???

cedar silo
dry yacht
brave blade
#

i want to improve it

dry yacht
brave blade
#

uhh its too long by ~770 characters

cedar silo
brave blade
#

how

dry yacht
cedar silo
lucid agate
#

has anyone gotten into an argument with their recruiter on the phone screening before? because what just happened to me is genuinely unbelievable…

orchid pier
#

What's float?

sullen dust
edgy krakenBOT
#
Pasting large amounts of code

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

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

brave blade
#

I made it at school computer and i send it myself to gmail and i pasted it straight from it, if i didn't notice it would paste it with my FULL NAME.

lucid agate
# spring cipher What happened?

man oh man, i start the phone screening at around 8:45 AM, and he starts off normal. He then asks me “tell me about yourself” which is standard and i start talking, i know in my head to keep it concise because they’re always busy, so i try to keep it under 30-45 seconds. Not even 10 seconds into me talking, he cuts me off telling me to speed things up…

#

i said “with all due respect sir, i haven’t even said anything yet and you want me to move on?”

#

He then asks me about how i used pytorch in my project, and as i’m explaining it to him, he completly shits on me saying “that was very poor implementation”…

cobalt oasis
lucid agate
#

Mind you, he has the github link and was more then welcome to check out the repository for my project.

brave blade
severe sage
#

It's kinda funny just how much quotation marks matter in Python. I had some code using findText on a QComboBox and was like "why isn't this working", and it turns out it was because I instinctively put down "-1" instead of -1. It's always the little things that get you.

lucid agate
#

i emailed HR instantly withdrawing my application

severe sage
#

Quotation marks and spacing are the Big Two deceptively important things, I think.

sullen dust
lucid agate
steady rain
#

and I could tell they were probably only going to offer 50k. that's like a poverty wage here.

cerulean ravine
lucid agate
#

also, isn’t it a senior devs job to tell someone if they’re project is shit or not?

cerulean ravine
jade robin
lucid agate
pastel sluice
#

I would not work for any outfit where the screening process consisted of trying to provoke me into an intemperate reaction.

copper walrus
#

How do I make it say _e whn u gues a corect leter
For my hangman game

lucid agate
#

anyways, i’m gonna remove my project from my resume and start working on a new one

cerulean ravine
strange raft
#

hey guys, do you know how can I revert a commit? Im in the github website.

lucid agate
cerulean ravine
subtle coyote
#

what if someone stole the project 👀

cedar silo
celest breach
spring cipher
#

Sorry that happened

cedar silo
ornate wren
cedar silo
strange raft
#

Thanks for the help!

jade flame
#

does anyone use tab groups on chrome i dont see it anymore

#

nvm

wise imp
# copper walrus How do I make it say ___e__ whn u gues a corect leter For my hangman game

you want a literal underline under the character? in a terminal?
might need to use ANSI escape sequences then (or rich)
something like this

ANSI_UNDERLINE_TEMPLATE = "\x1b[4m{text}\x1b[0m"

word = "thing"
guessed_letters = {"t", "n"}

for letter in word:
    if letter not in guessed_letters:
        letter = " "

    underlined_letter = ANSI_UNDERLINE_TEMPLATE.format(text=letter)
    print(underlined_letter, end="")

print()