135201
You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
Python Quiz: The "Late Binding" Trap 🐍
Let’s test your understanding of Python closures and scoping. What is the output of the following code snippet?
def create_multipliers():
multipliers = []
for i in range(5):
def multiplier(x):
return x * i
multipliers.append(multiplier)
return multipliers
funcs = create_multipliers()
print([f(1) for f in funcs])
[0, 1, 2, 3, 4][4, 4, 4, 4, 4][0, 0, 0, 0, 0]
Читать полностью…
Check out @PythonRes, a channel for Python resources - video courses, pdf books, tutorials and other info to help you learn Python.
Читать полностью…
how do you jump from python basics to cyber security?
Читать полностью…
this is a python chat, not a cyber security chat, go to @pythonofftopic
Читать полностью…
This is an off topic question, go to @pythonofftopic
Читать полностью…
Can I get a Sugesssion:-
Why they say to use @dataclass, even i think to use pydantic 's BaseModel to represent data in my domain entities, even i will use pydantic all over my repo as a must need library for working with class easily.
Hello i am getting frastrutated to use Alembic today newly in a new repo:
1st:-> alembic init --template pyproject alembic
after i run this command it generate a alembic/env.py in the file i edited this:
from sqlmodel import SQLModel
from models import *
# upper import all the model class i have
config.set_main_option(
name="sqlalchemy.url",
value=DATABASE_URL,
)
target_metadata = SQLModel.metadata
alembic/env.py, i found the issue:alembic revision --autogenerate -m "initial migration"INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [alembic.util.messaging] Can't locate revision identified by 'f29236eae9ff'
FAILED: Can't locate revision identified by 'f29236eae9ff'
f29236eae9ff.
Читать полностью…
building a distributed async python backend rn messing with asyncio event loops, concurrent workers, multithreading, websocket streams, REST APIs, request queues, proxy rotation, rate-limit handling, JSON serialization, regex parsing, redis caching, postgres, connection pooling, dependency injection, docker containers, CI/CD pipelines, exception handling, retry logic, exponential backoff, memory profiling and some absolutely fucked race conditions
Читать полностью…
i hate how coding in python has mentally changed my life i remember back in the day when i was just a normal guy with a normal life now im up at 4am debugging some async asyncio multithreaded api scraper because my requests are getting rate limited and throwing 403s while im staring at stack traces rewriting functions fixing dependencies and wondering why the fuck my virtual environment broke again
Читать полностью…
If you are doing financial math - use Decimal
If you are calculating a trajectory for a rocket, use external libraries
DO NOT use Fraction to represent floating point numbers
That's it
Fractions get slower and slower as you work with them, and are rarely used for representing floating point numbers
Читать полностью…
If u seriously wanna learn Python, my 2 cent is to go this path:
1- Read Python Crash Course book && Do ALL the practices & coding there (mocking, changing some segments, re-doing the practices on ur own)
2- Read Effective Python (125 specific ways ...) not the old version (90 specific ways ...) & apply ur learning about best practices onto what u've done in Python Crash Course.
Avoid getting lost in thousands of articles out there.
Once u learn everything in those 2 books, u're way better than lots of Python devs in writing correct & idiomatic Python.
But if u're not genuinely interested & just wanna look cool, we're in post-llm era. Easy to look like magicians by a couple of prompts. So, don't waste ur time.
Hello can anyone help me on cyber security
Am a beginner
Thanks All.
I got solved, actually i didnot add the import sqlmodel
in my script.py.mako thats why it cause the problem till now 😅
ok bye leave this topics is overkilling me for now
Maybe the rocket science floating i will never need to learn
i just want to be learn simple website making Hosting and sell website 😅
i think to start using the fast speed decimal calculations for my normal apps also? will it ok really?
Читать полностью…
so which u will say i should learn, so that from now i will Learning Using simple fast speed of floating calculation for my own shopping app, school apps like this?
Читать полностью…
you have just stop my mouth 😅 and just push me into the sea of confusion
Читать полностью…
Read again the above message
And decide for yourself
And float(Decimal) does not make apsolutly no sense