#python-discussion

1 messages · Page 21 of 1

cerulean ravine
#

with the GIL, cpu-bound threads don't help, it's true.

rotund surge
#

Hi yall!

cerulean ravine
rotund surge
#

What are we discussing about?

cerulean ravine
rotund surge
#

I can’t wait for 3.14

silver plover
granite wyvern
rotund surge
#

I have not updated my computer yet been busy with work.

twin turtle
finite rose
#

I think the fact that you can turn off the GIL means you can write your python code to run faster. (For certain problems, designs, etc.) So it’s not necessarily an issue of “should I write this in Python or Java or C?”, it’s “I have this python code base and now I may be able to make it run faster.”

rotund surge
bleak moth
#

I'm thinking of doing this to name a file after it's location in the hive:

SaveKey(key_object._key, f"~/.{key_object.hive.name}" +
    f"{key_object.path.replace('\\', '.')}.breg")
cerulean ravine
celest osprey
#

does alpha2 not release today

cerulean ravine
celest osprey
#

oh rip

opal gull
#

Even python relies on Cloudflare💔

warm scarab
#

isn't it back up now?

proud escarp
#

wdym

#

like each thread has a lock? so the threads started in a non-main thread wont be free?

#

they would be concurrent?

edgy sandal
#

I want to make an app using python does anyone have any advice on where to start

fluid ridge
#

... doesn't python use fastly?

#

er, the psf's web services

cerulean ravine
wooden frigate
cerulean ravine
ornate wren
#

Same Python is like Rome for I.A, but i don't like this language lol

paper oar
#

hi

ornate wren
#

For backend a strong typed language is way better

cerulean ravine
ornate wren
cerulean ravine
ornate wren
#

Not yet, i have use the type hints in some places, not everywhere

cerulean ravine
ornate wren
#

Maybe i'm stuck in the mentality of : types are enforced (like c#, c++, typescript) or no types (javascript, lua, etc)

brisk gazelle
#

If someone writes a new static type checking engine, they could call it Van de Graaff.

rare gazelle
#

i found something very weird in the typing system, but probably others know about it

silver plover
cerulean ravine
dusty ember
rare gazelle
#

say u have 2 types, one is a subclass of another
noow in 1 overload u're accepting the subclass, in another the superclass
the type checker will try its best to use the subclass, even if its less explicit

ornate wren
ornate wren
rare gazelle
#

even if its not the first overload

silver plover
#

Personally, I'd argue for: embrace the Python approach and see where that brings you, I get pretty far with "somewhat typed" (basic?) and not strict pyright.

ornate wren
#

Honestly, coding without types feels like a disorganized world, like something is missing

#

I accept it in javascript because i'm not doing anything complex with it

silver plover
#

(at least for me)

rare gazelle
#

sometimes u need perfect types, sometimes u dont

#

🤷‍♂️

sweet isle
#

yo guys, working with a small database issue rn
I currently have a table that keeps track of a session, and another table for slots. each session has multiple slots

then I have a session attendee table that currently only keeps tracks of attendees for a slot, and I need to do a long query to check if an attendee is in another slot

is it recommended to just add a sessionID column to attendees? or do the query

silver plover
#

So you want to track: session, slot, attendee name?

ornate wren
dusty ember
#

lowkey the worst debugging ive had to do was an entirely vibecoded untyped JS frontend

#

there were no introspections for anything 😭

sweet isle
#

like if a session has slot1 and slot2, and an attendee signs up for slot1, I want to do a query to see if the attendee is in slot1 of the session before transfering them to slot2 if they request

ornate wren
#

if the ateende belongs to a certain session adding the sessionId colunm is pretty ok

sweet isle
silver plover
sweet isle
#

im only worried about future usecases where there might be an attendee that needs to attend 2 sessions

silver plover
sweet isle
silver plover
#

which stores slot_id, attendee_id

ornate wren
silver plover
sweet isle
silver plover
ornate wren
#

1 to 1 would not require a assocition table i believe

silver plover
#

yup, need the association when you have a many to many situation.

sweet isle
#

but assuming that each attendee should only have one slot, what would be the best solution here?

silver plover
#

Then you could put the slot_id in the attendee table.

#

So that a slot can have multiple attendees, but an attendee can only have one slot.

ornate wren
#

1 to many

sweet isle
#

what if each attendee can only sign up for one slot within a session at a time

cursive hawk
#

anyone want to be apart of my project im working on ?

silver plover
sweet isle
#

ah okay

#

ty for the help

ornate wren
hallow verge
#

hey! im looking for an experienced Python programmer preferably one who knows about the requests module and can teach me how to perform post/get requests with it!

ornate wren
#

But adding a table for that with the unique keys garantee his requirement

ornate wren
sweet isle
silver plover
ornate wren
hallow verge
cursive hawk
ornate wren
cursive hawk
ornate wren
#

Database modeling can be fun btw

#

A lot of times the whole application is "done" after you got the model right

#

You just need some crud in your favorite language, some checks business logic and its done

ornate wren
#

Its a lot like age of empires 1 - 2

#

I wish the AI was better

#

Its random but i ask myself how good an LLM would play against a real person

cursive hawk
ornate wren
distant bough
#

@ornate wren Dude 0 AD was still fun to play even though it was easy.

cursive hawk
#

but the one im working on now is 20x better no joke

bleak moth
ornate wren
ornate wren
bleak moth
#

Ugh. New keyswitches coming in thursday, and have new keycaps already.

frail stirrup
#

if i have numpy activate on a python file thats in my C drive and use a virtual enviorenment in my D drive in vscode that wont ruin anything right

hollow fox
#

aye should i use tkinter for making little desktop applications or is there something better?

unborn lagoon
hollow fox
#

ok thanks

hollow fox
#

do you know how easy it is to get started?

#

what are the differences between them?

merry pollen
#

tkinter is more lightweight, however pyside/pyqt are heavier but much more flexible

alpine glacier
#

Hi guys..can anyone help me pls

merry pollen
#

in addition you have the whole qt ecosystem, like qt3d, qt multimedia, qt bluetooth, if you ever need it

#

it is a bit more complicated than tkinter for GUI, but if you're learning a GUI framework anyway you might as well put in the bit extra work

unborn lagoon
# hollow fox what are the differences between them?

PySide and PyQt rely on the same framework (Qt) and have very slight differences. I personally like PySide more since it's the official binding. Relative to Tk, Qt usually imposes a more object-oriented approach so it introduces some complexity in that way.

merry pollen
hollow fox
#

ok thanks

merry pollen
#

however there are like 5 differences total between pyside and pyqt (i'm serious, lol)

hollow fox
#

lmao

merry pollen
#

there's no reason to not use pyside though, better support from qt company

merry pollen
hollow fox
#

yeah i think ima play around with pyside

granite wyvern
hollow fox
#

thanks ima definitely use this

merry pollen
#

this is a tutorial for QtWidgets, one of two ways to build UIs in qt the other way is QML

hollow fox
#

ok

merry pollen
#

QML is more modern, the coding for the UI is simpler and it's easier to use with animations, but it's harder to interop with python since it's like a seperate coding language that you run through qt, QWidgets is more mature, is 100% directly in your python code so it's easier to make gui->python interactions, but is a biiit more clunky than QML

#

it doesn't really matter which one you learn first since QML is so different, just learn qtwidgets because it gives you a better overview of how to work with qt in python

#

you learn how to handle qobjects, signals and slots, etc easier through QWidgets, then you can bring that knowelge into qml later if you wish

#

anyway let me not infodump on you go learn lol

hollow fox
#

ok lmao

#

im glad i have more over view though and not picking a random library and hoping it does the job

merry pollen
#

yeah yeah, np

gaunt cape
#

I learned python but never built anything. You guys have any concept to work on? something creative.

finite yacht
gaunt cape
finite yacht
#

What do you think

finite yacht
#

Unhinged rp

bronze dragon
#

Just look it up

gaunt cape
gaunt cape
mossy sigil
#

hello

finite yacht
gaunt cape
gaunt cape
finite yacht
#

Make a pull request 😅

#

Yes it is

mossy sigil
finite yacht
#

What

#

In this case maybe

bronze dragon
gaunt cape
mossy sigil
gaunt cape
gaunt cape
mossy sigil
#

thought u meant the request module

bronze dragon
mossy sigil
#

my bad gang

gaunt cape
#

@finite yacht Would you like to have a module that would do Financial mathematics using this?

jovial oxide
#

any other suggestions that isnt cs50? He's a great teacher just moevs way to fast for my little brain

gaunt cape
#

Because you won't be able to see your progress if you keep changing tutorials and motivation is important to keep going.

jovial oxide
#

fair point

bronze dragon
ornate wren
gaunt cape
#

@finite yacht << Support for Percent Ranges: Allow users to calculate percentages for a range of values, making bulk processing easier. >> Maybe I would like to work on this but I need to know what is means. (I AM SO DUMBB)

ornate wren
#

Since you can't ask the teacher then search your question / doubt using either google or chatgpt

jovial oxide
#

ai is ass i've heard been tryna avoid

gaunt cape
bronze dragon
jovial oxide
gaunt cape
ornate wren
pallid garden
#

if you are asking it to search the internet then you might as well use google?

gaunt cape
ornate wren
gaunt cape
#

I only use it for schedules, writing snippets of codes to save my time etc

pallid garden
#

why does condensing the knowledge matter?

gaunt cape
jovial oxide
#

ruff

gaunt cape
#

llm to be specific

ornate wren
pallid garden
bronze dragon
jovial oxide
gaunt cape
ornate wren
pallid garden
jovial oxide
#

o

ornate wren
gaunt cape
jovial oxide
pallid garden
jovial oxide
ornate wren
gaunt cape
# jovial oxide ruff

Haha meow meow. There is a script called rocketmeow that I made. I don't know how to use git or github

jovial oxide
#

me either

opal gull
ornate wren
#

Anyway, A.I is useful, but honestly its good for popular things

gaunt cape
gaunt cape
ornate wren
#

you mean cats are from south asia?

#

not a cat called vladimir

bronze dragon
gaunt cape
ornate wren
#

Right

pallid garden
ornate wren
#

Because there is no single source of truth or knowledge

#

Nor in a book much less in a website

pallid garden
#

i guess sometimes you just want to learn how to use a function, and other times you want to know every possible ways you can use a function

alpine glacier
#

Guys i want help

gaunt cape
bronze dragon
gaunt cape
ornate wren
#

If you have means to condense some knowledge, like keep what is similar in all sources but then highlights what is different, that is a more complete knowledge

pallid garden
#

still, isnt the ability to synthesize information and pick out what you need a necessary skill to learn?

alpine glacier
ornate wren
alpine glacier
gaunt cape
bronze dragon
alpine glacier
ornate wren
#

you said youtube

ashen thicket
pallid garden
ornate wren
#

this is fun

ashen thicket
alpine glacier
alpine glacier
bronze dragon
alpine glacier
#

I want it to save in Google sheet automatically

pallid garden
#

do you want to save some videos or every single videos you watch?

gaunt cape
ornate wren
#

You want the extension to see that you are watching a video and add it to a list that you can check later

ashen thicket
alpine glacier
ornate wren
#

what is your usecase btw?

alpine glacier
ornate wren
#

Ok, but how useful it is?

ashen thicket
ornate wren
#

To know what you watch

alpine glacier
bronze dragon
ashen thicket
rare gazelle
#

.topic

verbal wedgeBOT
#
**Which Python project are you the most proud of making?**

Suggest more topics here!

ashen thicket
#

you can only rewatch if you are able to scroll up back

ornate wren
#

true

alpine glacier
#

See guys I have different email id for different purpose..one for coding and another for something else so I only watch that kinda of videos in that type of email id like that so ai of social media only recommends me that only like that

rare gazelle
#

.toipc

#

.topic

verbal wedgeBOT
#
**Which Python feature do you love the most?**

Suggest more topics here!

ornate wren
#

an email dedicated only for thirsty traps

#

I like the idea

rare gazelle
ornate wren
#

Social media is full of that shit

rare gazelle
#

if not having its own scope

#

probably one of my favorites

alpine glacier
#

So what can I do so i can know what videos am watching

alpine glacier
celest tendon
#

use that mode 🤯

alpine glacier
#

What mode

celest tendon
#

The one which doesn't save anything so that nothing of that topic is recommended in future to you

alpine glacier
#

You mean guest mode

celest tendon
#

Yeah

dry pike
#

h

tacit aspen
#

why is there no web dev servers SAD

visual juniper
pallid garden
visual juniper
peak relic
dry pike
#

spammoment

wanton sandal
#

has anyone used Positron?

peak relic
#

I have a script running in my Task Scheduler but it keeps popping up the console window every single time, which is annoying. How do I make it run without showing up the window?

Currently its action is set with C:\path\to\uv.exe, arguments as run main.py

#

I tried with -q but it still pops up the terminal window

rugged star
pallid garden
peak relic
#

I'll try the .pyw

pallid garden
alpine glacier
#

Ignoring me 🥲

peak relic
#

This doesn't sound like its Python related

alpine glacier
#

Where can I ask then?

peak relic
#

Offtopic channels

#

!ot

edgy krakenBOT
peak relic
#

apparently, my uv was at version 0.6

#

the latest version is 0.9

#

and it has uvw similar to pythonw

#

upgraded, switched to using uvw, and it works

#

nice and quiet background process

#

thanks for coming to my TED Talk

open coral
#

is Fluent Python suitable as a second book for learning python?

mossy sigil
#

I have a question
If i change something in a code
How do I cross check where else it will effect
So that the other functions that are dependent on the variable or function whatever does not get effected.
I cannot check usages with values being passed around dynamically I am unsure of.

rugged star
peak relic
#

neither did I until a few minutes ago

#

We all learn something new today

peak relic
rare gazelle
#

how can i do:

class a(Generic[A,B,C]):
  b = a[int,str,list]
#

it says Undefined name 'a'

#

in ruff

wary lily
#

hi guys

what ide do you guys use

i dont have a computer rn

so im just using online ides on borrowed laptops

but i’m gonna get my own soon

so i was wondering

dry pike
rare gazelle
#

i dont use the 3.12 type system

dry pike
#

then, a is not defined

lyric mist
#

i'm just getting into python, not sure if this is the place to ask simple questions

dry pike
#

you could try doing it as a string

#
b: TypeAlias = "a[int, str, list]"
rare gazelle
#

thats some ugly shit though

#

what i use future annotations for

dry pike
#

not another option

rare gazelle
#

😡

dry pike
wary lily
gaunt badge
rare gazelle
rare gazelle
#

i dont know "a[int, str, list]" is really ugly though

gaunt badge
#

I see

rare gazelle
#

.>

wary lily
rare gazelle
#

if only Self and type were generic aliases man

slow rivet
#

just use a forward reference

rare gazelle
#

actually type is a generic alias

#

but i mean type[Self][whatever]

peak relic
rare gazelle
slow rivet
rare gazelle
#

really ugly though

#

😔

gaunt badge
rare gazelle
gaunt badge
#

Like if you solve the runtime issue by doing something like

a = defaultdict(int)
class a(Generic[A, B, C]):
    b = a[int, str, list]

does the type checker complain then?

dry pike
wary lily
gaunt badge
dry pike
wary lily
# dry pike then pylance thinks that `a` isn't defined

i struggle with that too

but at a smaller scale

like idk how for loops work

a lot of the time

it’s like an ant starving next to a homeless man

despite the millions of ants it would take to make one man

the feelings the same

if that makes sense

dry pike
#

hey man can you please not put an extra newline between every line of your msg, it's kinda spammy

rare gazelle
#

if we had Owner and both Owner and Self were generic aliases

scenic finch
dry pike
peak relic
#

bro just wants to be included 💀

scenic finch
peak relic
#

I'm already feeling so exhausted and its only Wednesday.

pallid garden
#

what a week huh

peak relic
#

fr

dry pike
#

me every week

rare gazelle
#

the week isn't over yet u know

peak relic
rare gazelle
#

.topic

verbal wedgeBOT
#
**How would you learn a new library if needed to do so?**

Suggest more topics here!

peak relic
#

Read my server tag.

#

That's how I roll

rare gazelle
#

honestly i think i get it that i can't explain it with words

#

🤷‍♂️

#

somehow i just find a way

peak relic
#

like... it just speaks to you...

#

oh chosen one

rare gazelle
#

xD

#

u learn about something suddenly u find yourself in some forum or a discord server, some github repo u find intersting

#

or for example how i've made the pycharm plugin, there was a githubb for a template for making plugins

#

i could say search for documentation or stuff like this bbut there isn't a fixed way to learn something i dont know

#

i think the greatest skill in that is that i dont trust chatgpt for example, i use it, but i dont trust it

#

on the contrary when my mom gets a sms saying she has won 10k$ or whatever

#

the ability to recognize if something is good and question stuff, thats what i think trully is important

abstract ibex
#

can any1 review my prog to say if it's reasonable for a benchmark? i.e. if it's doing anything silly that is killing performance by accident: https://paste.based.lol/J0

simple sorrel
#

jupyter is soooo good

#

i been using notepad++ for years and now i use jupyter

#

jupyter nombr 1 best

mossy sigil
#

is that on linux?

simple sorrel
#

i think

mossy sigil
#

where do i get it

#

flatpak deb?

#

tar?

simple sorrel
#

you also use notepad++?

mossy sigil
#

does it have dark mode

simple sorrel
#

yes

mossy sigil
#

okay good

#

is it good?

simple sorrel
#

yes

#

accelerates learning

mossy sigil
#

what does it have that vscode or other ides dont

simple sorrel
#

idfk i never used the other ides , i only used notepad++ and now i use jupyter and from my biased standpoint jupyter is the best

mossy sigil
#

alright

shrewd pine
#

jypyter notebooks are great for tasks where what you want is closer to a very fancy repl

bleak ore
#

Integrated Development Environment

Notepad++ is just a text editor, not an environment

shrewd pine
#

e.g. it's great for stuff like data analysis and whatnot

simple sorrel
simple sorrel
simple sorrel
bleak ore
stable narwhal
#

is !e an IDE

bleak ore
simple sorrel
#

idgaf what you guys saying if i can type code and run it it's an ide whether you like it or nor

shrewd pine
stable narwhal
simple sorrel
#

if not then it is not an ide

shrewd pine
stable narwhal
#

best ide

simple sorrel
#

if you can do a project from start to finish then whatever you used is an ide

bleak ore
bleak ore
simple sorrel
#

if you can get a project done with it it is in fact an ide

stable narwhal
#

That’s a stretch

timid kite
bleak ore
bleak ore
opal gull
#

are we seriously discussing the definition of "IDE" for the 10000th time

opal gull
#

yall 🙏

shrewd pine
simple sorrel
#

a very unique one that is

simple sorrel
shrewd pine
#

nope

simple sorrel
#

what

bleak ore
stable narwhal
shrewd pine
#

integrated

simple sorrel
#

is it?

#

im not ide'ist so i wouldnt know

bleak ore
#

You lost the argument the second you started typing, give up already

simple sorrel
bleak ore
opal gull
#

you couldve used this chance to educate them about what an IDE is compared to an editor

#

and ur whining about some "you lost the argument HAHA"

simple sorrel
#

loser mindset tbh

#

the lion finishes a 1500 line project with notepad++

bleak ore
simple sorrel
#

i never used a debugger because i can just change my code a bit and see what's going on

bleak ore
#

We've gone from helpful to hopeful

mossy sigil
bleak ore
#

Hopeful he's maybe right sometimes

simple sorrel
#

too lazy to convert

bleak ore
kind thicket
kind thicket
simple sorrel
#

thats true, the only wrong thing about me is the fact that im too lazy to change from windows to linux

bleak ore
kind thicket
bleak ore
simple sorrel
shrewd pine
#

the point of ides is that it's an editor with deep integrations with the language and similar development needs

bleak ore
#

I've already mentioned the definition of an ide twice, him ignoring it is up to him, Ive tried to take the chance to educate, he declined

kind thicket
simple sorrel
#

🗿

bleak ore
shrewd pine
#

jupyter notebooks are more of a "literal programming" environment

mossy sigil
#

jupyter notebooks can prevent that you train your typing muscle

shrewd pine
#

it's not meant for creating full-on programs, but a place to do interactive stuff

pallid garden
bleak ore
shrewd pine
pallid garden
kind thicket
shrewd pine
pallid garden
shrewd pine
#

(trying to use jupyter notebooks as an ide is also a bad idea as it allows you to run cells out of order and repeatedly)

kind thicket
bleak ore
shrewd pine
#

i.e. you can have a notebook that "works" but only because it worked in the order you ran/edited the code

#

notebooks are great at a bunch of stuff, but being an ide is not one of them 🙃

mossy sigil
#

that reminds me - what do users of the community edition of pycharm do now that you have to pay?

bleak ore
#

How, why, what

mossy sigil
#

yeah, only pro version available now

bleak ore
bleak ore
pallid garden
#

oh

fervent matrix
bleak ore
pallid garden
winged shale
#

I had a dream where i ran out of variable names

slender urchin
#

They consolidated it into one version that has both free and paid functionality, you can still use it without paying and get the community edition functionality

bleak ore
mossy sigil
#

i am not well informed then, sorry

bleak ore
#

It's just convenient for smaller sessions

pallid garden
bleak ore
#

But I only use it when teaching or helping

pallid garden
#

how often do people help each other debug, in the workplace?

bleak ore
pallid garden
bleak ore
slender urchin
bleak ore
#

I feel smart now

restive phoenix
edgy fractal
#

how bad electron is for writing a simple gui app ?
i only hear bad things about it

bleak ore
restive phoenix
# pallid garden wdym

a problem that needs time solving was already solved by a colleague, an that colleague happens to now the answer already == time saved 🙂

pallid garden
pallid garden
#

not a new tab/window

#

a completely separate instance

edgy fractal
#

what about qt? is it good for mobile app development

pallid garden
#

it's not exactly common

slender urchin
edgy fractal
#

i think i should just learn flutter then

grizzled wasp
#

Qt's mostly done through their web engine nowadays too

kind thicket
#

You also have to consider that someone senior has seen more issues and can find it faster than a junior.
And often, you don't want a junior to spend days being stuck. So you want to time bound the issue.
And then you have the tunnel vision and rubber ducking

grizzled wasp
#

For anything where I'm figuring out business rules I'd also much rather bounce ideas off of someone do we don't overlook something before validating them with a client

pallid garden
#

i meant like colleagues of similar experience levels

kind thicket
#

junior/senior on the same team are colleagues

bleak ore
kind thicket
#

same ideas with people of similar experience

pallid garden
#

pardon my phrasing earlier

kind thicket
fiery willow
#

I lost my original script snd all I have left is an exe of it 😭

pallid garden
#

do you help your colleagues debug over the shoulder?

kind thicket
#

yeah

pallid garden
#

thats... interesting

shrewd pine
kind thicket
pallid garden
#

nah, back when i was interning i dont usually see my seniors doing that

kind thicket
#

maybe they were too shy or not the same culture

pallid garden
#

i didnt mean that it's shameful

slender urchin
#

Where i'm at rn every offfice has an extra chair so someone from a different office can pull up and sit beside you

pallid garden
#

different companites different culture i suppose

kind thicket
#

working with someone doesn't mean you would never find it on your own

shrewd pine
shrewd pine
#

hot-chairing pair programming

slender urchin
#

6 ppl in a room, 7 chairs

pallid garden
#

the most collaboration ive done with other people is over github and slack

kind thicket
# pallid garden i should try that

People will come from different backgrounds, degrees, experiences, their own favorite tools.
So it can be great to exchange ideas and tips and ways of working

#

like you would notice they use this fancy new CLI or shortcut or theme and would probe about it.
Or discover a feature of the debugger you never cared to check and try

shrewd pine
pallid garden
#

it's a significant reason why i decided to join discord programming servers

shrewd pine
#

(because it's right next to the toilet)

#

(it's not a popular seat)

kind thicket
shrewd pine
#

"have you heard about jj?"

kind thicket
slender urchin
shrewd pine
#

there is a vs code plugin called that for jj :P

pallid garden
shrewd pine
grizzled wasp
#

I need to try jj, I was happy with pycharm's git integration, but had to switch to vscode and the git in here is kinda crap that I do half the things in cli anyway

visual juniper
pallid sapphire
abstract ibex
#

just want tom ake sure i didn't introduce anything that will make itway slower than it should be

rigid ridge
#

Hi, I started the process of creating a proposal with the goal of writing a PEP. Do you see any use/point in it?
https://discuss.python.org/t/proposal-for-a-new-way-to-overload-methods-by-arguments-and-whether-it-is-synchronous-or-asynchronous/104902

Example

import asyncio


class Example:
    @coroutinedispatch
    def process(self, x: int) -> str:
        return f"Processing integer: {x}"

    @process.register
    async def _(self, x: int) -> str:
        await asyncio.sleep(0.1)
        return f"Processing integer asynchronously: {x}"

    @process.register
    def _(self, x: str) -> str:
        return f"Processing string: {x}"

    @process.register
    async def _(self, x: str) -> str:
        await asyncio.sleep(0.1)
        return f"Processing string asynchronously: {x}"


example = Example()
print(example.process(42))  # Processing integer: 42
print(example.process("hello"))  # Processing string: hello


async def main():
    print(await example.process(42))  # Processing integer asynchronously: 42
    print(await example.process("hello"))  # Processing string asynchronously: hello
craggy willow
surreal knoll
#

What does _ func name do?

craggy willow
#

it's just a name

#

doesn't do anything

rigid ridge
surreal knoll
#

Ohh so they all r named process?

craggy willow
#

_ usually used when name won't be used

#

e.g.

for _ in range(5):
    print("hi")
#

i'm not using the loop variable, so i indicate that by using "_"

rigid ridge
# surreal knoll Ohh so they all r named process?

Yes, it is a method overload, but considering the context from which it is being called, if it is called from a synchronous context, it returns the synchronous functions; if it is from an asynchronous context, it returns the asynchronous functions.

surreal knoll
rigid ridge
surreal knoll
rigid ridge
craggy willow
rigid ridge
surreal knoll
#

In some libs I've seen them use,
Example().some_method(with_async=True)
Think they do something similar.
But maybe that can solve this problem?

surreal knoll
rigid ridge
surreal knoll
#

Yeah maybe that's why I've only seen that

jovial oxide
#

chat who tryna buy my doordash

rigid ridge
craggy willow
#

dispatch gonna have a hell of a time

rigid ridge
#

This is intended for libraries that have different code for the same method when it's synchronous and asynchronous, and that manage this using:

sync: <name_of_method>

async: a<name_of_method>

With this, in the documentation and from the user's perspective, it would be the same method, and the appropriate one would be executed depending on the context.

craggy willow
#

alternatively, you could just have separate sync and async function names so you don't get a surprise bug

#

i mean i've seen this before in curio

edgy krakenBOT
#

curio/meta.py lines 118 to 122

def awaitable(syncfunc):
    '''
    Decorator that allows an asynchronous function to be paired with a
    synchronous function in a single function call.  The selection of
    which function executes depends on the calling context.  For example:```
craggy willow
#

but i don't think it's good design

#

but i guess i'm not who you gotta convince anyway

rigid ridge
#

These changes stem from my experience working with Django, where I realized they would greatly simplify my code and could also significantly simplify Django's codebase. However, I'm not sure if this is just my specific case or if other people might also have this thought.

slender urchin
#

til about singledispatch

opal gull
jovial oxide
#

Hater

brisk gazelle
#

I am incandescent with hatred, but I could never hate Python. I am, at worst, occasionally mildly annoyed by it.

#

Like, yeah, let's have a convention that classes should be in Pascal, but then have the builtin classes named in lowercase because "they're used like functions".

swift sparrow
brisk gazelle
#

Hm. Makes a sense.

#

I'm also slightly annoyed that lambda is six characters.

#

Lambdas should be short. The length of the keyword is almost self-defeating in that purpose.

#

Yes, you could just def it up with something short.

slender urchin
#

looks away as they close the ts file in front of them with 20+ line anonymous functions

brisk gazelle
#

(╯°□°)╯︵ ┻━┻

bright mauve
#

same, but in java

silver plover
brisk gazelle
#

I like the pdf files.

#

The html docs are...eh.

silver plover
#

I don't think I've ever opened the PDFs.

brisk gazelle
#

I'll look at the html docs, because they're what gets presented as the foremost.

#

But when I was starting out, yeah.

#

library.pdf is the Python bible.

spice hill
#

reference documentation really benefits from every kind of item being documented in the same way

still mason
#

i accidentially made the most cursed guess the number game (in my transpiled language so... this is kinda off topic but eh...)

brisk gazelle
#

Cursed how?

spice hill
still mason
# brisk gazelle Cursed how?
imp std/random.pypp


fn main() -> int
    assert_fix: false => int num=random_randint(0, 10);int guess;while (guess != num){std::cout << "guess: ";std::cin >> guess;std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');if (guess > num){std::cout << "Too high!\n";};if (guess < num){std::cout << "Too low!\n";};if (guess == num){std::cout << "You got it!\n";break;};};
end
#

so... umm

cerulean ravine
brisk gazelle
#

The pdf files, while there are a few of them, aren't as segmented.

#

I think.

#

It's been a while and I may be rose tinting it.

grizzled vale
#

anyone who's knowledgeable abt monte carlo simulations😭

cerulean ravine
bronze dragon
grizzled solar
#

I first thought it was that uh equation veritasium made a video about which when graphed gives a 3D mandelbrot or something

viral topaz
#

Hi everyone! I'm Ankita and am new here

I’m a full stack developer with over 3+ years of experience ( React, Next.js, TypeScript, Tailwind, Shadecn , Node.js, NestJS, PostgreSQL, MongoDB, AWS, Docker, Firebase , Strapi , Python , FastAPI ,MCP , Agentic Workflow and Automation , even used may AI Based tools for productivity etc )building and contributing to various tech projects. I enjoy solving problems, collaborating with teams, and working on meaningful products. I’m currently exploring part-time opportunities where I can contribute alongside my current role.

If anyone is working on something exciting or knows of any opening, I’d be happy to connect and explore! Looking forward to engaging with the community 😊

viral topaz
glacial lichen
#

guys what after RESTAPI?

#

i've learned that on flask

#

so if in a particular company they work on MERN then i have to learn RESTAPI on MERN?

#

or i'm good to go

tawny sedge
#

Express.js is restful so yes, this is not a python question fwiw

nova grove
#

What's an easy gui library that even a brain dead monkey can understand

nova grove
#

okey ty !!

#

any alternatives

pallid garden
half pewter
nova grove
#

curious !

silver plover
glacial lichen
pallid garden
cerulean ravine
grizzled solar
silver plover
nova grove
glacial lichen
grizzled solar
#

fair enuff, thanks @silver plover

pallid garden
#

you are always generating randomness during the simulation

silver plover
#

Well, yah, if there's no distribution whats the point?

pallid garden
#

@grizzled solar this

cerulean ravine
#

the name "Monte Carlo" is from the randomness of roulette tables in Monte Carlo (I think)

silver plover
#

I think it's implied that the search space is too large to exhaustively search, too

#

Iirc, the term came about from Manhattan project... let's see if I'm right

grizzled solar
#

when i checked wikipedia for monte carlo, i only got the wiki for the place and the intro was so short, it was basically "monte carlo is a place... there's a casino there... yeahhhh"

silver plover
cerulean ravine
pallid garden
#

the technique is named after that place

grizzled solar
#

yeah

runic flower
#

An early variant of the Monte Carlo method was devised to solve the Buffon's needle problem, in which π can be estimated by dropping needles on a floor made of parallel equidistant strips.
I don't think I've seen that method of finding π mentioned before. Nifty.

pallid garden
runic flower
silver plover
#

In finance, we often use Monte Carlo to consider the effect of randomness on portfolios: the idea being that you can use the statistical characteristics (namely volatility, or stddev of returns) to consider different 'equally likely' outcomes

pallid garden
#

is fuzzing considered monte carlo?

silver plover
#

You'll find a lot of similarities between physics and some economics math.

pallid garden
silver plover
silver plover
covert blade
#

I need a tiktok view bot code

edgy krakenBOT
#

6. Do not post unapproved advertising.

pallid garden
#

wrong one oops

#

!rules 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.

silver plover
#

Eh, better to just explain 🙂

silver plover
covert blade
#

Why

silver plover
sand hornet
# covert blade Why

This isn't a job posting board. It's a community that helps you learn how to code.

covert blade
#

Ok

pallid garden
#

*spit take*

charred tusk
#

How rude would it be to say you actually need engaging content

sand hornet
silver plover
#

.topic

verbal wedgeBOT
#
**Have you published any packages on PyPI? If so, what are they?**

Suggest more topics here!

pallid garden
silver plover
sand hornet
# verbal wedge

I did. And then I was asked by a major company to pull it. 😬

charred tusk
edgy krakenBOT
#
Class instance

When calling a method from a class instance (ie. instance.method()), the instance itself will automatically be passed as the first argument implicitly. By convention, we call this self, but it could technically be called any valid variable name.

class Foo:
    def bar(self):
        print('bar')

    def spam(self, eggs):
        print(eggs)

foo = Foo()

If we call foo.bar(), it is equivalent to doing Foo.bar(foo). Our instance foo is passed for us to the bar function, so while we initially gave zero arguments, it is actually called with one.

Similarly if we call foo.spam('ham'), it is equivalent to
doing Foo.spam(foo, 'ham').

Why is this useful?

Methods do not inherently have access to attributes defined in the class. In order for any one method to be able to access other methods or variables defined in the class, it must have access to the instance.

Consider if outside the class, we tried to do this: spam(foo, 'ham'). This would give an error, because we don't have access to the spam method directly, we have to call it by doing foo.spam('ham'). This is also the case inside of the class. If we wanted to call the bar method inside the spam method, we'd have to do self.bar(), just doing bar() would give an error.

sand hornet
charred tusk
#

How much time you got?

raw bramble
pallid garden
#

now im really curious

sand hornet
# raw bramble It was that good huh?

Uhhhh "good" is questionable. Easy to read, definitely. And that's how I dug my hole. And now I'm working with them again, so ehhh didn't end poorly

raw bramble
#

I'm wondering why a company would tell you to take a pypi package down

sand hornet
raw bramble
#

What did you do 😭

sand hornet
charred tusk
charred tusk
#

Hopefully you have that time

pallid garden
finite yacht
sand hornet
silver plover
charred tusk
#

Is joke

pallid garden
#

ha

charred tusk
#

Thank

#

I tried

pallid garden
#

that's a lot of packages

fresh tide
grizzled vale
pallid garden
#

what do you need

silver plover
bronze dragon
fresh tide
fresh tide
silver plover
pallid garden
fresh tide
bright mauve
#

but fairly efficiently

silver plover
#

(What's the linear assignment problem?)

fresh tide
bright mauve
#

because the jonker-volgenant algorithm will give you the same solution as the hungarian algorithm at a lower computational cost

fresh tide
bright mauve
#

ok then yeah

silver plover
#

Is this some TSP like problem?

bright mauve
pallid garden
#

this is all english...

steel whale
#

hello! i just upgraded my bike, new rear and front suspensions (both are pneumatic, not coil), 4-gear front, new shifters, wheels, seats, etc etc

grizzled vale
pallid garden
#

ionizing radiation in tissue?

#

or something else

grizzled vale
grizzled vale
fresh tide
bright mauve
sand hornet
bright mauve
silver plover
pallid garden
bright mauve
pallid garden
#

or rather, what do you need help with?

fresh tide
pallid garden
pallid garden
#

are you familiar with the random library?

#

you might want to post screenshots of the formulae in one of the #ot channels

grizzled vale
pallid garden
#

monte carlo isnt a program

#

it's not something you put a formulae in

grizzled vale
#

What's that channel?

pallid garden
#

any one of the Off-topic / General channels

pallid garden
#
transport_coefficient = 0.9999 # this is a constant related to the tissue i was simulating
rng = 1-torch.rand(N) # this is the ξ in my formula
step_lengths = -torch.log(1-rng)/transport_coefficient # this is the formula i was given
#

ignore the torch part, that's not exactly related

#

and the formula i was given (written out) was

     -(1-ξ)
l = --------
        t
#

essentially i generated a random number ξ which i then feed into the formula, and this gets done multiple times, e.g. by using a for loop

#

@grizzled vale this is one of the variables (in this case, the step length) that is used to calculate the movement of a photon

half pewter
#

What is the question here? I've gathered that simulating bacteria was the topic right?

pallid garden
#

@grizzled vale so your formula looks like this yea S(D) = e^( -aD -bD^2)

pallid garden
#

actually we should open a help thread

wise imp
#

why pytorch?

pallid garden
#

this is old code

#

ignore the pytorch part

#

today i would use cupy

wise imp
#

I mean, I suppose it doesn't matter, it's a lot like numpy anyway, except you have the option to use CUDA if you have hardware support

half pewter
#

I would have thought there's be an easier formula if you're just collecting reproduction data but I guess for a simulation pytorch makes sense

pallid garden
wise imp
#

I feel like cupy fell off the market once pytorch and jax arrived

half pewter
#

what's jax?

#

and cupy...

pallid garden
sand hornet
wise imp
#

with autograd

pallid garden
sand hornet
wise imp
#

it's basically literally numpy on the gpu

sand hornet
#

"or AMD ROCm platforms", I stand corrected

half pewter
#

meh, no point in even bothering with rocm anymore

sand hornet
half pewter
#

might as well just use google colab

wise imp
#

they even suggest import cupy as np I think

pallid garden
sand hornet
grizzled vale
pallid garden
#

yea

wise imp
pallid garden
#

gpgpu speeds things up a lot

#

im getting like 1.59s vs 2 mins

wise imp
#

yeah, it's pretty nice

#

I mean, if you want, you can rawdog it by writing compute shaders via opengl or similar

wise imp
#

might be more lightweight if you wanted to distribute your program and had a specific need for some operation only

half pewter
#

seems like one of those things that sounds easy until you try to do it

wise imp
#

or like if you just needed something very custom

#

like, cupy also lets you write your own kernel ops

#

but again, I don't know why someone would want to use cupy when you've got pytorch and jax

#

I suppose if you have existing numpy code it might be a lot easier to just import cupy as np

pallid garden
#

i was told download size?

wise imp
#

hmm, I guess jax is a "research project", so, yeah

#

and I imagine pytorch tensors don't have all the API capabilities of numpy

pallid garden
wise imp
#

(not to mention that some of the behaviour is slightly different)

wise imp
pallid garden
#

check the equation

wise imp
#

the post is not self-contained 😭

#

(and doesn't link to where it began in this channel either)

pallid garden
#

i posted the equation late, sorry

feral knoll
feral knoll
#

Dyaaam

#

That's rare to come by

wise imp
#

in this economy?

feral knoll
#

Who

sand hornet
#

But it's almost 5am here and I'm studying for an interview for a role with 50% travel

bleak ore
feral knoll
#

Bro believe me guyz i m the same here

#

Matter if fact I'm not even 18+

dry garden
abstract ibex
#

any1 can able to have a quick look at my prog and see if it is ok as a benchmark? is it doing anything unusual that could make it slow? https://paste.based.lol/J0

half pewter
#

I think we're about due for a LLM market correction, starting to see headlines of hedge fund managers betting against it. Hopefully CEOs recognize that replacing employees with haluci-bots was a mistake sooner than later.

abstract ibex
#

or: is there some small change i could make that would make it dramatically faster?

sand hornet
abstract ibex
#

ffi benchmark. qsort is good cuz it will invoke the callback a lot. and the callback calls back into C (labs)

#

so a lot of calls both ways

#

but ts slow asl so i wonder if i did something wrong

opal gull
#

it could just be that

#

crossing the python<->c boundary is expensive

mossy sigil
opal gull
#

and youre doing this a lot so it makes sense

mossy sigil
#

i forgor to study py today

#

brainmon wait its been 14 days

#

am i cooked?

abstract ibex
#

i benching it vs my vm usually cpython crush me but on this one im 5-6x faster.. . doesn't seem right

opal gull
#

Doesn't that suggest cpython is the one doing smth wrong

deep temple
abstract ibex
#

could be but that seems less likely

charred tusk
toxic echo
#

Wohoooo i successfully cracked pwc interview

#

Lucky day today 😃

silver plover
proud escarp
#

pwc?

toxic echo
#

I could solve half only

silver plover
toxic echo
#

It was like, i have 8 balls same size, 7 weigh same, 1 ball is slight heavier than the rest. I have a balance scale to measure weight but i can only use it 2 times. I had to find which ball was the heavier one

silver plover
toxic echo
#

Yeah water jug was asked in another company interview i sat for

silver plover
#

it's really a question of: 'have you ever seen this type of problem before'

#

with 8, you measure 3 v 3, leaving two aside. (the rest is left as a problem for the reader)

strong plume
#

How do you solve that problem?

visual juniper
#

i think , group 3 v3

pastel sluice
#

it's essentially a binary partitioning problem, isn't it?

harsh anchor
bright mauve
#

not quite, because that would require 3 comparisons

#

but you can split into 6 and 2, and then 2 and 1

silver plover
strong plume
silver plover
visual juniper
#

and the interviewer

strong plume
#

The thing is, I can build and develop end to end stuff but when it comes to logical stuff like this, I am cooked

toxic echo
#

Yeah the interviewer was just asking me again and again to just explain my thought process behind solving

#

He wanted to see how i approach the problem

visual juniper
#

you honestly dont even need a course , just solve problems on online sites and its good enough

toxic echo
pallid garden
#

jfc logical test for an interview...

visual juniper
#

its not unheard of

silver plover
pallid garden
toxic echo
silver plover
toxic echo
visual juniper
# pallid garden well it should be

meh
its fine to slide in a trick question here and there apart from the usual interview questions to judge how the candidate thinks
just dont treat that trick question like it has any real weight on the interview

bright mauve
toxic echo
#

Now i feel like interview is not about acing every question but about how to behave and react

bright mauve
toxic echo
bright mauve
#

not all interviewers are like that btw, some will be very douchey about this

#

you can also take that as a hint regarding whether you really wanna work there or not

toxic echo
#

I was lucky i got a good interviewer

toxic echo
visual juniper
bright mauve
#

fair enough

#

at least you'll be able to mentally and emotionally prepare yourself for what you're getting yourself into

toxic echo
#

Does anyone have any experience of working at pwc here?

visual juniper
#

and because of that there are a lot of companies treating employees like shit and dont care if they quit because they can just grab another one from hundreds of others

toxic echo
#

One of my friends got selected in a company for some data science role, he got the offer letter and stuff and date of joining

#

When he went to the office on his first day, he found out that he was shifted to sales role

visual juniper
#

💀

toxic echo
#

Only on his first day he realised he was shifted to some sales position

#

Man companies these days are strange

floral verge
#

Good Morning all. Does anyone have any suggestions for modern alternative to using settings.ini for persisting configuration values in code? I presume JSON (or some markup) is a more preferred format nowdays, but are there any good libraries for configuration management along these lines?

floral verge
#

Good start.. have not heard of it before... will look it up. Thx Stele

jagged belfry
final nexus
#

GM. I cannot figure why this is giving me a syntax error (ignore the #'s)

patient_name = "John Smith"
age = 20
is_new = True
#print({patient})
#input is a built in function.
patient_name = input("What is your name? ")
print("Goodday " + patient_name) # Here we've combined two (2) strings)
#what is a string? "+" is a combination/concatination
#an expression is a piece of code that produces a value

west spruce
#

Hi guys, in your opinion, what are the best libraries for reading PDF files that contain tables?

final nexus
#

File "<stdin>", line 1
SyntaxError: invalid syntax