#python-discussion

1 messages ยท Page 130 of 1

orchid vortex
#

Yes i have i thought it was related to vscode but why was it called payload

#

I'll send the list

#

.net install tool C/C++ C/C++ Extension Pack C/C++ Themes C# C# Dev kit CMake Tools MATLAB Pylance Python Python Debugger Python Environment

bright mauve
#

sadly the worst case scenario can be pretty bad tho. i usually have a recipe for my setup and installs. with a decent internet connection, an hr or two is enough to reset a pc to its former glory

pallid garden
#

for the packages

bright mauve
#

i saw, but if it'll give em peace of mind

#

might be faster than a malware scan

spice hill
#

A few years ago I accidentally installed a malicious package, and the only reason that I didn't get pwned is that the package wasn't designed to work on Linux

orchid vortex
#

Might as well reset i guess

pallid garden
#

welp

orchid vortex
#

Once again

pallid garden
#

im just saying

#

there's something called overkill

orchid vortex
#

I'll transfer my usb files into another laptop then download

spice hill
orchid vortex
fresh tide
#

@orchid vortex
https://pastebin.com/eezQ0sQe

Apparently scypy is effectively malware, it contains this obfuscated cv2.py script, which is probably a stage.

orchid vortex
orchid vortex
#

Put it in copilot to check but said nothing awry

orchid vortex
pallid garden
#

this is quite obviously someone's hobby project that they uploaded to pypi out of confusion

orchid vortex
pallid garden
#

truth be told i might have missed something that you saw

spice hill
#

yeah, this looks like little Ivan's first package

orchid vortex
#

So should i reset? I'll do a basic reset first then i'll do usb reset tommorow

pallid garden
spice hill
#

Artificial Ivan

fathom pasture
#
    class Window:
        def refresh(self) -> None:
            y, x = self._calc_start_coords()
            self.win.mvwin(y, x)
            self.win.refresh()

    class Screen:
        cur_win: Window | None = None
   
        def start(self) -> None:
            while True:
                ch = self.stdscr.getch()

                if self.cur_win is not None:
                    self.cur_win.refresh()

                self.stdscr.refresh()

why does the window disappear after decreasing terminal size and doesn't appear till next refresh and why does it leave trail when I increase terminal size
this is curses(this is intentional and I don't intend to use anything outside of stdlib)

fresh tide
spice hill
#

there's no need to scare people for no reason

fresh tide
#

false alarm maybe

orchid vortex
#

Gonna have to redo bash fixes for the 4th time

#

Stupid bash had a 0kb file

spice hill
orchid vortex
#

Gonna do quick offline scan

civic prawn
#

quick question, does ONNX Runtime support CUDA 13? I'm on Arch Linux and downgrading CUDA is always a mess..

fresh tide
pallid garden
fresh tide
#

42

civic prawn
pallid garden
#

we can never be sure, but i think it's probably overkill to reset the whole pc

pallid garden
#

if it was me i would monitor for suspicious stuff

#

but otherwise i wouldnt do anything else

orchid vortex
#

Honestly I checked all I think i could

#

I checked all the logon attempts which files they were from in event viewer

pallid garden
#

cue xkcd 1217

fresh tide
pallid garden
pallid garden
#

this is the fastest way to lose an argument

fresh tide
#

I'm not trying to win an argument

orchid vortex
fresh tide
#

But if you want I'll move to some other place

pallid garden
#

i meant if you were debating someone else

#

and you brought up you got the knowledge from gemini

#

you will immediately get questioned

spice hill
#

DeepSeek says telling people that something is malware based on an LLM response is not good

proud escarp
#

hi zehata

pallid garden
#

hello axis

daring surge
pallid garden
spice hill
#

there's nothing to deobfuscate, the code is not obfuscated. It just has comments in Russian

fresh tide
#

You know, anyone can come to the same conclusion that 4k lines are easily scannable by Gemini.

pallid garden
#

i think

pallid garden
spice hill
#

in this case it's irrelevant what's in this file, because the package doesn't do anything upon installation

pallid garden
#

what does a setup py that runs a file look like

orchid vortex
#

I mean setup

fathom pasture
mellow adder
#

has anyone applied at top tech like google/ meta?

#

I am curious to know your experience.

bitter ermine
#

be prepared not to hear back for ages

mellow adder
#

oh

bitter ermine
#

it doesn't mean anything, for better or worse. with a big tech company, you could email them as a check in/follow up but I wouldn't bother. They haven't lost your application, they're just very slow with it

naive canopy
#

hello

mellow adder
#

i want to work in top tech, because i feel i am unhirable to local businesses for a full time role

bitter ermine
#

side note. anyone's opinion is welcomed. do you prefer this design:

@webhook.on(PushEvent)
def push(event: PushEvent):
    print(event)

or

@webhook.on("push")
def push(event: PushEvent):
    print(event)

I prefer the look of the second one but the type/typo safety of first one and I'd appriciate another opinion

mellow adder
#

idk if they are being dishonest with me to reject me, but everywhere they keep telling me they went with another candidate because they think i will get bored and leave them

pallid garden
spice hill
#

Well, depends, I guess

fresh tide
orchid vortex
#

Guys once i develop my mini math ai how would I approach its gui? Like what code to use to make the gui and app

bitter ermine
#

thank you all!

spice hill
#

I think string-based APIs are falling of out favour in Python, now that we have Enum in the stdlib

orchid vortex
#

Im only really familiar with Matlab gui not really anything else, I've done mostly math based coding

vital spire
#

What does @ in python do?

spice hill
vital spire
bitter ermine
#

it's a decorator, it basically wraps a function so you can run code before and after the function is called and even modify the return value etc

mellow adder
#

oqay

visual juniper
spice hill
# vital spire Function inside a function?

What it does depends entirely on the decorator. It's commonly used for registering event handlers or adjusting how the function behaves. So if you see some code using the @ syntax, you'll need to read the documentation for decorator.

fresh tide
pallid garden
bitter ermine
cerulean ravine
pallid garden
tranquil tinsel
#

For matrix multiplication?

cerulean ravine
orchid vortex
pallid garden
#

and it standardizes with matlab

spice hill
#

I wonder, does the @ operator cause any ambiguity in xonsh

orchid vortex
#

Moreso actually like jarvis

charred python
#

Should have used ๐Ÿฅธ for an operator.

pallid garden
orchid vortex
#

I'll obviously do the calculations myself to confirm if they are right but once Its mostly correct and debugged I'll start partially relying on it

orchid vortex
pallid garden
#

i see

#

thats good thats good

orchid vortex
#

I have to wait for spacy 3.14 support though for the speaking part

charred python
#

Kevin Spacey doesn't support 3.14?

visual juniper
pallid garden
orchid vortex
charred python
#

Quantum quantum?

orchid vortex
#

Field theory and quantum engineering

#

Thats pretty much what I want to work on

pallid garden
#

are you a college student?

visual juniper
# orchid vortex Predicting, graphing, calculating, higher level calculations like vector calculu...

what kind of predicting ?
can you give an example of what you will give your AI as input and what it will "predict" ??

all the other stuff like calc, lin alg sounds pretty simple to implement with an existing math library like numpy or smth

and i have no idea what you mean quantum calculations either , from what i know , that is just math , there is nothing "quantum" about the math from what i know , altho i could be wrong.

So an example of "quantum calculations" will also be appreciated

orchid vortex
pallid garden
orchid vortex
pallid garden
#

it's uhhhhhhhhhh... a bit different to say the least

#

from what you currently know

visual juniper
#

its definately an interesting combination pithink
what is your degree about ? like after 4 years , you will get Bachlores of ..... ?

orchid vortex
charred python
#

Mechatronics? Is that repair and maintenance of giant robots?

orchid vortex
pallid garden
orchid vortex
#

All my thesis' are aimed around quantum computing

orchid vortex
#

Its ambitious but it's what i like

visual juniper
visual juniper
pallid garden
#

i wish i had that much money for tuition

visual juniper
#

altho i dont imagine you would be doing much of "quantum" stuff for your current degree ....
definately would be good to do the math part tho , will strengthen your math knowledge

pallid garden
#

strengthen... is an understatement

orchid vortex
orchid vortex
pallid garden
#

when i took my first qm course, almost every symbol in the equations in the textbook is completely new to me

#

even after having taken all the freshman maths

visual juniper
pallid garden
orchid vortex
#

I have to relearn python fully once more, more than I used to know

visual juniper
# pallid garden that's what they have now i think?

im not sure , it sounded a lot with all the calc , lin alg and quantum stuff ๐Ÿ˜…

im talking about a simple math equation parser
like , user will input (4-5)*6/4 and you will do the math and spit out an answer

pallid garden
orchid vortex
#

For example I want to give it 3 vectors then evaluate its projection through gram Schmidt

#

Then plot said projections

visual juniper
#

what is gram schmidt

orchid vortex
visual juniper
#

ahhhh finding perpendicular vectors , okok

pallid garden
#

i had to look it up too haha

visual juniper
orchid vortex
#

I want it to find a contour integral and plot it, find convergence and divergence in an infinite series, find the saddle point, find stationary point

visual juniper
#

making a GUI , drawing plots , is not exactly a beginner project
start with more like , introduction to functions , while loops , if else statments and go from there

orchid vortex
#

These things that I work with, wave functions with Fourier transform

orchid vortex
#

I recall them having kinship

pallid garden
visual juniper
#

knowing a prior programming language definately helps

bright mauve
#

i'd say yes. if you know matlab, you basically already know numpy and jax

orchid vortex
#

I know Java as well but it's uh we don't talk about java

bright mauve
#

i also came from cpp and matlab to python

orchid vortex
#

And HTML which is pretty useless right now

orchid vortex
#

Arduino for me was just circuit based and improper coding

#

Java was its own thing

bright mauve
#

there are books on numerical differential eqs and numerical mwthods in python, as well as statistical methods for ai in python. all those should help both with math and programming

#

i think ml-oriented references are pinned in the data science channel, maybe check that out

orchid vortex
#

All I truly need now is not getting deterred

pallid garden
#

all the best!

orchid vortex
#

Or demotivated

orchid vortex
#

This was all a big help

orchid vortex
#

My first goal should be force analysis calculations, just simple giving it parameters, complex numbers, matrices eigen vectors, and triple integrals

oblique spindle
#

Why are some questions in coding competitions just troll? ๐Ÿ˜ญ I literally saw a replay of AOC Day 12 today. the despair

#

:0

spice hill
#

!cleanban @golden wraith some sort of scam

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @golden wraith permanently.

verbal wedgeBOT
#

nyumewicaw mewthods ducky_cat

oblique spindle
#

Thanks I was waiting for it

spice hill
#

@spice hill test

spice hill
verbal wedgeBOT
#

@deweted-usew test

bright mauve
#

get deleted, punk

eager smelt
#

*deweted

oblique spindle
#

Btw It was a discord invite link probably to his server ๐Ÿคฃ

orchid vortex
#

Wonder what they get from this

#

Its quite deigning

arctic phoenix
orchid vortex
#

Its just ideas right now came ti get advice

#

I have some code but it's just basic calculations and a mobius plot

#

Unrelated to the task just a bit of practice

celest tendon
#

๐Ÿ˜ญ

oblique spindle
#

Iโ€™ll be helping you resolve this issue today. Kindly provide your wallet address so we can check what the problem is and advise you on how to fix it. If you have the transaction hash (TX), please provide that as well. If you don't have it, that's fine. If your issue is unrelated to the wallet, please specify what the issue is so we can assist you further. While I check what the problem is, please stay in your ticket so you don't lose it. Thank you!
.
lmao wtf , got greeted with this message upon joining , ๐Ÿคฃ

oblique spindle
#

people expect programmers to be this dumb?

past grove
#

Come on, let's share our homemade programs, small ones are fine, and we'll understand together.

autumn forge
oblique spindle
#

and upon knowning I don't have crypto I got insta banned ๐Ÿคฃ

spice hill
oblique spindle
shrewd pine
#

Found a fun python snippet in a blog. Let's play "what does this code do?"

def foo():
  try:
    return os._exit()
  finally:
    return False

import os
foo()
spice hill
#

raises a SyntaxWarning?

velvet hull
#

It doesn't need to be money

hybrid nebula
shrewd pine
spice hill
#

People get phished all the time, even for a few cents of value that their account provides to spread scam messages

hybrid nebula
hybrid nebula
shrewd pine
#

that's what I thought, but it's sillier

hybrid nebula
#

?

velvet hull
shrewd pine
#

!d os._exit

edgy krakenBOT
#

os._exit(n)```
Exit the process with status *n*, without calling cleanup handlers, flushing stdio buffers, etc.

Note

The standard way to exit is [`sys.exit(n)`](https://docs.python.org/3/library/sys.html#sys.exit). `_exit()` should normally only be used in the child process after a [`fork()`](https://docs.python.org/3/library/os.html#os.fork).
shrewd pine
#

It takes an argument

#

it's a TypeError

eager smelt
#

oh

shrewd pine
#

so the finally is run

hybrid nebula
#

๐Ÿ’€

#

wait do we have

#

aw

spice hill
frank sinew
#

Best platform to practice pyhton on? or best platforms to search for pyhton projects? to master python

oblique spindle
hybrid nebula
hybrid nebula
ember quest
#

notepad people are crazy

small torrent
ember quest
#

at least i get it wit vim

#

and im sure vim opens faster

frank sinew
eager smelt
small torrent
bronze dragon
ember quest
hybrid nebula
hybrid nebula
frank sinew
spice hill
oblique spindle
ember quest
#

notepad++ doesnt have such weakness (lsp)

frank sinew
#

do any of you have participated in offline hackathons?

hybrid nebula
oblique spindle
#

Imagine there was a extension which has all snippets ever known to man. idk why I've to download seperate for html, css, js , C, Python and maybe someone made a Django snippets extension

oblique spindle
eager smelt
hybrid nebula
#

We should all use GNU ed

hybrid nebula
spice hill
#

pyright will definitely take a while to load once your workspace (not just file) goes beyond 10k lines or so

eager smelt
#

I'm using ty

spice hill
#

maybe syntax highlighting will still work

#

Ah, Todo based language server brainmon

eager smelt
#

real

#

and also ruff, forgot about that

oblique spindle
#
    
    }``` this is a snippet for c you get this immediately as soon as you write `for`
spice hill
#

It's probably usable if you don't use generics a lot

#

Do people actually find those snippets useful?

eager smelt
#

probably some did

small torrent
#

How far has ty and zuban come ?

oblique spindle
eager smelt
#

I like snippets

spice hill
#

Actually, I do use the html:5 snippet in VSCode

oblique spindle
#

closing the brackets , etc

eager smelt
hybrid nebula
oblique spindle
#

if I'm calling .split I probably want it called . imagine forgetting () and fixing it

velvet hull
#

Yo can I ask if participating in hackathons is worth?

eager smelt
hybrid nebula
oblique spindle
eternal ridge
#

does anyone in here know how to add python to path becaue why are there a whole bunch on ways to download that thing

hybrid nebula
eternal ridge
#

like 200 ways to download python and the advice on youtube is straight garbage

jaunty dome
#

whats the use of termux

sand jewel
jaunty dome
#

I have been using it since 2024 for editing and download streams

jaunty dome
ember quest
oblique spindle
ember quest
#

prolly just get your package manager to do it if youre comfortable with that

sand jewel
ember quest
#

or else get the installer...

cinder steeple
#

need some views thx

jaunty dome
swift sandal
#

Guys! how did you improve your logic in Python? I practice but still feel stuck uhh Any advice???

oblique spindle
#

do people like getting banned doing promotion even though server says to not do it?

jaunty dome
#

thats it?

small torrent
jaunty dome
#

now we can write codes?

oblique spindle
jaunty dome
sand jewel
ember quest
oblique spindle
ember quest
#

its just the way life is

#

but if your code is shit then yes practice

jaunty dome
autumn forge
ember quest
#

well in general its practice too but the difference is that there isnt a problem there

swift sandal
ember quest
#

thats it

sand jewel
bronze dragon
ember quest
#

cuz being able to see what other people came up with is hella fun

swift sandal
sand jewel
ember quest
swift sandal
eternal ridge
small torrent
ember quest
#

try to write less shit code i guess

jaunty dome
#

it started

ember quest
#

you can post code here in help channels and ask for reviews

jaunty dome
#

I thought we can only use ffmpeg in termux

bronze dragon
swift sandal
eternal ridge
swift sandal
ember quest
jaunty dome
#

any experience python coder here?

ember quest
bronze dragon
ember quest
#

good question

swift sandal
bronze dragon
#

no, a specific problem

ember quest
#

well maybe dont use gpt

#

thats always solid advice

swift sandal
jaunty dome
#

can you tell me how do you learn python so good?

rancid quail
#

practice?

ember quest
jaunty dome
#

๐Ÿ˜ญ๐Ÿ˜ญ

rancid quail
#

there's no cheat code bro

jaunty dome
#

How to do that?

rancid quail
#

just practice and time

jaunty dome
#

how to practice??

rancid quail
ember quest
half pewter
#

I can suggest some beginner projects if you're looking for ideas

jaunty dome
#

How can I keep learning, and is there any good free course?

rancid quail
swift sandal
# bronze dragon no, a specific problem

Given a string, find the first non-repeating character.
Find the missing number from 1 to N when one number is missing in the list.
Move all zeros in a list to the end while maintaining the order of other elements.
Implement your own min() function logically without using min().
Check if a sentence is a pangram (contains all letters a to z).
Given a matrix, print its elements in spiral order.
Implement binary search logically without built-in functions.

(yesterday chatgpt give me this problems)

jaunty dome
#

yesss

#

I do

#

but I'm not professional

rancid quail
# jaunty dome yesss

well then, go make a discord bot or whatever and you'll learn a lot more than just being stuck in tutorial hell

bronze dragon
azure spear
rancid quail
eternal ridge
#

Man Icl this discord is so buns

jaunty dome
#

Discord bot!!! I don't to how to make that ducky_skull

swift sandal
bleak moth
#

Yo! New CoreDumped video on the GIL just dropped.

bronze dragon
ember quest
rancid quail
jaunty dome
#

actually I'm 13, but wanted to learn python so hardddddddddd

ember quest
bronze dragon
rancid quail
ember quest
bleak moth
oblique spindle
dry pike
bleak moth
#

And started learning C++

rancid quail
jaunty dome
bleak moth
ember quest
bleak moth
#

I'm 37

ember quest
#

think of it from a beginners perspective

jaunty dome
#

๐Ÿ˜…

rancid quail
swift sandal
bleak moth
azure spear
bleak moth
#

Right on!

jaunty dome
rancid quail
jaunty dome
bleak moth
bronze dragon
# ember quest i said relatively

well, relative to what? I think it's a perfectly fine exercise in programmatic thinking for a beginner. it's a simple task, and they already know how to solve it instinctively, they just need to be able to turn it into a series of steps.

bleak moth
#

He's playing XBox right now

jaunty dome
#

what type of bot should I made

bronze dragon
dry pike
bleak moth
bleak moth
steel whale
ember quest
#

i think its harder than the pangram one

#

unless you dont know enough data structures

oblique spindle
#

well I remember implementing max then realizing max exists , same with maps
like many comprehensions still now are like [int(i) for i in list1]

rancid quail
steel whale
celest tendon
#

|| ๐Ÿ˜ญ ||

dry pike
swift sandal
#

Worth it na?

azure spear
# jaunty dome what type of bot should I made

Discord already has a ton of bots out there. If it isn't a bot for playing mini-games and stuff like that, then I don't know. But apart from Discord bots and videogames, for what else can I use Python?

celest tendon
spice hill
bronze dragon
# ember quest i think its harder than the pangram one

really? to solve the pangram one sanely you need either a dictionary, or if not that then a list where you map character codes to indices (which further needs you to know about ord...)
meanwhile you can create min using one for loop, one variable, and one if condition.

oblique spindle
bleak moth
#

Python Crash Course by Eric Matthes is what allowed me to learn the language

bronze dragon
bleak moth
#

Then again, I was already a programmer when I read that

ember quest
bleak moth
#

I'm not sure how easy it would make things for a beginner.

bronze dragon
#

it's not about how much of a cool oneliner you can make it with all your knowledge of Python, but how hard it would be for a beginner to solve

ember quest
#

well if we discount the existence of data structures then yeah min is easiest

celest tendon
jaunty dome
#

Is it possible to make bot in Phone ๐Ÿ“ฑ

swift sandal
# spice hill ?

Is it worth reading a book..? istead of only working hard.. can we work smart by using AI to understand Python?? Uhh I. Might be wrong

bronze dragon
azure spear
rancid quail
jaunty dome
spice hill
bronze dragon
rancid quail
# jaunty dome yup

then you can maybe jail break and get to the linux layer and then write a python from therem good luck coding with such small screen tho

swift sandal
wise yarrow
#

binary search is a decent exercise tho

#

a few surprisingly subtle details

jaunty dome
oblique spindle
rancid quail
spice hill
#

Using an LLM could theoretically be smart if it has a lot of training data on something that doesn't have thousands of good comprehensive books/guides written by humans already

bleak moth
oblique spindle
bleak moth
#

Congratulations @azure spear, You're a programmer! ๐Ÿ™‚

azure spear
swift sandal
#

Fck it. I'm in. Thank you.. @bronze dragon I appreciate your help. GN

bleak moth
spice hill
#

ipad for half the price of a laptop? that's new

oblique spindle
azure spear
bleak moth
spice hill
#

laptops don't have the extreme size and weight constraints of tablets, so it's going to be cheaper for the same performance

#

(and probably more repairable)

azure spear
oblique spindle
bleak moth
oblique spindle
#

._.

fathom pasture
#

what is standard way of making interface(OOP) in python? or is there better alternative, my usecase is that I have a file which classes which are exposed for normal use and there are 2 other which implements those classes for unix and windows differently

cobalt flax
#

Apparently for else statements are outdated

#

Idk why they work fine to me

bronze dragon
oblique spindle
bleak moth
rancid quail
cobalt flax
#

Cuz i sent my code here and then someone was like "this is the first time i've seen someone use for else unironically"

rancid quail
#

guys I think the whole of programming might be oudated ngl

cobalt flax
#

oh ok

cobalt flax
#

then ima keep usijg em ig

fathom pasture
bronze dragon
#

I've only had to use it a small handful of times so far

deep temple
#

what is the differene between .+ and ..+ in regex?

azure spear
bronze dragon
#

but it's cool when you can find an application

cerulean ravine
cobalt flax
spice hill
cerulean ravine
cobalt flax
#

But like whatever it looks fun

#

I want my code to look colorful

bleak moth
#

It's not exact code, but that's the idea

#

And it's awesome

deep temple
spice hill
bleak moth
#

No more tables, no more flexboxes, document content and layout are completely separated

bronze dragon
bleak moth
#

Which means that you can use media queries to completely change the layout

rancid quail
deep temple
bleak moth
#

The conversation is going too fast to not use them I see

#

Normally that works fine

#

The slowmode timer isn't helping

fathom pasture
# spice hill What do you need them for? Can you show the code maybe? You don't have to create...

my usecase is something like this:
exposed.py

class IMyClass:
    def a(self, x: int, y: str) -> float: pass
    def b(self, x: int, z: float) -> float: pass

unix.py

class MyClass(IMyClass):
    def a(self, x: int, y: str) -> float: # impl for unix
    def b(self, x: int, z: float) -> float: # impl for unix

win32.py

class MyClass(IMyClass):
    def a(self, x: int, y: str) -> float: # impl for win32
    def b(self, x: int, z: float) -> float: # impl for win32
bronze dragon
fathom pasture
spice hill
fathom pasture
# bleak moth Why's that?

I can just export the classes implementation based on the os via __init__.py
something like:

import os
if os.name=='nt':
    from .win32 import *
else:
    from .unix import *```
#

and since my current usecase doesn't require that strictness I think I can go without it

bleak moth
#

You're finding that "YAGNI"

#

(You Aint Gonna Need It)

fathom pasture
#

I am already overengineering this thing(intentionally)

bleak moth
fathom pasture
#

now what is yaks

spice hill
#

Just make sure both classes are accessible in some way on any OS. For example, I can mention pathlib.WindowsPath on Linux, even if pathlib.Path does some auto-detection

fathom pasture
deep temple
#

why does just a plain * not work in regex?

bleak moth
# fathom pasture now what is yaks

I got it from a book called "The Productive Programmer" which is an excellent book every programmer should read, but that aside, it's basically a perceived dependency chain. "Well, before I can do that I need to do this, and before I do that I need to do this, and before I do that, I need a Yak, but before I can use the Yak, I have to shave it...."

deep temple
#

why .*?

steel whale
bleak moth
#

You endevored to milk the cows and somehow you're shaving a yak instead

oblique spindle
#

what's the difference btw sys.stdin and input?

autumn forge
rancid quail
#

earthquakeee

cerulean ravine
# deep temple why .*?

star means, zero or more of a thing. You have to specify the thing. in .* the thing is "any single character".

spice hill
# deep temple why .*?

Because you can specify what pattern you want to repeat. For example a* means "a repeated zero or more times".

bleak moth
fathom pasture
deep temple
steel whale
spice hill
steel whale
#

and stdin has binary support thru .buffer

autumn forge
oblique spindle
steel whale
cerulean ravine
oblique spindle
cerulean ravine
unborn lagoon
autumn forge
steel whale
spice hill
fathom pasture
cerulean ravine
oblique spindle
#

meh

#

I hate myself

bronze dragon
#

main difference IMO is that input is built for interactive usage - it supports printing a prompt before taking input
if you need to like read all of stdin for a CLI program, then I would consider messing with sys.stdin

cerulean ravine
civic frigate
#

does anyone know cheap vps hoster?

deep temple
oblique spindle
#

I went back to that page and saw

deep temple
oblique spindle
#

Idk why I'm reading 7 year ago posts on performance

bronze dragon
fathom pasture
oblique spindle
#

I hope they don't think my submission is AI ๐Ÿคฃ

#

AI wouldn't even be that dumb to use sys.stdin

#

Too much stress made me believe rumours

bleak moth
tame hinge
bronze dragon
#

idk if I had to read all of stdin I think I would unironically use sys.stdin

fathom pasture
bronze dragon
#

As opposed to interactive usage

deep temple
#

also what does ^$ do in regex , when i look up its use in the documentation I get incomprehensible info

spice hill
# deep temple also what does ^$ do in regex , when i look up its use in the documentation I ge...

https://docs.python.org/3/library/re.html

`^`
    (Caret.) Matches the start of the string, and in MULTILINE mode also matches immediately after each newline.

`$`
    Matches the end of the string or just before the newline at the end of the string, and in MULTILINE mode also matches before a newline. foo matches both โ€˜fooโ€™ and โ€˜foobarโ€™, while the regular expression foo$ matches only โ€˜fooโ€™. More interestingly, searching for foo.$ in 'foo1\nfoo2\n' matches โ€˜foo2โ€™ normally, but โ€˜foo1โ€™ in MULTILINE mode; searching for a single $ in 'foo\n' will find two (empty) matches: one just before the newline, and one at the end of the string.
``` what parts are unclear?
tranquil tinsel
oblique spindle
bronze dragon
fathom pasture
fathom pasture
#

also you would use it when you want ansi chars to work on older versions of windows without any 3rd party lib...... you would intercept to convert ansi char to win api calls

deep temple
deep temple
steel whale
deep temple
#

wont it work normally?

tranquil tinsel
steel whale
oblique spindle
#

lets change the topic I already accepted I'm dumb

#

๐Ÿคฃ

fathom pasture
#

and yeah the difference will be more noticeable on slower machines

steel whale
fathom pasture
celest tendon
#

๐Ÿ˜ญ

spice hill
steel whale
bronze dragon
steel whale
bronze dragon
#

I'm asking what method of sys.stdin you used

oblique spindle
bronze dragon
#

I expect reading the entire thing in one go will be much faster than reading line-by-line

fathom pasture
steel whale
#
#!/usr/bin/env python3
import sys
import time
start = time.time()
count = 0
for line in sys.stdin:
    count += 1
end = time.time()
print(f"sys.stdin: Read {count} lines in {end - start:.4f} seconds")```
shrewd pine
steel whale
#

im lagging omfg

spice hill
# spice hill It doesn't

^ and $ are typically used when you're passing a regex to some generic program that always uses re.search or the equivalent.

Or if you want to only conditionally require that something is at the start. For example, apple|banana$|cherry will find apple in I like apples, cherry in I have a cherry in my pocket, and I am a banana. But it will not match I like bananas because banana is not followed by the end of the string

Or if you're using multiline mode (honestly, not a fan of this flag changing how fundamental things behave).

deep temple
gilded tide
#

any one of u guys do leetcode? need help in the help sec, thanks

dusky crag
#

what are the function() -> None text called?

spice hill
bronze dragon
deep temple
fathom pasture
fathom pasture
shrewd pine
spice hill
edgy krakenBOT
spice hill
#

which I just learned about

deep temple
shrewd pine
#

though I think that's a setting

gaunt badge
#

re.MULTILINE?

spice hill
#

That's some hot spaghetti if you ask me.

shrewd pine
#

eww

gaunt badge
#

I'm always confused by re.match, which implies a ^, but not a $.

craggy trench
#

i think you can also use \A...\Z for absolute start and end

shrewd pine
shrewd pine
#

because why have obvious names

#

when an ambiguous ones does the job

deep temple
shrewd pine
#

no?

spice hill
# deep temple whole string meaning in this case just a word?

re.search performs "substring search". If the pattern is banana, it will find a match inside apple banana cherry.
If you use ^apple as the pattern, apple will be found. But if you use ^banana as the pattern, it will not be found, because it's not at the start of the string

The correct solution in this case is to use re.fullmatch instead of re.search which the lecturer introduces later in the lecture.

gaunt badge
shrewd pine
#

I don't mind fullmatch as a name

spice hill
#

Oh yeah, re.match is such a misnomer

#

it's almost never what you want

#

should've been called prefix_match or something like that

shrewd pine
#

but re.match really should be re.prefixmatch

gaunt badge
#

Yeah

shrewd pine
spice hill
#

right, we use smashedtogethercase in this house

deep temple
spice hill
civic frigate
tame hinge
spice hill
shrewd pine
#

fun thing that happened at work, I saw "" being used as a regex in a functional test that does partial regex matching

someone added validation on the provided regex that it should be non-empty

this broke a bunch of automated processes because these tests started erroring out

#

I can't blame the people adding the validation

#

any sensible expectation would have a non-empty regex, rather than something that's just always true

#

the check was also named something like RegexEmpty which does not fill me with confidence

pure orbit
#

my dislike for how arcane regexes are has come to a middle

#

see also: SQL syntax; something about the idea of composing a program in terms of what you want instead of how it gets done just fundamentally disagrees with my brain

spice hill
#

I think the idea of regexes is great, but there are many problems with the existing implementation[s]

deep temple
#

Will AI become advanced enough to replace coders in the future?

harsh anchor
#

maybe

deep temple
#

like getting replaced

harsh anchor
#

become even more advanced (go even further beyond)

deep temple
#

learn how to build AI models?

gaunt badge
spice hill
spice hill
#

I was able to figure out that a particular service was written in Go because it showed \d as part of a regex but rejected a non-ASCII digit

#

(random trivia)

#

what I meant to say is, treat regexes as source code because they are source code

pure orbit
#

when I write regexes I try to split them into multiple lines with comments

spice hill
#

I think that's a good idea

#

(the re.VERBOSE thing)

cerulean ravine
#

I recently wanted to use re.VERBOSE, but couldn't because the pattern was going to be interpolated later into a larger pattern ๐Ÿ™

cerulean ravine
tidal totem
#

Anyone here good at langchain?

cerulean ravine
spice hill
#

!e

import re

pat = re.compile("foo|bar|(?x:b a n a n a)")
print(pat.fullmatch("banana"))
edgy krakenBOT
spice hill
#

works for me

cerulean ravine
glacial leaf
#

can i overwrite another module's function

steady rain
glacial leaf
#

amazing

formal lintel
#

hello python

cerulean ravine
formal lintel
#

why is server icon blue?

#

why no fancy color?a

dry pike
#

because there are no fancy things going on

formal lintel
#

arent you guys celebrating christman or new year

spice hill
# cerulean ravine thanks!

That's another annoying issue with regex sigils. You can swap two characters and break everything. I frequently write ?!< instead of ?<!

pure orbit
glacial leaf
# spice hill `(?x:)`

i discovered that for named groups, python has to have the python regex exclusive thing

glacial leaf
#

maybe i could make my code better in order to not do this lolz

pure orbit
glacial leaf
spice hill
#

the monkey is very exhausted

#

have mercy

#

I think monkey-patching for tests is a pretty common thing in Python. Because dependency injection is a pretty foreign concept and many people don't seem to like it

glacial leaf
bronze dragon
glacial leaf
#

i celebrated christmas on the 24th, for no reason i have to tell you guys

cerulean ravine
glacial leaf
cerulean ravine
#

I just had a fix accepted to typeshed! ๐Ÿ™‚

spice hill
#

I have a fix to typeshed stuck for months ๐Ÿ˜ฉ (since oct 1)

eager smelt
#

duality of open source

charred python
#

Typeshed fixed me.

spice hill
#

it is admittedly a bit more complex

glacial leaf
formal lintel
#

m late then

cerulean ravine
spice hill
#

maybe because you're a core dev and not some random guy with default github avatar

cerulean ravine
spice hill
#

I don't mean that as throwing shade or anything

#

there are finite maintainer resources and many open PRs

glacial leaf
#

i should change my github avatar

spice hill
#

If I had PRs from gvanrossum and bananaenjoyer69000 I'd review Guido's PR first

glacial leaf
#

why is webp so damn unsupported

cerulean ravine
glacial leaf
#

i feel like literally everywhere, like now when i tried uploading a new github avatar

eager smelt
#

WebP is unsupported, what?

unborn lagoon
#

it's not as supported as say, PNG or JPG, but webp support has definitely improved

spice hill
#

i did it the other way around, importing my github avatar to discord

glacial leaf
#

even the image editor tools on windows dont support webp

glacial leaf
spice hill
#

at first I was confused what liver coding is

glacial leaf
spice hill
#

is that when you have a beer while programming

frank sinew
#

best youtube video which provide 5 star quality pyhton tutorials like for oops

glacial leaf
oblique spindle
#

guys why x//y is a float and not an int? because it should always be an int then why is it treated as a float?

eager smelt
#

what is x? what is y?

oblique spindle
#

I can understand about x/y that it sometimes returns a non integer hence it is assumed as a float

eager smelt
#

show code

cerulean ravine
harsh swallow
#

Then it's always an integer.
// will only be a float when either side is a float.

oblique spindle
#

oh nvm*

#

x was float

eager smelt
oblique spindle
#

but still I'm confused shouldn't it still always be a int?

harsh swallow
glacial leaf
cerulean ravine
glacial leaf
#

future division

dry pike
#

// is floordiv, not "intdiv"

harsh swallow
oblique spindle
harsh swallow
glacial leaf
#

passing a variable into a function and then accessing it after gives me rust vibes

oblique spindle
glacial leaf
#

&mut ahh

vale pineBOT
#
Command not found

Command "mut" is not found

oblique spindle
spice hill
#

damn, Python functions have arguments, that's just like rust

harsh swallow
edgy krakenBOT
#

float.is_integer()```
Return `True` if the float instance is finite with integral value, and `False` otherwise:

```py
>>> (-2.0).is_integer()
True
>>> (3.2).is_integer()
False
dry pike
#

generally, if one of the operands is a float, then the result is a float

quartz fulcrum
spice hill
dry pike
oblique spindle
#

learnt something new today

glacial leaf
merry citrus
#

guys can u tell me how is my code as an beginer

num1=int(input("EnterFirstNumber:"))
num2=int(input("EnterSecondNumber:"))

oper=(input("EnterOperator:"))

if oper=="+":
res=num1+num2
print(f"res={res}")

elif oper=="-":
res=num1-num2
print(f"res={res}")

elif oper=="":
res=num1
num2
print(f"res={res}")

elif oper=="/":
res=num1/num2
print(f"res={res}")

elif oper=="%":
res=num1%num2
print(f"res={res}")

charred tusk
#

!code

edgy krakenBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

merry citrus
#

ight

dry pike
#

could be better

jaunty dome
merry citrus
#

hm

vagrant horizon
#

Still water + adrenaline + noradrenaline + hawk tuah + anger issues + balkan parents + english or Spanish + german stare + Balkan rage + jonkler laugh + phonk +Belgian edging + Baltic farting + bulgarian scratching + aggressive slovakian jelqing + polish footjob + indian respect moment those who know + Opponent uses Jamaican Smile + Russian Frown + Finnish wave + Icelandic blink + Thai grin + Hungarian punch + Swiss climb + Argentinian flex + Chilean dance + Peruvian squat + Kenyan grin + Jamaican jump + Russian slide + Filipino stretch + Balkan climb + Greek dash + Egyptian tilt + Vietnamese sit + American hop + Pakistani stomp + Hungarian march + Italian march + Japanese snap + German slide + Irish dash + Brazilian whistle + Turkish flick + French leap + Korean twist + Canadian clap + Indian bow + Nigerian stare + Italian kick + Chinese lean + Scottish grin + Mexican swing + Swedish dash + Moroccan leap + Ukrainian stretch + Danish whistle + Finnish kick + Icelandic jump + Thai clap + Hungarian dash + Swiss stretch + Argentinian whistle + Chilean wink + Peruvian hop + Kenyan sprint + Jamaican whistle + Russian clap + Filipino nod + Balkan bend + Greek run + Egyptian squat + Vietnamese smile + American point + Pakistani twist + Japanese wink + German bow + Irish hop + Brazilian cheer + Turkish skip + French flex

vagrant horizon
steady rain
oblique spindle
#

talking about it does math have the upper floor function?
like which rounds up regardless
lower floor + 1 doesn't work on integers and I'm feeling pretty lazy rn

jaunty dome
vagrant horizon
merry citrus
dry pike
#

gonna start calling the ceiling the "upper floor" now

oblique spindle
dry pike
#

in a building with two stories, the upper floor would be the 2nd story

steady rain
dry pike
#

britain isn't real

steady rain
#

no, it's the US state that purportedly contains Seattle that isn't real.

cosmic moat
#

Excuse me, I'm trying to find a way to read from a public Google document. Is there a simple way to do that? Or do I have to work with service accounts and such?

quartz fulcrum
#

Is it a bad idea to talk about goals..
i heard that talking about your goals make it difficult to achieve

steady rain
glacial leaf
pulsar dragon
#

Hi

#

Guys

steady rain
oblique spindle
flat moon
#

@woeful lark jsi v rbx ptk_dan61

stray crest
#

not an American btw

cosmic moat
steady rain
# glacial leaf what were you stating then

at least in the US, floor numbering starts at 1. In Britain, and possibly other places, it starts at Ground, and then 1. Neither one is inherently more natural than the other.

quartz fulcrum
#

My all doubts are solved by the GEMINI OR CHATGPT.
Does anyone feel the need to ask for doubts in python discussion channel?

steady rain
steady rain
# glacial leaf yes

and I'm saying, neither one is inherently more natural. it's just two different systems.

quartz fulcrum
unborn lagoon
steady rain
quartz fulcrum
glacial leaf
unborn lagoon
steady rain
spice hill
#

AI is like an overconfident intern. Its output is often wrong in subtle ways

bronze dragon
glacial leaf
#

AI just doesn't act like a human and i kinda desire the need to talk to one

quartz fulcrum
#

specially gemini 3 pro

spice hill
quartz fulcrum
#

but in last version..
i got slightly wrong results of maths questions...but now they claim to be a PHD level LLM

cerulean ravine
glacial leaf
quartz fulcrum
glacial leaf
spice hill
cerulean ravine
quartz fulcrum
cerulean ravine
charred python
#

I trust ned more than a robot.

sand jewel
jaunty dome
#

146 aqi here

quartz fulcrum
cerulean ravine
pastel sluice
#

@quartz fulcrum learning how to ask good questions of other people is a skill worth developing, it'll pay big dividends

dusk adder
spice hill
charred python
#

And another human forcing you to explain yourself leads to revelations.

fervent matrix
spice hill
fervent matrix
#

Whats the correct answer there?

dusk adder
slate wren
#

๐Ÿ‘‹

spice hill
#

https://docs.python.org/3/library/re.html

$
Matches the end of the string or just before the newline at the end of the string, and in MULTILINE mode also matches before a newline. foo matches both โ€˜fooโ€™ and โ€˜foobarโ€™, while the regular expression foo$ matches only โ€˜fooโ€™. More interestingly, searching for foo.$ in 'foo1\nfoo2\n' matches โ€˜foo2โ€™ normally, but โ€˜foo1โ€™ in MULTILINE mode; searching for a single $ in 'foo\n' will find two (empty) matches: one just before the newline, and one at the end of the string.
This is why in reality, is_digit("123\n") is True.

dusk adder
#

and im guessing "123\nืฉืœื•ื" too?

spice hill
#

No, that doesn't match, because the \n is not at the end

dusk adder
#

ah

#

$ working up to \n is weird tbh

spice hill
#

yeah, as I said, I only learned this today

#

very cursed behaviour

pulsar dragon
#

Guys I have problem in my wife

quartz fulcrum
#

wife

tame hinge
#

๐Ÿ˜ญ ๐Ÿ˜ญ

bleak moth
pulsar dragon
bleak moth
#

What's the problem?

pulsar dragon
charred python
#

Have you tried turning her off and on again?

pulsar dragon
tame hinge
silver plover
#

!warn 1432496795858112566 This is "Python Discussion". Stick to the topic.

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied warning to @pulsar dragon.

fervent matrix
#

.topic shall be summoned

verbal wedgeBOT
#
**If you could change one thing in Python, what would it be?**

Suggest more topics here!

spice hill
#

rename re.match to re.prefix_match

dusk adder
# verbal wedge

all the camelCase function names strewn about here and there

fervent matrix
bronze dragon
tame hinge
# verbal wedge

Bytecode compilation optimizations, i.e. in lining of functions.

spice hill
pulsar dragon
spice hill
#

It's obviously never going to change, no PEP is needed to figure that out. But yeah.

harsh anchor
fervent matrix
tame hinge
spice hill
charred python
#

Every language needs a few inconsistencies. Feels wrong without them.

bleak moth
# verbal wedge

I would definitely make it so that you can pass an entire function body as a lambda.

unborn lagoon
fervent matrix
harsh anchor
#

it doesn't really

bleak moth
#
my_function = lambda (a, b, c):
  a.foo = "bar"
  b.foo = "baa"
  c.foo = "baz"
river needle
#

๐Ÿ‘‹

dusk adder
#

and tKinter iirc

cobalt flax
#

alright im learning dictionaries today

#

they just seem like a bunch of variables stored in one place that you can refer to at will

#

why would you need this

#

instead of just using variables

bleak moth
unborn lagoon
charred python
#

Dictionaries are a key part of python with a lot of value.

cobalt flax
harsh anchor
pulsar dragon
cobalt flax
#

it just feels less important than other features

harsh anchor
harsh anchor
# cobalt flax i guess its better for organizing

not only is it more organized, you can edit and access it dynamically, whereas you can't with variables. for example, you could read a dictionary from a file, and look up values in it. if you try to do that with just variables, you'll have a tough time

harsh anchor
quartz fulcrum
#

can anyone tell me what field required learning all data structures in python?

bleak moth
# cobalt flax whats a case statement?
match bar:
  case "blah":
    foo = "some value"
  case "foo":
    foo = "some other value"
  case "bar":
    foo = "some other other value"

or

foo = bar[thing] # returns the value you want
tame hinge
#

Random question, do you ever make a dictionary with duplicate items under different keys? Like if I have a bunch of user objects with IDs and emails and I want quick lookup based on either would it be a thing to put it in under both?

harsh anchor
#

i would do separate dicts. or perhaps key it with a frozenset

bleak moth
#

you would create objects that have the subdata, and then key the dictionary to how you want to look it up

tame hinge
#

Fair that sounds cleaner

cobalt flax
dusk adder
cobalt flax
#
codeWordsForChristmasMission = {
    "THE RED CLAW" : "Santa Claus",
    "LITTLE LAMB" : "Present Delta",
    "GRAZE VICTIM" : "Christmas Tree"
}

print(codeWordsForChristmasMission.get("GRAZE VICTIM"))
cobalt flax
#

alr so thats a dictionary

charred python
#

Either way. A single dictionary cam make sense since you want a single lookup. But two dictionaries can also make sense if you want to track whether the match was made by id or email.

Also there is a merged dict that does this for you.. i forget the exact name

cobalt flax
#

reindeer

#

hah

#

christmas santa reindeer elf stocking milk cookies

bleak moth
cobalt flax
bleak moth
#

And by the way, that thing can also be a function

cobalt flax
#

Ohh interesting

#

If i try to get a key that doesnt exist instead of returning an error it just says "None"

#

btw what is "returning" exactly like i dont get the whole .pop thing

#

hm saying ```py
print(codeWordsForChristmasMission.pop("LITTLE LAMB"))

#

just returns the value associated with little lamb

#

OHhhhhhhhhhhhhh

#

it removes it but after telling u what you're removing

#

aha that makes sense now

#

AHA AND NOW SAYING THE SAME STATEMENT AFTER RETURNS AN ERROR

bleak moth
#
def add(a, b):
  return a + b
def sub(a, b):
  return a - b
def mul(a, b):
  return a * b
def div(a, b):
  return a / b

operators = {
  "add" : add,
  "sub" : sub,
  "mul" : mul,
  "div" : div
}

operation = input("Pick an operation [add, sub, mul, div]: ")
a = float(input("Pick a value: "))
b = float(input("Pick another value: "))
print(f"Your result is: {operators[operation](a, b)}")
cobalt flax
#

whats that useful for??

cobalt flax
#

couldnt you also define the functions within the dictionary?

#

or is that just too messy innit

dry pike
#

they would have to be lambdas

bleak moth
bleak moth
steady rain
#

!e

import operator
operators = operator.__dict__
result = operators['add'](1, 2)
print(result)
edgy krakenBOT
bleak moth
#

You can use a lambda though

cobalt flax