#python-discussion

1 messages · Page 510 of 1

silver plover
#

Can you explain how the data will flow? Are the subprocesses just consuming the data? Or returning results? Mutating the dict?

chilly whale
#

by "take action" I meant "change the code". Of course I reply why I didn't when I don't 🙂

silver plover
#

For something like this, maybe start with a side project as a minimal proof of concept

vale wasp
hot junco
vale wasp
#

And with that, I'm off to bed. Work is coming sooner than I'd like in the morning.

brisk gazelle
#

So long as whatever you're sending over the queue is pickleable, you should be okay. @hot junco

silver plover
chilly whale
vale wasp
hot junco
hot junco
#

Basically a single communication line where all data can be shared IF asked of the program.

granite wyvern
# hot junco pickable?

There's a pickle module for writing python objects in a binary format so that they can be sent to a subprocess (which is underneath a binary stream to each subprocess). It's a widely used thing for python->python object copying.

silver plover
brisk gazelle
# hot junco pickable?

Per the pickle module. But BillyBobby is right to point out as to if this dictionary is supposed to be a shared state, or just communication of information. If you want a shared state, there are a few classes in multiprocessing for that.

#

But it still has to be pickleable.

hot junco
sand hornet
brisk gazelle
#

Any shared state is virtually shared. It's still cross communucated across processes.

hot junco
sand hornet
brisk gazelle
#

It's communicated across processes.

#

I don't understand the technical details, but I expect there's caching and update callbacks to update/communicate things as needed.

#

It might just live entirely in one process' memory and readwrite from other processes might be pure communication with the one authoritative copy.

#

That communication is why everything you store in this shared state needs to be pickle compatible serialisable.

#

It will tell you if it isn't.

hot junco
#

So is using a dictionary variable in a multiprocess.Queue setting a viable way to share a data sharing and modify?

brisk gazelle
#

You can communicate state, but modifying that at one end will not affect those at the other ends unless you do it explicitly.

brisk gazelle
#

Communicating the updated state.

#

You're transmitting copies of the data. Like if I have one page of writing and I e-mail it to you. You editing your copy doesn't alter mine.

#

You'd have to email me back with the updated copy.

#

Emailing is the queue.

hot junco
#

or at least every time its updated.

brisk gazelle
#

Unless you use one of the "shared" state classes in multiprocessing, of which I don't think there's a dict like.

#

!d multiprocessing

edgy krakenBOT
hot junco
brisk gazelle
#

Hm. I'm just looking at the managers part.

#

It doesn't look straightforward. I'd have to stare at it and chew.

hot junco
hot junco
tame hinge
brisk gazelle
#

I get easily overwhelmed by information.

tame hinge
#

Valid

hot junco
tame hinge
hot junco
hot junco
brisk gazelle
#

As a general idea, I am partial to cake.

hot junco
native coyote
#

sorry

brittle grail
soft fable
#

testing

#

ivan, what did you do

brittle grail
#

link

soft fable
#

i see

brittle grail
soft fable
velvet trout
raven urchin
#

Ooohh, I've had a great idea

#

After finishing my lil game I could package it

granite wyvern
raven urchin
#

I can still add a lot more stuff

#

Let's see how much I can learn about pyside with just a tic tac toe >:)

swift sparrow
#

but it is still helpful to start new things so you can remind yourself of all the setup too

brittle grail
#

chat now i made coding fun asff

raven urchin
swift sparrow
#

it taught me the most about classes and inheritance

raven urchin
#

It's teaching me a lot about organization and using multiple classes together to build something bigger :3

brittle grail
#

fashoomp and saber , let's say that I want to import a library, but for example, a mathematics library. How do I search in libraries? ?

swift sparrow
#

depends if you're referring to standard library or 3rd party ones

brittle grail
#

google or github

raven urchin
#

You have to investigate what you need and what suits your needs

brittle grail
#

wdym by 3rd party one

swift sparrow
#

python comes with modules (the standard library), like you could do import math without having to install anything special

raven urchin
swift sparrow
#

but people are also able to package and release their own libraries for you to install

brittle grail
brittle grail
swift sparrow
raven urchin
swift sparrow
#

think about what you want to know, then do a bit of research to see if a library exists to achieve that

brittle grail
swift sparrow
#

for 3rd party libraries, there's pypi

#

!pypi

edgy krakenBOT
#
Missing required argument

package

swift sparrow
#

!pypi numpy

edgy krakenBOT
#

Fundamental package for array computing in Python

Released on <t:1774790521:D>.

swift sparrow
#

(for example)

raven urchin
# edgy kraken

This reminds me that I want to make this exact command but with GitHub repos...

brittle grail
raven urchin
raven urchin
brittle grail
raven urchin
#

I mean what do you want to code

#

What's the problem you want to solve

swift sparrow
#

I think they're saying some sort of tutor program that asks you math questions

raven urchin
#

Ohh

#

That sounds cool, kind of like a math Duolingo?

brittle grail
brittle grail
raven urchin
#

You want a special calculator?

brittle grail
#

and i want to make a thing if you get 4/10 ( you failed )
if (5/10 you're on the edge )
and like that

raven urchin
brittle grail
swift sparrow
#

do you already know what sort of questions you want to ask?

swift sparrow
#

why do you think you need a special library?

charred tusk
#

My nap was too long and now its night and I can't sleep
I've never seen chat at this hour before

brittle grail
raven urchin
brittle grail
raven urchin
swift sparrow
#

it's a bit hard to search for something if you don't know what you're looking for

brittle grail
#

but probably i want to make very hard math equations

raven urchin
#

You'll have to make a plan to follow

brittle grail
raven urchin
raven urchin
swift sparrow
brittle grail
brittle grail
raven urchin
raven urchin
brittle grail
brittle grail
desert dagger
raven urchin
brittle grail
raven urchin
#

Well

#

I'm going to sleep, good night

desert dagger
brittle grail
brittle grail
brittle grail
raven urchin
#

❤️

desert dagger
brittle grail
desert dagger
brittle grail
#

chat is there a library called History ?

charred tusk
#

out of the question
we were just asking!

charred tusk
shrewd plinth
brittle grail
shrewd plinth
#

idk if any are explicitly "History" but there are over 10k

brittle grail
swift sparrow
#

I showed you pypi moments ago 😅

brittle grail
swift sparrow
#

Did you click it when I linked it to you?

brittle grail
#

i thought pypi is a library

#

💔💔💔

brittle grail
swift sparrow
#

I linked to numpy as an example

#

you were meant to click to it to see the site

brittle grail
#

sorry bro

brittle grail
#

owww

#

sorry bro

brittle grail
#

it keep repeating the questions

quartz fulcrum
#

good morning,
ready to learn again!

brittle grail
#

gm wizard

paper kiln
#

Hello!

velvet trout
velvet trout
brittle merlin
quartz fulcrum
raw bramble
#

😔 I’m a gamer trapped in real life

#

Who else yells “+4HP!” after eating their breakfast in the morning?

lost lagoon
#

i dont yell it... it just show on top of me

brittle grail
peak relic
chilly trout
#

,topic

#

tf

#

.topic

verbal wedgeBOT
#
**What is your motivation for programming?**

Suggest more topics here!

chilly trout
#

.topic

#

yeah wtv

hybrid nebula
raw bramble
# verbal wedge

fun :D it’s a good creative outlet (also it makes people around me think I’m smart 😈😈)

native coyote
#

a fish simulator game

peak relic
raw bramble
autumn forge
native coyote
hybrid nebula
#

Who is actually responsible for convincing the unaware that programming is in any way related to 'hacking'

peak relic
raw bramble
#

Far too many people genuinely believe that’s what hacking is

chilly trout
hybrid nebula
raw bramble
chilly trout
chilly trout
# raw bramble Not really

to make exploits on a system level you 100% need programming, for pentesting youll still likely need it for an advanced target

raw bramble
#

I thought more people in computing / ICT would be interested in programming but I’m the only person in my classes who knows any programming or cares about programming at all 😭

hybrid nebula
#

It's also weird how programming is just. not covered in school

raw bramble
chilly trout
raw bramble
#

I think it’s weird how people doing cybersec would think that programming is “useless”

chilly trout
#

like if theres no attempt to secure it you could do something like an sql injection straight from the terminal

inland karma
#

good morning

raw bramble
chilly trout
hybrid nebula
raw bramble
#

And didn’t teach many of the programming parts of it, it was visual, but it was extremely basic

hybrid nebula
#

My school 'taught' us Java.
We had to learn certain snippets by heart.

chilly trout
raw bramble
hybrid nebula
#

lol

raw bramble
#

The quality of computing education I received in school makes me want to become an ICT teacher to give people a better quality of education

quartz fulcrum
#

@peak relic we were discussing the utc and offset thing, i want to know now how do i set the timezone offset separate for every individual

quartz fulcrum
peak relic
inland karma
raw bramble
peak relic
quartz fulcrum
#

yes

raw bramble
#

I just want to be the wise sensei you climb to the top of mountains alone to reach and I bestow wisdom upon you, the first spinjitzu master

peak relic
hybrid nebula
quartz fulcrum
#
class Account:
    current_time = dt.datetime.now(timezone.utc)```
peak relic
quartz fulcrum
#

yes

raw bramble
peak relic
raw bramble
#

Why leave people with sucha high amount of debt if they’re never going to be able to pay it off?

quartz fulcrum
#

shouldnt we make a instance attribute

hybrid nebula
quartz fulcrum
#

as everyone has different timezone

peak relic
#

so when you init a new instance, make sure to pass timezone when making that instance

raw bramble
#

I originally wanted to be a game developer but that doesn’t seem like a very stable or fun job to have at the moment

pallid frigate
#

hello

chilly trout
#

how do i add comments to a .gitignore again im blanking

#

its a hashtag right?

chilly trout
#

ty

peak relic
brittle merlin
#

can u upload a whole movie to github?

peak relic
peak relic
brittle merlin
#

damn

pallid frigate
#

im bored lol

peak relic
pallid frigate
#

dunno what to build

hybrid nebula
edgy krakenBOT
#
Kindling Projects

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

brittle merlin
#

spam your friends with email

#

how does gmail flag mails as spam? is there any way to control that metadata?

pallid frigate
#

nope don't think so

#

bro i am not experienced enough for 90% of these lol

#

bagels..?

quartz fulcrum
#

i am still confused...

pallid frigate
#

same

hybrid nebula
swift sparrow
pallid frigate
#

file management, began my own lang

#

brb

peak relic
quartz fulcrum
#

class Person:
    def __init__(self, name):
        self.name = name```
peak relic
quartz fulcrum
#

how do i know his timezone...do i need to create a method?

peak relic
quartz fulcrum
#

ah ok

#

what the user going to type in place of offset

inland karma
#

same way the users name, you dont know that, you let the user decide

peak relic
quartz fulcrum
teal cradle
#

Hello, world

peak relic
# quartz fulcrum yes

yes... so you let the user enter whatever integer they want. you dont need to hardcode -7. Thats just an example

inland karma
#

some common options are timedelta string and integer as datatypes

#

'+0200' is also a common string format

quartz fulcrum
#

they didnt expresses much in the assignment about this, so which one i should type

inland karma
#

pick the one you feels will be simplest. working with numbers is simple because you can use math on them

swift sparrow
#

it doesn't matter much which you choose as long as you pick one and stick with it

quartz fulcrum
#

okay..

azure pine
#

Good afternoon guys , my 3rd day with python

quartz fulcrum
#

well done, a great journey is ahead for you

#

i think my eng is wrong here..but you get the point

azure pine
azure pine
simple thistle
#

hello internet!!

raw swallow
#

I'm thinking about buying claude subscription. But I don't have much of an idea about it.

What I want is
1 - get API and use can use it as chatbot in my projects

2 - it helps me in coding and I can chat about architecture, design, features etc with it (all preferably in my IDE which currently is vscode)

I'd be glad if you guys could share your suggestions and experience

peak relic
hybrid nebula
#

Are there any efficient methods to, given all prime numbers up to N, find the smallest prime greater than N?

hybrid nebula
#

I could just iterate through the (odd) numbers and check for divisibility, but that I think is the least efficient option

peak relic
brittle grail
jagged belfry
#

If N is not divisible by X, then N+X is not divisible by X

#

or, I think that's the case

hybrid nebula
inland karma
hybrid nebula
#

I'm also caching the primes, so I'm thinking I can try and check like 4096 potential primes at a time

inland karma
brittle grail
inland karma
# raw swallow Yes

your claude subscriptions gives you the talking to the AI model part, and you have to buy an API key seperatly to use it in your application

brittle grail
jagged belfry
# hybrid nebula wdym?

Lets say we have a number N, and a non-divisor A
N % A = B, where B is nonzero (otherwise A would be a divisor)
Then N + A % A = B, because of the definition of the modulus

hybrid nebula
#

Anthropic - We Charge You Thrice And Still Make Losses

jagged belfry
#

( AI got this wrong when I asked it, btw... )

quartz fulcrum
#

a first name property (read/write)
does this mean i should make a method so that i can change the name later?

hybrid nebula
jagged belfry
#

For example, starting at 71

autumn forge
#

(N + A) % A, surely

jagged belfry
#

!e ```py
for i in range(2, 71+1):
if i % 71 == 0:
print(i)

edgy krakenBOT
jagged belfry
#

then we can consider 73 as our next possible prime

inland karma
autumn forge
#

ah that confused me for a second

fiery yarrow
#

thuri has message for pygen:
heck time
heck orbital dynamics
end of message

jagged belfry
#

(71+2)

jagged belfry
#

if that fails, we consider (71+3), then (71+2*2), (71+5), (71+2*3)

fiery yarrow
#

(see ot2 for context)

azure pine
jagged belfry
#

Hm.. that might just make the natural numbers and not work.

hybrid nebula
raw swallow
inland karma
#

1: claude can help you with this
2: start out with foundantianl models first

azure pine
peak relic
jagged belfry
#

unless you're trying to push edges it's a pretty decent method

inland karma
raw swallow
raw swallow
#

Oh i see, thank you

inland karma
#

ollama is just handling the inference for you, or running the model you have

quartz fulcrum
inland karma
#

make a few dozen commits and then push

peak relic
#

make small git commits, then push them in one go later

quartz fulcrum
#

btw i am using pycharm for it

quartz fulcrum
raw bramble
#

Will this work the way I intend it to?
def counter_gen(n:int) # next() returns n and sets n += 1

Class User:
usercounter=counter_gen()
def init(self, usrname):
self.id = next(User.usercounter)
self.username = username

gaunt badge
raw bramble
#

Alr so chucking things into the class definition works fine, is it bad practice to do that?

jade timber
#

Hey I got a question about python can somebody please help me with one thing I'm trying to do something with the internet archive and supposedly there's a python code to bypass something on it and I don't know how to use it

raw bramble
#

If I had some dict mapping user ids to those users, would it be bad to have it as like User.userdict

peak relic
edgy krakenBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

jade timber
peak relic
jade timber
polar vessel
#

Hello everyone,
I want to get into backend side of things
If possible, can anyone give me some tips, guidance, pointers on how to go about it ?

I know basic python, non tech background

raw bramble
peak relic
peak relic
azure pine
sterile storm
jade timber
golden mortar
half pewter
inland karma
jade timber
polar vessel
inland karma
jade timber
polar vessel
inland karma
half pewter
pallid frigate
#

dude idk what to do

inland karma
#

zip64 will handle larger files than you can possible store on one machine

polar vessel
raw bramble
#

How does zip compression work?

raw bramble
inland karma
pallid frigate
#

guys idk what to code lol

polar vessel
jade timber
raw bramble
peak relic
inland karma
raw bramble
#

Exabyte?

half pewter
# polar vessel Not exactly 😅

I think sending you into a library like fastapi before you're comfortable with data types and the like might not be a great idea. Using a library like FastAPI should not be your first step.

inland karma
slow rivet
polar vessel
fiery yarrow
pallid frigate
#

dude i aint THAT experienced

sterile storm
inland karma
fiery yarrow
#

the page for ext4 says 16-256 TiB with no note

polar vessel
raw bramble
raw bramble
polar vessel
sweet crow
#

What if I dont code for the day and bed rot with my gf instead

fiery yarrow
#

yes, with the 1024-basis

slow rivet
sweet crow
#

Yeah that seems like a better idea , Good night everyone

raw bramble
raw bramble
half pewter
sweet crow
fiery yarrow
jagged belfry
#

That's a fire take, but I can't say I disagree

pallid frigate
#

aight lang time 🙂

half pewter
jagged belfry
#

a 2.4% reduction to fit "base 10" is pure marketing goobash

half pewter
#

!resources

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.

raw bramble
#

I don’t think Terabytes, Gigabytes, Megabytes or anything should be used in computing since they are base-10 and not super precise due to that. You can’t just use the prefixes incorrectly like that

half pewter
#

... they're actually base 2

#

we just round 1024 to 1000

slow rivet
#

No, the 1024 based and 1000 based ones are different units

raw bramble
#

1000 gigabytes in a terabyte

half pewter
#

oh huh, guess I've never paid attention to that

polar vessel
half pewter
#

could have sworn a gig was 1024

fiery yarrow
#

kilo has meant 1000 for several hundred years (as a prefix, thousandish years for the number), and the binary prefixes came out in 1999

slow rivet
raw bramble
half pewter
raw bramble
inland karma
half pewter
#

I wonder why they dropped the base-2 convention

raw bramble
fiery yarrow
# charred tusk What's your point?

kilo is old, meaning it has strongly-established meaning that shouldn't be ignored, and that using stuff deprecated 27 years ago is silly

inland karma
inland karma
pallid garden
#

isnt there a kibi- prefix for 1024?

inland karma
#

because at the time, we hit the 200GB treshhold, and marketing wanted to put 200GB on the box instead of 198.7

#

or whatever 200GB is in real terms

raw bramble
#

I think GB should mean Gibibyte, and KB to mean Kibibyte. Gigabytes and kilobytes shouldn’t be used commonly

tame hinge
kind thicket
inland karma
pallid garden
#

clearly the best choice is to quantify bits in avogadro's number, which is a universal constant

fiery yarrow
cobalt flax
#

Bro i can append to a file a bunch of times

#

and then boom the file has that

#

multiple times

#

i love file opening

polar vessel
half pewter
golden mortar
#

!learn

edgy krakenBOT
golden mortar
#

^ These are all good

pallid garden
#

choose your own adventure, but beware of softlocking yourself by getting trapped in tutorial hell or inflicted with the ailment of dunning-kruger effect by LLMs

golden mortar
pallid garden
#

they break the game balance by making the learning curve super steep down the line

polar vessel
polar vessel
half pewter
#

I have a 20 min rule, try to solve for 20 mins before touching ai. Otherwise I find myself switching to autopilot and don't remember shit.

tame hinge
#

You should try to understand stuff without it. It absolutely butchers so many concepts and it will be embarrassing if you follow bad information from it.

golden mortar
undone isle
golden mortar
tame hinge
bleak creek
#

Hey guys, I have a quick question!

chilly trout
golden mortar
polar vessel
slow rivet
tame hinge
golden mortar
#

AI is like the guy from Memento. Very smart and capable, but forgets everything you told it on a regular basis.

tame hinge
polar vessel
polar vessel
tame vapor
tame hinge
#

It still produces so much slop if you aren't smart enough to o choose what you keep.

golden mortar
#

You have to understand what it's strengths and limitations are in order to use it effectively.

#

And most people don't.

half pewter
#

I don't think pomodoro accounted for caffeine but something like that. No amount of stimulants will prepare you for some of the obstacles you'll encounter in coding though, sometimes you need help, other times you should take a break.

polar vessel
undone isle
#

smart

bleak creek
# chilly trout hm?

So, I am self-teaching python + doing the coursera Python cert from microsoft.

I am trying to train myself to understand not just how to rinse and repeat projects, but also, how to think about projects that I decided to do. I am only up to learning about while loops so I am not far. However, recently I was trying to build a simple ATM, Create a Pin Checker 3 attempts, Balance Withdraw and Dep, Balance Checker, Exit Button. If 3 attempts pass lock the user out.

And I made a really shitty attempts at it. So I used claude to kindof show me how to structure my code so I can think it through better, however I feel like I cheated myself out of learning and am now just copying the format claude chose to do things in.

Is this good or should I have just tuffed it through and not used claude for where I got stuck

tame hinge
light ore
bleak creek
chilly trout
light ore
polar vessel
bleak creek
tame hinge
half pewter
#

xuL's not wrong but everyone hates flowcharts, would prefer to just grind it out without ai personally

bleak creek
#

I wish i could ss to show you guys how crappy my code was compared to claudes.

polar vessel
bleak creek
#

It was terrible

tame hinge
# bleak creek thank you btw!

You also don't need flow charts or anything fancy. If you write good code it'll reflect your thought process and solve problems. Reflecting what you want among other things.

chilly trout
tame hinge
#

Write good functions or classes in the shapes you think you want, pretend they exist, leave them empty, put the flow together in code, then implement them. Name them clearly. You'll get a better result just by playing with shapes.

polar vessel
bleak creek
golden mortar
tame hinge
golden mortar
#

AI are trained to be as helpful as possible, and sometimes that means they end up being too helpful.

sage grotto
#

exec(‘exec(“print(1)”)’)

light ore
tame hinge
bleak creek
bleak creek
tame hinge
bleak creek
#

this was all good advice, thank you everyone

light ore
# bleak creek no lol, just starting out

Then take your time and learn. You code look messy, that's how a beginner code should be. Mine might be worst than yours, so just learn and stop beating yourself

bleak creek
polar vessel
tame hinge
native coyote
#

guys

#

gemini knows what highschool I went to 💀

#

how can I remove this

tame hinge
#

Did you say it in another conversation you have stored with it?

native coyote
polar vessel
tame hinge
#

Uhhh, that's more of an issue with your information being on the Internet I think than Gemini. It's probably pulling from search results. Go through the results yourself and go find where maybe.

inland karma
native coyote
#

should I try it with my dads computer and see if it says my info

inland karma
hybrid nebula
inland karma
#

most people here are new to python, but a decent amount of professionals tend to talk alot here

hybrid nebula
#

how should I best expose shader storage buffer objects and uniform buffer objects to APL?

inland karma
tame hinge
#

Python is a fun language to talk about.

quartz fulcrum
#

many days..lol.ok

inland karma
quartz fulcrum
inland karma
#

in fact, lets count

hybrid nebula
#

3470 messages

civic moth
#

can someone help me please

inland karma
quartz fulcrum
hybrid nebula
azure pine
quartz fulcrum
#

data

inland karma
# quartz fulcrum can you show yours?

ssure, but i dont have access to it all anymore, so keep that in mind. admins have access to many other channels, and i was an admin for many years

hybrid nebula
#

347988 messages visible to us mortals

inland karma
azure pine
inland karma
#

probably 100k more messages

#

nah.. half that

quartz fulcrum
#

soo much money in your bank well that doesnt sound good

inland karma
#

you can also use discord search to see

hybrid nebula
inland karma
#

yeah, i used to run the other python discord server

#

and we merged the two together

hybrid nebula
inland karma
#

yeah, but lost to history at this time

inland karma
#

Do you even python it was called

hybrid nebula
quartz fulcrum
inland karma
#

yeah

proud escarp
#

hey, i have a question regarding tests with fastapi
https://fastapi.tiangolo.com/tutorial/testing/

right now i have this test where im creating an entry to my Item table
the way my tests are setup is that im overriding my session dependency to use an in-memory database.. or at least that's what i inteded but what seems to be happening is that a memory file gets created at the root of my project folder, but okay
https://github.com/blankRiot96/hypo-inventory-api/blob/main/tests/api/v1/test_inventory.py#L13

my question is how do i isolate tests? i mean, let's say i have another test where i create a different item. i dont want to have to think about how my other tests have modified the database... or is that just how it's usually done?
also how do i do a cleanup Path("memory").unlink() after the tests are finished running in pytest

edgy krakenBOT
#

tests/api/v1/test_inventory.py line 13

router.dependency_overrides[get_session] = get_test_session```
proud escarp
#

router is the FastAPI instance by the way. usually i see people naming it app

edgy krakenBOT
#

src/app/core/__init__.py line 3

router = FastAPI()```
golden mortar
#

That's how you'd normally do it for most tests

fiery yarrow
#

this is a rather cursed question, but alas:
should #-type comments be broken at column 72 (a la docstrings), or when regular code is?

raw bramble
#

Does this count as the official Python discord server?

reef turtle
#

i have a discord auto msg self bot can i make other people use it through a command without seeing the source in my discord server

inland karma
#

its community run

golden mortar
inland karma
#

its not run by PSF

raw bramble
#

So it’s the unofficial “official” Python discord server?

inland karma
#

we are recognized by the PSF though @raw bramble

reef turtle
raw bramble
#

Oh okay. Paris

inland karma
inland karma
golden mortar
fiery yarrow
proud escarp
fiery yarrow
#

i might be able to give some decent names, but how tf am i supposed to abbreviate

and by (7) we have enough to determine l, a number between 0 and 6 inclusive which is one less than the number of days we will have to wait before there is a Sunday which is definitely after the full moon.

proud escarp
#

eh, ill be concerned about performance later

thorny raft
#

hi

golden mortar
reef turtle
#

hello can someone help me please can i allow specific people to use my discord self bot without seeing the source

brisk gazelle
#

!rule 5 🙂

edgy krakenBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

brisk gazelle
#

Sorry.

reef turtle
#

nerd

kind thicket
rare gazelle
#

yield from y is basically for x in y: yield x?

reef turtle
brisk gazelle
# reef turtle nerd

If Discord got the idea in their heads that we were helping people selfbot, which is against their TOS and are, in my view, irrationally panty twisted about it, they would shut us down.

rare gazelle
#

or is it for x in list(y): yield x

#

is it lazy or not is the question basically

kind thicket
proud escarp
brisk gazelle
reef turtle
#

bro thinks hes a part of the team

gaunt badge
#

!mute 1320499527656013826 You will need to reread our rules. Self-bots violate Discord's ToS and so we can't help you with them.
Also, don't be rude.

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied timeout to @reef turtle until <t:1777285542:f> (1 hour).

rare gazelle
#

so it doesn't consume y first

#

it yields from y lazily

inland karma
#

yield from exhausts another generator

rare gazelle
#

or lazily

inland karma
#

im not sure why you phrase it like that.

dire flicker
#

hello

rare gazelle
#

i dont know how i can phrase it better

#

i pretty much gave examples as well

quartz fulcrum
#

balances need to be zero or higher, and should not be directly settable.
does it mean i have to create a setter?

rare gazelle
inland karma
#

it exhausts the generator

rare gazelle
#

is it consuming y then yielding

#

its an example

#

of consuming or not consuming

pine ginkgo
#

Guys what's the point of set {} one not the function

floral terrace
pine ginkgo
#

Dict but without key and value pair

floral terrace
#

{} alone is a dict, set() is a set

inland karma
runic flower
inland karma
pine ginkgo
#

So basically just set()?

quartz fulcrum
#

in it the searching is o(1)

#

ig

pine ginkgo
#

Ic

inland karma
rare gazelle
#

if it consumes y then yielding its items

#

or yielding them lazily

inland karma
#

thats why the term exhaust is better, yes that means it consumes it all first

rare gazelle
#

no its not true i just tested it

#
def a():
    cnt = 0
    while True:
        yield cnt
        cnt += 1
        
def b():
    yield from a()
    
    
for c, _ in zip(b(), range(100)):
    print(c)
#

if it'd consume all of a() first it'd never be able to yield

#

(named a twice, worked though somehow lol, since b's call was before a inside the loop's creation)

small tinsel
#

why doesn't

from decimal import Decimal

x = Decimal("0.1") + Decimal("0.2")
y = Decimal("0.3")

z = Decimal(0.1) + Decimal(0.2)
w = Decimal(0.3)

print(x == y, z == w)
``` work?
gaunt badge
mint quest
gaunt badge
#

!e

from decimal import *
print(Decimal(0.3))
edgy krakenBOT
mint quest
inland karma
mint quest
#

I know it pretty much for generators

inland karma
#

if we are mixing terms, then i would add that it is an lazy exhaust, not an eager exhaust

mint quest
#

like:

def foo():
    x = 1
    while True:
        yield x
        x+= x
rare gazelle
# mint quest yep

so the question was if in yield from y the entirety of y gets consumed before yielding its items, and its actually lazy, means that it consumes 1 item at a time from y, on each time you're trying to get an item

rare gazelle
inland karma
rare gazelle
pliant wave
#

hello

rare gazelle
#

how you did it thats interesting

rare gazelle
quartz fulcrum
#

what error the interpreter gives when the sign goes to negative

#

value error?

rare gazelle
pliant wave
#

hru

brisk gazelle
quartz fulcrum
#

idk how to explain

brisk gazelle
#

Though were a function expecting a numeric object such as a float or int and also expecting positive, then yes, ValueError would be an appropriate exception to raise.

#

The type would be correct, but the value would not.

rare gazelle
quartz fulcrum
#

but i want to raise an error when amount goes to negative

brisk gazelle
#

ValueError would be appropriate.

quartz fulcrum
#

okay

floral terrace
brisk gazelle
#

You could do py raise ValueError("Value must be positive.")

civic moth
#

Hi im an amateur is it possible to give commands to my discord bot then it gives me placeholder which I fill up then it automatically sends those stuff to another channel for example I used a command, it gave me 5 placeholders let’s just say I filled them all with “hi” then the bot sends hi hi hi hi hi to another channel of my choice (sorry for my bad English)

mint quest
civic moth
pliant wave
civic moth
floral terrace
finite sigil
#

I am having lots of issues with python's module finding mechanism
When I deployed my code in gogle cloud compute engine

#

What's the standard practice for importing ? so no errors

brisk gazelle
mint quest
# civic moth What is that

basically a custom screen where you can write info and then send it, it's used for applications for moderators and so on

civic moth
floral terrace
#

it's anti-pythonic IG

mint quest
#

and ping me there

brisk gazelle
rare gazelle
#

guys, sort of a naming question
if you use a deque for a stack (for FIFO), you name is queue or stack

lusty totem
#

But then wouldn't the stack automatically become a Queue?

rare gazelle
#

technically yes i guess

hallow umbra
#

My first step to enter the master's admission at Kyiv Polytechnic Institute is done! ✅

rare gazelle
#

i mean, technically its a queue...

brisk gazelle
#

If it's LIFO, it's a stack. If it's FIFO/LILO it's a queue. Is that right?

quartz fulcrum
#
@property
    def balance(self):
        if self._balance < 0:
            raise ValueError("Balance should be 0 or higher.")
        else:
            return self._balance

    def deposit(self, amount):
       return self._balance + amount

    def withdraw(self, amount):
        return self._balance - amount

its not working

rare gazelle
brisk gazelle
#

Unless you're mid or bottom dealing.

rare gazelle
#

what if you mid or bottom dealing but also fifo

sweet crow
#

I cast awareness of wasting time on phone

brisk gazelle
#

In a stack or heap, the last thing you push to it should then be the first thing you pop from it.

In a queue, the last thing you push should be the last thing that gets popped / the first thing you push should be the first thing that gets popped.

In a deque, you can push and pop to/from either end.

rare gazelle
#

fair i guess

brisk gazelle
#

I'm open to being corrected.

#

It isn't strictly my area.

#

This is just what my understanding is.

rare gazelle
#

i think at least in the fifo case u're right, calling it a stack feels weird

#

so say you use a deque and do popleft, calling it a queue instead of stack is more accurate i guess

#

queue = deque() in other words

brisk gazelle
#
import collections
deque = collections.deque()```
little roost
#

I'm so confused what were talking about here I've literally just joined this server

rare gazelle
#

if u use it as a queue i think naming it as queue is more accurate

brisk gazelle
rare gazelle
#

semantics

#

for reference: until now i always named it stack (but i think naming a queue stack is a bit weird)

azure pine
#

today i started part 2 of automate the boring stuff , and start reading the regex chapter , after reading 10 pages , my head is hurting ...

little roost
rare gazelle
azure pine
rare gazelle
#

i see, you're half way done then

little roost
#

I'm so unsure am I allowed to send my website link here?

brisk gazelle
little roost
#

Or even showcase the discord bots that I have created

brisk gazelle
little roost
azure pine
rare gazelle
finite sigil
#

What's pyproject.toml or setup py ?

tall zephyr
#

Hey, is there channel where someone is hiring python dev?

wise imp
inland karma
#

!unmute 1477177354387198062

edgy krakenBOT
#

:incoming_envelope: :ok_hand: pardoned infraction timeout for @little roost.

inland karma
#

dont paste newlines like that, use our paste service @little roost

#

!paste

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.

little roost
inland karma
bronze dragon
little roost
little roost
bronze dragon
brisk gazelle
#

But no damage done in either camp, right? 😁

#

Speaking of camp, hi!

#

It's me.

little roost
bronze dragon
#

Well, use the paste service from next time.

opal gull
#

is it because you think javascript isnt real code :P

quartz fulcrum
#

can anyone please tell me how to create an empty dict in a class

silver plover
quartz fulcrum
#

ok

#

do i need to write self with this

#

?

bronze dragon
#

If you want it to be an attribute on the instance, yes

quartz fulcrum
#

i want to save all the transactions

#

with its id

tame vapor
#

try it without writing self and see if it gets saved or not

inland karma
inland karma
#

name it something better than mydict

#

ahh.. .transactions.. thats a good name for it

quartz fulcrum
#

should i follow the same if i have to record everyone's id in one dict

inland karma
#

yes

quartz fulcrum
#

ok

inland karma
#

you are encapsulating data in your class

silver plover
quartz fulcrum
#

the first

inland karma
#

then you add it to the class as a class attribute

#
class Account:
    transations = {}
quartz fulcrum
inland karma
brisk gazelle
#

Aha, the Rincewindian dialect.

inland karma
quartz fulcrum
#

i am not 42 ducky_cat

inland karma
#

still a good number

quartz fulcrum
#

haha ok

inland karma
#

.wa meaning of life

verbal wedgeBOT
quartz fulcrum
#

that is also the age when people suffer mid life crisis...not a positive thing, but i heard that

wise imp
quartz fulcrum
#

but i get you

slow rivet
#

like would having a ImmutableList base interface be too hard?

gleaming knoll
golden mortar
inland karma
brisk gazelle
wise imp
slow rivet
inland karma
# brisk gazelle <:ducky_wizard:639355996954689536>

The "I want to be the first person in a sequel to say F%#K!" Easter egg from the PC/PS1 videogame Discworld 2 - Missing Presumed.

The cryptic solution to this secret scene was first discovered and revealed to all in December 2011 - 15 years after the game's release! Visit the Adventure Gamers thread located here http://www.adventuregamers.com/f...

▶ Play video
golden mortar
#

Like ArrayList or something

brisk gazelle
inland karma
#

rip sir Terry

slow rivet
#

like if a interface has some methods, I would assume most implementations would well implement them.

brisk gazelle
#

The Duck Man is a thing.

golden mortar
#

I suppose? I don't recall running into issues with it, personally. Maybe it could be problematic in some contexts.

slow rivet
#

well if you write a method taking a List and expect to be able to modify it

#

or expect to be able to modify a list returned from a method, etc.

golden mortar
#

Hm, yeah, but hopefully you wrote a test that executes the method so it blows up before you even merge your PR.

#

And then you learn you can't do that with List.

slow rivet
#

yeah I noticed because I used List.of in my tests which turns out in immutable, if my tests instead had passed an ArrayList I would have never discovered it

golden mortar
#

I guess it's a bit unclear and subtle, which is a fair criticism.

hybrid nebula
#

hmmm...
why do we write assignment like x = y + 1?

#

wouldn't y + 1 = x make more sense?

slow rivet
#

yeah and like the List docs do call it out, so its not like its hidden.
more so that I assumed a List interface with a .add method would you know required .add to be implemented so I didnt read the docs too closely

rare gazelle
wise imp
rare gazelle
#

you write in math 5 + 1 = x or x = 5 + 1

hybrid nebula
inland karma
hybrid nebula
#
  1. y + 1 = x more closely resembles the order in which things are done by the computer
rare gazelle
slow rivet
wise imp
#

mmm, true (probably)

slow rivet
#

like python has MutableSequence

wise imp
#

yes (though arguably, that's not very obvious)

slow rivet
#

at least you can more safely assume that something type hinted as MutableSequence will allow mutation

wise imp
#

that, certainly, yeah

#

I'll have to keep this in mind for myself, lol

#

List being immutable in Java

golden mortar
#

It has mutation methods and whether they work or not depends on the implementation.

gleaming knoll
inland karma
#

Fortran and Cobol that did it first?

hybrid nebula
gleaming knoll
#

"my language ™" would probally do both

crisp jay
gleaming knoll
#

oh also let x = y + 1, thats pretty unambigious too

bronze dragon
wise imp
craggy trench
#

python does the expression first and then left-to-right assignment

gleaming knoll
#

for iterable -> assignment_target: when

craggy trench
#

if the expression was at the left, it would've been evaluated in perfect left-to-right order

golden mortar
crisp jay
gleaming knoll
crisp jay
gleaming knoll
#

for x in xs reads good but it has the same problem as x = y + 1

craggy trench
#

for <iter>'s <target>:

crisp jay
gleaming knoll
crisp jay
#

Idk the math notation makes more sense

gleaming knoll
#

in math equality is commutative. assignment is not just equality

hybrid nebula
#

math doesn't have a concept of assignment

molten plover
#

How possible is it to find a CIS-speaking person here to learn Python?

gleaming knoll
bronze dragon
#

CIS?

gleaming knoll
#

Commonwealth [of] Independent States

molten plover
gleaming knoll
#

though im not sure how would "CIS-speaking" in general be a useful metric
knowing russian does not mean knowing like, belarusian, or kazakh

molten plover
#

Why does the translator use this specific word)

gleaming knoll
molten plover
#

I understand, I have trouble even with technical English

gleaming knoll
#

i got somewhat "lucky" in that sense and learned english in childhood before doing any programming, so when i started learning programming i didnt need to also learn english

molten plover
rare gazelle
#

(i know some that their english is pretty bad)

brisk gazelle
#

The inclusivist in me rails at English being a requirement of programming, but such is the lay of the land.

rare gazelle
#

i wouldn't say a requirement but that it helps much i guess

bronze dragon
#

Some non-English languages have it way easier than others too lol
I have never seen documentation translated into either of the two other languages I speak, but I see translations into Mandarin all the time

gleaming knoll
#

what about programming language diagnostics being translated

#

i read' some of pyright's ones in russian that fix was working on and it was so weird honestly

wise imp
golden mortar
#

That's correct

silver plover
wise imp
#

maybe this is the missing (homogeneous) Tuple I have been looking for 👀

brisk gazelle
#

Hummus genius. A spread for every snack.

gleaming knoll
half pewter
#

dubbing has gotten a lot of funding in the last 2 decades over here

#

20 years ago you had to watch with subs, anime was still a bit of a cult scene

gleaming knoll
half pewter
#

takes me back heh, conversation bout to be redirected though

gleaming knoll
#

what file descriptor is "conversation"?

#

its both stdin and stdout. hmh. weird stuff

bronze dragon
#

tty0

sudden basin
spice hill
#

I still haven't recovered from this one

robust ledge
#

smh, mods and rule 4

spice hill
#

smh that's a quote 😔

charred tusk
#

“Inconsistent use of tabs and spaces in indentation.”

inland karma
spice hill
charred tusk
#

SMH my head I thought it was gonna be a quote from some famous person

spice hill
#

(they translated a lot of the error messages poorly in funny ways)

inland karma
#

ahh...

charred tusk
#

Have you tried fixing them?
I think I patched a localization or two years ago

inland karma
#

what would be the english translation of the translatio?

gleaming knoll
inland karma
#

yeah, that is fair

charred tusk
#

Literals always sound weird

raven urchin
#

Hello beautiful people!

charred tusk
#

Chat someone thinks I'm beautiful

robust ledge
gleaming knoll
charred tusk
#

yes

robust ledge
spice hill
inland karma
#

yeah, some details will be lost to translation

harsh swallow
gleaming knoll
spice hill
#

The proper English word is "tabulation", tab is a contraction

gleaming knoll
spice hill
#

I think that's the right translation for inconsistent

#

this is clearly a ploy to make Russian developers slower at programming

gleaming knoll
#

words are bad

charred tusk
#

Oh wow
I put the word in Google and it no longer triggers automatic translation
Now its giving me an AI overview of the word, but its all in Russian
It also apparently does relate that word to \t

Табуляция — это метод форматирования текста и код (\t), перемещающий курсор на фиксированную позицию (обычно ~8 пробелов или 1,25 см) при нажатии клавиши Tab ↹.

gleaming knoll
#

the topmost result being AI overview by default is so cancer

raven urchin
gilded iron
#

Guys wanna know your opinion. What will happen if ai is forbidden?

I can say it's the end of my life, i made so much from it as an entrepreneur. But it will be new opportunities

spice hill
#

forbidden?

cerulean ravine
inland karma
gleaming knoll
spice hill
#

Anyone read the 2nd edition of Designing Data-Intensive Applications yet?

rugged barn
#

I've been trying to get hands on it

inland karma
#

link

gleaming knoll
inland karma
#

ahh.. no i did not.. but i think i will get that

#

are you planning on waitiing to hear about it?

spice hill
#

I was thinking of planning on waiting to hear about it

raven urchin
spice hill
#

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