#python-discussion

1 messages · Page 28 of 1

shrewd pine
#

the solution to this problem is to not do it

rare gazelle
#

so how would u cache whatever u want to cache

#

create a list or a dictionary for 1 item?

pastel sluice
#

that raises a question: why cache in the first place?

rare gazelle
#

i dont like the unique as a decorator though

#

but i do like the:

class a:
  b = unique(1)

way

dusk fern
#

bruh how i can make a key that is identical if its
a,b
or
b,a
🤔 beside using a set or sorting tuple

rare gazelle
#

what u mean

shrewd pine
#

what's the problem with sorting?

rare gazelle
#

whats the probblem with set

#

(frozenset in that case)

gleaming knoll
rare gazelle
#

if order doesn't matter its a set

#

equal but different order -> set

dry pike
#

at mtn

fossil steeple
#

how would i get a microbit to communicate with a pico w

rare gazelle
dry pike
#

challenge

#

smh my head

dry pike
#

that's it?

rare gazelle
#

no but help me with it

dry pike
#

i don't understand the problem description

wind escarp
#

Anyone having problems with Selenium after the chrome driver update?

#

it sometimes works, sometimes doesnt

rare gazelle
#

the idea is that to make a.b be 2, but after subclassing a, it'd be the initial value (1)

#

so i came up with a function named unique, which is abusing set_name

#

it'd a descriptor

dry pike
#

what's set name again?

rare gazelle
#

set name is getting the class and the name of the variable after the class' creation

gleaming knoll
rare gazelle
#

after class' creation^

gleaming knoll
#

i mean, yeah, Cls has to exist to be passed

rare gazelle
#

yes

#

thats the information i've used in order to abuse it

gleaming knoll
rare gazelle
#

that at set_name the class exists

#

so i can change it in whatever way i want to

#

(and i also know the value of the name)

#

so basically i have everything

#

and set_name would likely not run more than once so, its not effecting the afterwards usage

#

kind of interesting the ways u can use set_name

steady magnet
#

Im new to python :3

cunning cove
#

Spent over an hour working on a metaclass so I could avoid having to change every subclass.
Only problem is that using the metaclass requires that I change every subclass.

charred python
#

libcst to the rescue

cunning cove
#

The issue is more that I picked the wrong solution to the problem I had :P

#

I didn't need a metaclass and it's not really adding enough value to justify its existence. The value add being automagic attributes without having to change how the user interacts with the subclasses

#

And I don't like this class in the first place so I should really be doing the minimum needed to add the functionality I need

autumn forge
#

yeah, metaclasses are rarely the way

cunning cove
#

How detailed do I want to get :P
The subclasses have attributes and types associated with those attributes.

class Base:
  Types: dict[str, type]
class Foo(Base):
  Foo = "foo"
  Types = {Foo: str}

Now maybe this is a crime in itself. That aside, the things that bugged me and prompted me to reach for metaclass are that the associated types are separate from the declaration of the attribute, adding a new attribute in the subclass requires updating a separate part of the class, and adding an attribute in Base would mean that every subclass now needs to know what Base did so it can manually add to the Type dictionary.
My thought was to have Base derive from a metaclass so that it can generate that dictionary.

#

And by doing that, it would let the derived class define the attribute and associated type together

class Foo(Base):
  Foo = ("foo", str)
acoustic spear
#

hi

autumn forge
#

!e what about type annotations? ```py
class Foo:
Foo: str = 'foo'
print(Foo.annotations)
import typing
print(typing.get_type_hints(Foo))

edgy krakenBOT
cunning cove
autumn forge
#

ah, I see

fossil steeple
#

is there anyway to get a microbit to communicate with a pico w wirelessly

cunning cove
#

The actual types would be message types, so the point of this class is to determine how to unpack that message.

autumn forge
#

I suppose that's why the attribute has the same name as the class then?

cunning cove
#

That's because I'm lazy :P

autumn forge
#

ah lol

crude prawn
#

Hello Guys my name is alon and am trying to learn def thing is python i dont really get it is there someone can help me?

cunning cove
#

Slightly more complicated example

class Messages(MessageBase):
  Status = "status"
  Request = "Request"
  Types = {Status: StatusMessage, Request: RequestMessage}
smoky forge
#

the whole thing or just a small part

crude prawn
#

def user(name): print(f"hello {name}") print(f"hello {name} What is your server?") input = "My server is alon" user("user")

cunning cove
#

I'm also not using the exact naming scheme here, it was just enough to make the point I wanted to make. I know that removing context makes it harder to understand these things :P

crude prawn
#

I dont want the stright answers since i could ask GPT but i want the way of how doing it

primal niche
#

How do you guys train your python?

#

like what test projects you'd do to improve yourself in python?

harsh anchor
crude prawn
dusty mountain
#
def linear_search(x, l):
    for i in l:
        if i == x:
            return l.index(i)

can you call this a linear search algorithm? i got into a big argument with my cs teacher because she said it is

crude prawn
#

Smth like that?

#

Not really if you asking me

hasty island
hasty island
#

also why would you write linear search as a function in the first place if you are allowed to use .index

dusty mountain
#

our cs teacher isnt very good at her job

#

in an exam once she gave a predict the output question and the snippet had an error so i put down error as the answer
she didnt give me the mark because she didnt mean to put the error there

hasty island
#

nothing you can do about it

#

also which books are you guys using? (please tell me it's anything other than the sumita arora ones)

dusty mountain
#

sumita arora 🤗

gleaming knoll
#

is that some local indian teaching books
known to be bad but still used

frosty oriole
dusty mountain
harsh anchor
#

oof

harsh anchor
dusty mountain
#

i dont even know

harsh anchor
ionic bluff
#

i would

hasty island
dusty mountain
#

.index is doing the searching

hasty island
harsh anchor
dusty mountain
bright mauve
tall vector
#

It's a (bad) linear search algorithm

hasty island
tall vector
#

It does redundant work but it still searches linearly

dusty mountain
#

sure but the context here is that shes introducing what a linear search algorithm looks like

#

claiming that that is a correct implementation of linear search is misleading

tall vector
#

It's shit teaching for sure, but not necessarily wrong per se

hasty island
bright mauve
dusty mountain
#

its not the standard definition of a linear search

bright mauve
#

why not?

dusty mountain
#

the standard includes going through each position and return the current position when the elem is found

harsh anchor
#

isn't it?

bright mauve
#

is that not what the code is doing?

dusty mountain
#

its going through each element rather than each position

hasty island
#

same difference

bright mauve
#

that is a trivial distinction tbh, and in python you would rarely ever go through each position

hasty island
#

I feel like we're getting dragged into the wrong topic, bottom line is,
you're wrong because it still counts as linear search - all it needs to do search, and be linear - both of which it does
and the teacher probably should not use this as an example for the reason than .index itself is a linear search

bright mauve
#

in fact, going through each position is often considered an antipattern in python

#

what the teacher is showing is a poor linear search, but a linear search nonetheless

#

that python lets you do for x in my_list instead of for i in range(len(my_list)) has nothing to do with it being a linear search or not

harsh anchor
dusty mountain
#

fair enough

bright mauve
#

linear search only means you're comparing each item in a collection one at a time. how exactly you do that is a separate thing

harsh anchor
#

it is incredibly vague. you just need to search linearly

bright mauve
#

better to distinguish abstractions from concrete implementations now, because you'll bump against this wall again when distinguishing abstract data classes vs data structures

#

cuz it just so happens python's list is also a stack

#

better hide from the popo

hasty island
gilded mirage
#

y = x satisfies y = mx + b

#

It's called a linear search because the worst case complexity makes a line if you graph it.

hasty island
gilded mirage
#

well, whatever the right term is

bright mauve
#

i mean

#

it satisfies y = mx + b for m = 1 and b = 0

gilded mirage
#

yeah, that's what I mean.

cerulean ravine
#

this is one of those etymologies that might be hard to verify. I always thought it was called linear because you're walking down the line looking for the thing you want.

tough wigeon
#

hello

#

i m russian and i need help with my project

bright mauve
tough wigeon
#

i have problem with enum object

bright mauve
#

what problem are you having?

tough wigeon
#

second....

finite rose
wary lily
#

i made something kinda cool

x = input('input string' ).
Left_charactors = 'bgtrfvedewsxzaq'
right_charactors = nhyujmkiolp'
lcounter = 0
rcounter = 0
space_charactors =
scounter = 6
for ch in x:
if ch in right charactors:
rcounter += 1.:
elif ch in space charactors:
scounter += 1
elif chin left_charactors:
lcounter += 1
print(Left:", {lcounter), "right:, (rcounter}, 'spaces:" , {scounter})

i don’t like the spacing but it works how i want it to work

south bison
#

i’m trying to learn how to use manim but my internet is so bad and i can’t install anything

tough wigeon
#

check Python help please

charred tusk
#

With Pydantic, can I have an optional SecretStr?
Right now, I have to do client_secret: SecretStr = "", which will default to empty string if the value isn't present in the environment.
Which is.... finne, because I can still do if == "": raise "not present".
But I'd really like to have an explicit qualifier for if it's there or not.

harsh anchor
south bison
tough wigeon
tough tapir
#

What should I automate?

coarse salmon
#

everything

gleaming knoll
#

that'd mean everything is boring stuff

pastel sluice
#

Automate The Stuffy Bores With Python

#

(That's the punchline, someone quick think of a joke)

gleaming knoll
#

is there anything that does not become boring once you repeat it enough

gleaming marten
#

😌

ionic bluff
#

maybe dying...

hasty island
gleaming knoll
stray field
ionic bluff
gleaming knoll
#

dying is at the end of my to-do list

stable narwhal
gleaming knoll
stray field
hasty island
ionic bluff
#

funny

hasty island
#

I first learnt C from that (my dad had an old copy lying around)

gleaming knoll
hasty island
ionic bluff
stray field
gleaming knoll
hasty island
gleaming knoll
stray field
#

reminds me of the stanley parable

ionic bluff
#

damn meant to reply to the last one:die.

#

oh well you get the joke

gleaming knoll
sharp jackal
visual juniper
sharp jackal
#

Vargula let's you achieve terminal text formatting while being minimalistic...

gleaming knoll
#

looks like a small rich, nice

hasty island
sharp jackal
hasty island
#

(also you commited dist/ to the git repo)

sharp jackal
#

Here's a sample code snippet!

print("Code Diff Highlighting\n")
vg.create("added", color="#00ff88", bg="#003322")
vg.create("removed", color="#ff4444", bg="#330000")
vg.create("modified", color="#ffaa00", bg="#332200")

diff_lines = [
    ("  ", "def calculate_total(items):"),
    ("-", "    total = 0"),
    ("+", "    total = Decimal('0.00')"),
    ("  ", "    for item in items:"),
    ("-", "        total += item.price"),
    ("+", "        total += Decimal(str(item.price))"),
    ("  ", "    return total"),
]

for marker, line in diff_lines:
    if marker == "+":
        print(vg.format(f"<added>{marker} {line}</added>"))
    elif marker == "-":
        print(vg.format(f"<removed>{marker} {line}</removed>"))
    else:
        print(f"{marker} {line}")
sharp jackal
sharp jackal
stray field
#

git is forever

#

now every time you clone, you'll have to download those files.

hasty island
#

amend and force push ftw /hj

charred tusk
#

Why did you cross out the popular strat??

#

Does this function being async matter at all?

async def _build_order_data(
    po_number: str,
    items: dict[str, int],
) -> dict:
    payload = {
        "poNumber": po_number,
        "lines": [],
    }

    for gtin, quantity in items.items():
        payload["lines"].append({"identifier": gtin, "qty": quantity})

    return payload
gleaming knoll
#

no
well, it will make it return a coroutine, but there's no need for it to be async
unless the way its commonly used is to pass to something expecting a coroutine, maybe?

jagged belfry
#

I expect whoever wrote it expected to have to do async calls in it and htat's why it is the way it is

jagged belfry
#

I figured :P

#

Well.. did you?

charred tusk
#

I did not expect it to do async stuff, but I did expect the parent to do so

payload = await _build_order_data(po_number, items)
response = await client.post(
  "/orders",
  json=payload,
)
#

If I have one async function is there any reason not to just commit and go all the way in?

#

Does picking and choosing help me at all?

jagged belfry
#

It indicates whether a function makes api calls or not

#

_build_order_data() can be assumed to return quickly. await _build_order_data() can be assumed to potentially not

#

A good rule of thumb is to keep your async organized instead of painting everything the same color

coarse salmon
#

could just make it a dataclass

jagged belfry
#

honestly it's just awkward to async() everything. It's also important because async points are yield points, so some functions you may not want to yield during their execution, and thus shouldn't be async

desert atlas
#

some one want to build a startup I m a novice programer and I want to create a big proyects whith other pepole

charred tusk
harsh anchor
#

why would someone make a startup with a novice

coarse salmon
#

^

#

your focus should be improving your skills, not making money

jagged belfry
desert atlas
#

i want to learn whit other novice , I learn very fast , I learnded de basic in 2 weeks

jagged belfry
#

A well organized codebase won't look like camo : )

charred tusk
#
async def main() -> None:
    """Submit orders from a CSV file to S&S Activewear."""
    pos = _parse_pos_csv()
    total = len(pos)
    for index, (po_number, items) in enumerate(pos, start=1):
        print(f"{index} of {total}: submitting PO {po_number}")  # noqa: T201
        if Path(f"pos/{po_number}-request.json").exists():
            print(f"Skipping {po_number}, already submitted")  # noqa: T201
            continue

        payload = await _build_order_data(po_number, items)
        response = await client.post(
            "/orders",
            json=payload,
        )

        Path(f"pos/{po_number}-request.json").write_text(json.dumps(payload, indent=4))
        Path(f"pos/{po_number}-response.json").write_text(json.dumps(response.json(), indent=4))

        await asyncio.sleep(2)
#

what do you even want me to do different

#

oh I just told my boss I wasn't sleeping here

#

Oops

jagged belfry
#

lol

#

Maybe you should noqa T201 on the entire function, since it's supposed to give output

#

Yeah looking at this

#

payload = await _build_order_data(po_number, items) make it non-async

#

It's just a simple transformation

#

could be done inplace imo but maybe that makes sense for elsewhere

rugged star
jagged belfry
#

logging

rugged star
jagged belfry
#

If it's an external API

#

It's good to have exact records of what you sent and received

#

because companies like playing fuckfuck games

rugged star
#

true

desert atlas
#

some one want to build a startup I m a novice programer and I want to create a big proyects whith other pepole

jagged belfry
#

"I got a 500 error"

#

"No you didn't"

#

And now you get to slog through six billion requests looking for which one broke their stupid api

#

It's cleaner to only store start and end states, but if you have intermediaries that update in the meantime you'll lose data and it's just a mess honestly. For things that don't have super high volume and you can actually store (text is cheap) just log everything

rugged star
jagged belfry
#

yes

#

Or if you have data corruption you can figure out when it started

charred tusk
#

Like when I accidently messed up a number and ordered 53 $20 shirts instead of $50 jackets
plus $15 shipping EACH and they were non-returnable

jagged belfry
#

ouch.

charred tusk
#

Or when I need to go back through them all to collect the confirmation numbers and/or out of stock responses

slender urchin
#

$15 shipping for a single t-shirt is madness

charred tusk
#
def _collect_errors() -> None:
    output = {}
    for response_file in Path("pos/").glob("*-response.json"):
        response_data = json.loads(response_file.read_text())
        if "code" in response_data:
            output[response_file.stem] = {dct["field"]: dct["message"] for dct in response_data.get("errors", [])}
    Path("errors.json").write_text(json.dumps(output, indent=4))

Sometimes Python is beautifully simplistic

bleak moth
#

So, with iterables and iterators, is it better to have a separate iterator class or for the class to be its own iterator... when would it be better to use either design?

slender urchin
#

I'd say it's different on a case by case basis

bleak moth
rugged star
hasty island
desert atlas
#

some one want to build a startup I m a novice programer and I want to create a big proyects whith other pepoleçç

slender urchin
#

If your class is a sequence you can use the one included in Sequence

bleak moth
harsh anchor
#

so?

charred tusk
#

"this site wants to use your camera"

#

WTF

gleaming marten
#

💀

#

Is this a mods ping moment

quiet basin
charred tusk
gleaming marten
#

How was a link even allowed, or is it just discord links banned

quiet basin
charred tusk
#

Links are blacklisted, not whitelisted

gleaming marten
charred tusk
#

(Discord invites are whitelisted)

quiet basin
jagged belfry
#

i look away for ten seconds

charred tusk
#

It was longer than that

jagged belfry
#

!ban 1336656185516097574 1d do not send malicious links here

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @quiet basin until <t:1763844632:f> (1 day).

charred tusk
#

But still not long enough for me to understand what to do with my code

#

So just “no async unless I’m going to use it”?
Even if all the functions friends are red, he should still vote blue?

harsh anchor
jagged belfry
hallow bay
#

is it a bad idea to use LLMs to give you a path to follow to build an app, not actually touching any of your code but providing steps (that make you think) into the right direction, in a learning context ?

harsh anchor
#

not necessarily

coarse salmon
#

the solution is to use erlang so you dont have to deal with async/await

jagged belfry
#

Red and blue are two categories of function, and you want your functions to align with the behavior type of the category

#

red is "might wait" blue is "wont wait"

bleak moth
# harsh anchor so?

So, the code I want to use and want the client to be able to use is...

k = Key(...registry key params...)
for child in k:
  ...

But, the problem is that Key is not storing the keys as an iterable where I can just pass through the iterable, instead, winreg has the functions EnumKey and EnumValue where EnumKey takes a key, and a number and gives you the numberth child key of the given key, and EnumValue does the same for values.

#

You're meant to call this repeatedly until you get an OSError which indicates you've reached the end of the list of children.

charred tusk
#

Mentally it still feels like heresy to mix and match

silver plover
hallow bay
harsh anchor
granite wyvern
silver plover
hallow bay
#

i will give it a try for this cli i am making

#

see how hard it flops lemon_clown

granite wyvern
# silver plover I think it's unrealistic and not a good lesson in being an engineer. But, it may...

We have a monthly "what're we doing with AI tools" meeting where those of us using them give feed back about what, and whether they're good/bad. One item someone saidwas that it could be handy for "write a proposal for XYZ", because it included some things they might have missed. Then you turn it into the real proposal. So AI wasn't doing the proposal, but it was producing a framework/outline.

I'm talking about text here, not code.

hasty island
hallow bay
charred tusk
hallow bay
#

sounds goofy as hell what i said*

silver plover
#

I get more value from -that- than anything else

harsh anchor
charred tusk
#

If it knew what was wrong with its answer…
… it wouldn’t have given you that answer

charred tusk
hasty island
charred tusk
#

BRB gotta switch entire apps

silver plover
#

'Your question is wrong because lack of preparation in your part does not mean inconvenience on my part is appropriate'

cerulean ravine
#

I have found it helpful when Claude does something wrong to ask it why it did, and what I could change to make it not happen again.

silver plover
#

I've been unhappy with Claude, it doesn't stay within its guardrails well.

charred tusk
#

What was wrong with your question?
Your question compressed several moving parts—Textual UI, ZIP extraction, SDK behavior, and display logic—into a single sentence, which left the scope a bit fuzzy. It didn’t say whether the SDK was sync or async, whether images needed thumbnails or raw bytes, or whether the UI should stream them in gradually. None of that prevented an answer, but it added guesswork.

What was wrong with my answer?
The example leaned into a straightforward synchronous flow, which might not match your SDK’s actual behavior. I also assumed image formats and didn’t show optional quality-of-life pieces like error overlays, scrolling layout, or asynchronous fetches. The explanation covered the basics but didn’t dig into deeper architectural guidance you might actually want for a more robust production tool.

idle fulcrum
#

hello y'all

charred tusk
#

Hey you

silver plover
charred tusk
#

A lot about asking good questions

#

Which is important

idle fulcrum
silver plover
#

I'm two weeks into an experiment with Claude; I asked it to rewrite and optimize a fairly large chunk of code (about 20k lines). It's doing a terrible job so far, the task is just too many lines of code, it seems. I've been curious really what would happen.

#

It just keeps boxing itself into a corner, then violating the ground rules I gave it, then rewriting.

charred tusk
#

Where did you even get that many lines?

pastel sluice
#

Most of my experiments with AI have been unrewarding. The total amount of work required to accomplish my goal, including my oversight, and factoring in the fracturing of attention from switching away from the LLM while waiting for it to come up with an answer, etc. is a net negative compared to just doing the thing myself.

silver plover
#

Like, incredibly complex stuff.

charred tusk
#

Ah

charred tusk
granite wyvern
charred tusk
#

afeared?

#

No way that’s a word

granite wyvern
charred tusk
#

Huh

#

I stand archaic-ly corrected

silver plover
pastel sluice
#

The tradeoff seems to be complete in both directions. The larger the job, the less likely the LLM can handle it; the smaller the job, the less use it'll be in the first place since I can just do it myself.

fossil steeple
#

Can i microbit communicate with a pi pico w wirelessly

inland karma
fossil steeple
rugged star
#
PS C:\Users\.\Documents\python_programming\WIP\6_shots> & C:/Users/./AppData/Local/Programs/Python/Python314/python.exe c:/Users/./Documents/python_programming/WIP/6_shots/main.py
Traceback (most recent call last):
  File "c:\Users\.\Documents\python_programming\WIP\6_shots\main.py", line 1, in <module>
    import pygame
  File "C:\Users\.\AppData\Local\Programs\Python\Python314\Lib\site-packages\pygame\__init__.py", line 139, in <module>
    from pygame.base import *  # pylint: disable=wildcard-import; lgtm[py/polluting-import]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pygame.base'
``` anyone know what couldve happened to my install of `pygame-ce`
granite wyvern
#

Maybe it's installed in a venv, but you're running the primary python and not the venv python?

idle fulcrum
#

there's no base module in that folder?

rugged star
granite wyvern
#

How did you install pygame-ce? Was it in a venv?

rugged star
granite wyvern
#

(Corrupted is unlikely.)

rugged star
granite wyvern
#

Installs are per environment. I would:

  • make a venv from your pimary python
  • activate the venv
  • install pygame-ce
  • try your script while the venv is activated
rugged star
hasty island
#

wouldn't pygame[-ce] not being installed throw couldn't find pygame instead of pygame.base?

#

(meaning there is no .base)

granite wyvern
hasty island
#

!e from pygame.base import *

edgy krakenBOT
# hasty island !e from pygame.base import *

:x: Your 3.14 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     from pygame.base import *
004 | ModuleNotFoundError: No module named 'pygame'
granite wyvern
#

Aye, just tried that myself. You are correct.

rugged star
#
(.venv) PS C:\Users\.\Documents\python_programming\WIP\6_shots> py -Xgil=0 .\main.py
pygame-ce 2.5.6 (SDL 2.32.10, Python 3.14.0t, No GIL)
rugged star
hasty island
#

(idk, I don't use pygame, but that is what the error indicates)

rugged star
jagged belfry
#

Pygame's internal import is broken

#

This means one of two things:

  • you named a file pygame.py
  • your pygame install is corrupt
rugged star
#

i mean pygame does warn its not fully made for 3.14t yet so maybe its the reason

hasty island
#

well, try switching to the "default"

jagged belfry
#

I doubt it

#

3.14t errors would probably lead to segfaults imo

#

This feels more fundamental

silver plover
rugged star
#
(.venv) PS C:\Users\.\Documents\python_programming\WIP\6_shots> py .\main.py
<frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'pygame.base', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
pygame-ce 2.5.6 (SDL 2.32.10, Python 3.14.0t, GIL)
silver plover
#

Oh, it has wheels, it's just reenabling the Gil. So it's there.

#

Don't run with python_gil=0 tho

rugged star
hasty island
#

the warning tells you why not

rugged star
hasty island
#

(at your own risk)
and you found out what that risk gets you

silver plover
rugged star
charred tusk
#

You promised you'd delete that video!!

rugged star
hasty island
runic flower
rugged star
#

ok fine i wont put gil on 0 (for now .... maybe when they remove the warning i will)

hasty island
#

the warning is from python itself telling you, xyz needs the GIL

silver plover
rugged star
#

might sound dumb but thought it was worth trying

sullen dust
#

will all packages need to be modified to be able to run without the GIL?

charred tusk
granite wyvern
rugged star
charred tusk
#

So… can I just switch all my runtimes to the ft versions and let it re-enable the safety when it needs to, but not do it when it’s safe?

granite wyvern
#

I don't know the details, and it may be a transition phase.

charred tusk
#

I didn’t know that was a thing
I need to go do that to my test package

#

Hmm
Are there not FT or JIT Docker images yet?

granite wyvern
#

"Module Initialization

Extension modules need to explicitly indicate that they support running with the GIL disabled; otherwise importing the extension will raise a warning and enable the GIL at runtime."

charred tusk
#

Do pure-Python modules not need to be updated?

granite wyvern
#

Maybe not.

sullen dust
#

will no gil make the threading library useless or better?

charred tusk
#

Everything I do is in containers and I don’t see any container images 🙁

granite wyvern
#

"Go not to the elves for advice, for they will say both no and yes."

charred tusk
#

With blackjack and very nice ladies?

#

Thats fun and all
But it doesn’t make the security team very happy

granite wyvern
#

Security teams are paid to be unhappy.

charred tusk
#

True

#

And in this case the security team consists of me, myself, and I, so I’d like to think I still hold a lot of sway

granite wyvern
#

Won't you step on your own blue shoes?

#

"
Iterators

Sharing the same iterator object between multiple threads is generally not safe and threads may see duplicate or missing elements when iterating or crash the interpreter.
"
Fun times. I need to think about what this actually means.

charred tusk
granite wyvern
#

This text predates 3.14, btw, I believe.

charred tusk
#

uv provides the builds
I already use uv in the container
I just need or figure out how to pin to these builds

sullen dust
#

will lazy imports be confirmed?

granite wyvern
#

I believe the PEP is accepted.

charred tusk
#

They already were

sullen dust
#

it is

#

yeah i thought it was still in proposal

granite wyvern
#

!pep 810

edgy krakenBOT
granite wyvern
#

Yes, slated for 3.15

sullen dust
#

wait so what got rejected?

stray field
#

Yay!

charred tusk
#
(chimera) @shenanigansd ➜ /workspaces/chimera (main) $ uv run nox
error: Distribution `psycopg-binary==3.2.13 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform

hint: You're using CPython 3.14 (`cp314t`), but `psycopg-binary` (v3.2.13) only has wheels with the following Python ABI tag: `cp314`
charred tusk
rugged star
#
<class 'pygame.math.Vector2'> <class 'pygame.math.Vector2'>
Traceback (most recent call last):
  File "C:\Users\.\Documents\python_programming\WIP\6_shots\main.py", line 37, in <module>
    @lambda _: _().run()
     ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\.\Documents\python_programming\WIP\6_shots\main.py", line 37, in <lambda>
    @lambda _: _().run()
               ~~~~~~~^^
  File "C:\Users\.\Documents\python_programming\WIP\6_shots\main.py", line 51, in run
    self.p.update()
    ~~~~~~~~~~~~~^^
  File "C:\Users\.\Documents\python_programming\WIP\6_shots\main.py", line 34, in update
    self.pos += (direction * self.speed)
TypeError: unsupported operand type(s) for +=: 'pygame.math.Vector2' and 'float'
``` lol weird behavior unlocked
```py
class Player(pygame.sprite.Sprite):
    _pos: pygame.Vector2

    def __init__(self, *groups) -> None:
        super().__init__(*groups)
        self._pos = pygame.Vector2()
        self.speed = pygame.Vector2()
        self.image = pygame.Surface((60, 60))
        self.image.fill("red")
        self.rect = self.image.get_rect(center=(30, 30))

    @property
    def pos(self) -> pygame.Vector2:
        return self._pos

    @pos.setter
    def pos(self, v):
        self._pos = pygame.Vector2(v)
        if self.rect is None: return 
        self.rect.center = self._pos

    def update(self):
        super().update()
        k = pygame.key.get_pressed()
        direction = pygame.Vector2((k[pygame.K_d] - k[pygame.K_a]),(k[pygame.K_s] - k[pygame.K_w]))

        if direction.length() > 0:
            direction.normalize_ip()
        print(type(self.speed), type(direction))
        self.pos += (direction * self.speed)
#

i know i dont have delta time implemented yet -_-

rugged star
#

what is the correct to get a Vector2 where the values are a multiplication of the 2?

autumn forge
#

probably 2 * vectorobj

#

yeah, multiplying two vectors together will give you the scalar (dot) product

rugged star
bleak moth
autumn forge
rugged star
hasty island
autumn forge
hasty island
#

again, the call is yours to make, decide if you want to pull it out to a class if it's too bloated

bleak moth
rugged star
rugged star
autumn forge
bleak moth
#

That's dumb!

#

That's literally the matrix multiplication operator

#

What library is this?

#

pygame?

rugged star
rugged star
autumn forge
#

after checking the docs they actually do have it implemented ```python-repl

u = pygame.Vector2(3, 4)
v = pygame.Vector2(2, 1)
u.elementwise() * v
Vector2(6, 4)

#

TIL 👀

granite wyvern
hasty island
granite wyvern
edgy krakenBOT
autumn forge
#

yeah, __matmul__

granite wyvern
#

Whoops.

bleak moth
hasty island
granite wyvern
#

!pep 690

edgy krakenBOT
granite wyvern
stray field
#

690
Nice

tranquil tinsel
#

On import I have a flask application which sets the static directory for example. While testing it doesn't import again so the static directory is for the first test. I can add importlib.reload() to the code being tested but I only need it while testing. What else can I do?

autumn forge
bleak moth
bleak moth
robust ledge
rugged star
#

is doing something like

from dataclasses import dataclass, field


@dataclass
class MyGlobals:
    delta_t: float = 0.0


globs = MyGlobals()
```where in files i need it i can do```py
from my_globs import globs
x = y * globs.delta_t
``` or should i not do this at all
tranquil tinsel
robust ledge
#

It's almost always easier to remove the import side-effect than try and force a recycled import.

rugged star
fading kelp
#

(if MyGlobals is a truly global instance used anywhere)

rugged star
fading kelp
#

Mutable global variables are frowned upon in general. It's difficult to debug because the scope of the problem could be anywhere

#

Singletons, or dependency injection is used in its place

strong gate
#

@fading kelp My code detects this as errors, can you help me out.

ame = 'Joe'

Age = 'Eleven'

print("Name,Age")
print("Hello my name is: rahhh")

txt: str = 'cant get me hahah'

names: list = ('bob,regina,jay,jake,jackson')

print("hello world!")

from datetime import datetime

print('This is the current time:')
print('datatime.now()')

def show_date() -> None

print(f'Hello!, {Name}!')

Greet('Bob')
Greet('Luigi')

rugged star
#

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

rugged star
# edgy kraken

this can be helpfull for others to read your code @strong gate

cerulean ravine
fading kelp
cerulean ravine
cerulean ravine
fading kelp
cerulean ravine
fading kelp
#

the original post had a global data class instance full of variables that would be mutated throughout their application

cerulean ravine
bleak moth
oak oyster
#

Man why's there no benchmarks on easyocr GPU Vs cpu

fading kelp
oak oyster
fading kelp
robust ledge
#

The word impossible is doing some heavy lifting there. I'm just confused as to why a global mutable is being used like this. You still have it changing anywhere.

bleak moth
#

numpy implements it specifically.

rugged star
fading kelp
bleak moth
harsh musk
#

hello everyone

robust ledge
autumn forge
bleak moth
stray field
granite wyvern
#

We got matrices in 1st year uni.

stray field
#

Late high school/early university

bleak moth
granite wyvern
#

It was about the point where I went from mathcomputer nerd to computer nerd.

stray field
charred tusk
#

I no longer have a calculator

bleak moth
#

I do somewhere still.

granite wyvern
#

I think to some extend it was the teaching style. A lot of "definition, here is what we do" and nearly no "this is a thing you can use it for".

stray field
#

My calculator was a fancy terminal

bleak moth
#

TI-84+ Silver Edition from 2005?

granite wyvern
#

My caclutor was a dumb as rocks scientific calculator. Not sure I every had a fancy HP with RPN.

stray field
#

TI-86 for me

granite wyvern
#

A TI something for me I think.

stray field
#

I wasn't allowed to use it in tests

granite wyvern
#

Does no one find the idea of a "TI84 ... from 2005" a ittle jarring?

granite wyvern
stray field
#

83/84+ only

bleak moth
#

I got it in high school 🤷‍♂️

#

I needed it for Chemistry

bleak moth
#

Then it came in handy during Alg III/Trig

charred tusk
#

Is that a little too early?

stray field
#

Ever used a TI-89 Titanium?

bleak moth
#

No, sadly

stray field
#

It has a color screen

bleak moth
#

I never invested in another graphing calculator after that

stray field
#

And can make 3D graphs

charred tusk
#

I never invested in another graphing calculator after Desmos

raw bramble
#

python

craggy willow
#

did you figure this one out, i'll look at it

raw bramble
#

I always forget that Desmos is meant to act as a graphing calculator and not my graphy drawy silly game thing

craggy willow
#

is the image binary?

charred tusk
craggy willow
#

yeah, binary image... i can fix it fast

raw bramble
#

Would a ternary system be able to emulate a binary system?

craggy willow
#

sure, n-ary system can emulate a p-ary system

raw bramble
#

So surely you could make a Ternary computer and run it completely fine on regular networks and interact with other devices as it if too were a binary machine

craggy willow
#

lol

charred tusk
#

based

craggy willow
#

actually, i should make the alpha channel 255

obtuse plover
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.

craggy willow
#

i think it has to be

charred tusk
#

Not sure
I'm watching my soap right now
Don't got my code in front of me
I'll DM you the images in case you wanna look at them

craggy willow
#

i will say, type checker hates numpy code

charred tusk
#

I wonder why

jagged belfry
#

lol

coarse salmon
craggy willow
#

ok, yeah, it's uint8 at least

jagged belfry
#

I feel like this should be an imread and a convert

#

cv2.imdecode

craggy willow
#

it's annoying, i'll have something typed as ndarray[int, int, Literal[4]] and call np.zeros((4, 4, 4)) and type checker will be like, "ndarray[int, int, int] not an ndarray[int, int, Literal[4]]"

#

but i used the literal 4 🙁

jagged belfry
#

cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)

craggy willow
#

i just dstack it myself

#

the entire function is pretty short

jagged belfry
#

Valid, I guess

craggy willow
#
def read_texture(path: Path) -> RGBA_2D:
    """
    Return a uint8 RGBA numpy array from a path to an image.

    Parameters
    ----------
    path : Path
        Path to image.

    Returns
    -------
    RGBA_2D
        An uint8 RGBA array of the image.
    """
    image = cv2.imread(str(path.absolute()), cv2.IMREAD_UNCHANGED)

    if image.dtype == np.dtype(np.uint16):
        image = (image // 257).astype(np.uint8)
    elif image.dtype == np.dtype(np.float32):
        image = (image * 255).astype(np.uint8)

    if image.ndim == 2:
        image = np.dstack((image, image, image))

    # Add an alpha channel if there isn't one.
    h, w, c = image.shape
    if c == 3:
        default_alpha_channel = np.full((h, w, 1), 255, dtype=np.uint8)
        image = np.dstack((image, default_alpha_channel))

    return cv2.cvtColor(image, cv2.COLOR_BGRA2RGBA)  # type: ignore
charred tusk
#

Also

#

Salt

#

For the love of cat

craggy willow
#

imread accepts Path now though

charred tusk
#

That is explictly my problem

#

I am downloading my images from the internet

#

I need it to accept BytesIO instead of Path

craggy willow
#

hrrm

#

can you provide BytesIO to imread

#

can create an array from bytes

#

you want Image to accept BytesIO?

#

yeah, ok, gimme a sec

charred tusk
#

I tried tempfile earlier at work too, but it said it had uh... "no method absolute" IIRC

jagged belfry
granite wyvern
#

Is there a link to the docs for cv2.imread?

jagged belfry
#

imread() comes from disk, imdecode() from a buffer

craggy willow
#

i think i have class method for Image to create directly from texture, but i'll have to check

bleak moth
#

Registry types are ridiculous. I'm about to just be like "yeah, that registry value data, it's "Any" now!"

edgy krakenBOT
#

src/batgrl/gadgets/image.py line 238

def from_texture(```
craggy willow
#

i could add a from_bytes though

#

or just allow it in the constructor, lemme think

#

i could change path to source and just load directly from the internet, like Video

rare gazelle
#

hello

craggy willow
#

that's false

rocky gust
#

not True

craggy willow
#

actually, you can check the git history, i'm betting it was written before llms were popular

rocky gust
jagged belfry
craggy willow
charred tusk
#

Can I use a black and white image?

craggy willow
#

yep!

charred tusk
craggy willow
#

hopefully

charred tusk
craggy willow
#

i'll push and release and you can yell at me if it's still broken

rocky gust
rocky gust
charred tusk
#

well just go ahead and post the whole thing why don't you
it's not like I DMed you or anything

craggy willow
#

i can delete it

rare gazelle
#

why i'm always late to the fire!!!

craggy willow
#

it was never there

charred tusk
rare gazelle
#

😢

craggy willow
#

you saw nothing

rocky gust
charred tusk
#

Each of the TIFs is a single color
The JPG in the root is the "complete" picture, it has the list of colors at the top

wary lily
craggy willow
#

oh, i see

wary lily
#

sorry

rare gazelle
#

once i posted in here a today i teach thread and someone accused me that i used chatgpt for it

craggy willow
#

it's the times we live in

#

we're all ai now

rare gazelle
#

yea

#

try to prove that u didn't haha

wary lily
pallid garden
#

it's the end times: good quality is attributed to ai because everyone assumes that everyone else can't code anymore

craggy willow
#

crazy, cause if i see good quality i assume it's not ai

rare gazelle
#

i agree with u salt bbut i also agree with zehata

pallid garden
rare gazelle
#

and that fight is pointless

pallid garden
#

i say everyone in the ironic sense

#

not literally everyone

rare gazelle
#

if someone thinks your code is made by ai its going to bbe hard to convince him it's not

#

so just dont try to

pallid garden
wary lily
#

i noticed that simple code is cooler than complicated code that does the same thing

like if you can do something in 50 lines instead of 70 while doing the same thing i find that really cool

rare gazelle
pallid garden
#

or rather, they are the problem

charred tusk
edgy krakenBOT
rare gazelle
#

adding ; u can even have multiple statements

charred tusk
#

I've cut ~1800 lines to ~200 lines

rare gazelle
#

less lines doesn't mean better

rare gazelle
charred tusk
#

HELL no

rare gazelle
#

i still dont understand what this everything is doing

charred tusk
#

It's AI

pallid garden
#

it's doing everything

rare gazelle
#

😵‍💫

slow aspen
#

It's like a macro, expanding your non existing imports into actual functions using OpenAPI is what I read

rare gazelle
#

so u import something that doesn't exist and it makes it existing?

sand hornet
craggy willow
charred tusk
#

My type is already a bytes anyways

raw bramble
#

Any advice on how to create tests to test your code? Never really done it before

craggy willow
#

we've decided unanimously that bytes is superior

charred tusk
#

lol

#

Most "open file" interfaces take "an io" which can be like IO[Path] or IO[bytes]
So it has to have the io wrapper

#

But if you're making your own from_bytes, then you do you boo, go wild and pop off queen

craggy willow
#

i may change Image to do this directly one day

#

we'll see

steel whale
#

i know this is offtopic but does anyone have any experience with android rooting? I wanna hide my Magisk mod from banking apps

#

I'm on my knees for this one tweak

#

I've seen so many people do it yet I can't

brisk gazelle
#

Also, rooting will often trigger a phone wipe.

steel whale
steel whale
brisk gazelle
#

Rightio.

craggy willow
#

can i root my bank

charred tusk
#

only once

#

Then you'll discover the one neat trick to never need a bank account again

#

||(it's prison)||

craggy willow
#

my prison bank

steel whale
steel whale
#

Plus I need to play 8 ball pool, haven't done that in years

steel whale
steady rain
wise imp
pallid garden
steel whale
wary lily
#

i never understood it

craggy willow
#

why do people like purple over yellow, i never understood it

raw bramble
#

Benefit of Apple is they're always years behind, so they're using technology everyone's already perfected, and they can use their money to just get the best out of that already existing tech

raw bramble
pallid garden
#

let's uhhhhh get back on topic

charred tusk
craggy willow
#

purple isn't even real

charred tusk
#

wow

raw bramble
#

brown isn't real it's just purple

fallow ginkgo
#

can we link files in this server?

cerulean ravine
craggy willow
#

you can use paste

pallid garden
#

purple is actually not real though, the color spectrum doesnt loop back from red to violet after all

raw bramble
craggy willow
charred tusk
pallid garden
raw bramble
craggy willow
#

i thought it had to do with which cones activated

raw bramble
#

also if brown is real then so is purple

pallid garden
#

i think therefore purple

fallow ginkgo
#

how do we link files? im gonna link yall an LLM i just made that uses synonyms and antonym probability, experts and before/after pattern data for word and wordclass.

raw bramble
fallow ginkgo
#

so yall can fix it and put it on github open source or something

#

works rn though just could be better

cerulean ravine
pallid garden
#

mary's room!

raw bramble
#

Colours are the cool things that you see when you see colours

cerulean ravine
fallow ginkgo
#

thesarus?.....

raw bramble
#

You can find (almost) any synonym or antonym to (almost) any word

craggy willow
#

blue cones only make up 2% of our total cones

fallow ginkgo
#

no you don't understand, this works fine. I just wanna upload it to yall can use it.

craggy willow
#

i just read this

#

that's crazy

raw bramble
#

Brown and Purple look different as colours, but they are the same colour

pallid garden
raw bramble
craggy willow
#

distribution of cone cells in normal(left) and color blind(right), no blue cones in center

#

this is cool

cerulean ravine
dry pike
livid orbit
#

hello world

#

👋

raw bramble
#

Like your brain maps a colour to its name

#

but brown maps both to purple and brown at the same time because they look so similar?

dry pike
#

???

craggy willow
#

i don't think purple and brown look similar tho

dry pike
#

Bro's color blind

raw bramble
#

It'll go

#5262f7 is BLUE
#f0e92e is YELLOW
#ff6912 is ORANGE
#36181e is BROWN/PURPLE
#5b257d is PURPLE

dry pike
#

🗣️

raw bramble
cerulean ravine
craggy willow
#

.color #36181e

verbal wedgeBOT
#
#36181e

Color information for Color #36181e.

RGB

(54, 24, 30)

HSV

(348, 56, 21)

HSL

(348, 38, 15)

CMYK

(0, 56, 44, 79)

Hex

#36181E

Name

No match found

craggy willow
#

.color #5b257d

verbal wedgeBOT
#
#5b257d

Color information for Color #5b257d.

RGB

(91, 37, 125)

HSV

(277, 70, 49)

HSL

(277, 54, 32)

CMYK

(27, 70, 0, 51)

Hex

#5B257D

Name

No match found

raw bramble
#

They're both purple even though they both look different

craggy willow
#

not a great brown

#

more red

raw bramble
#

dark reds are purple too

errant iron
#

GUYSSS

craggy willow
#

.color #2d1708

verbal wedgeBOT
#
#2d1708

Color information for Color #2d1708.

RGB

(45, 23, 8)

HSV

(24, 82, 18)

HSL

(24, 70, 10)

CMYK

(0, 49, 82, 82)

Hex

#2D1708

Name

No match found

jagged belfry
#

maroon

craggy willow
#

this is brown to me

jagged belfry
raw bramble
errant iron
#

It's my first hackathon, I'm done with everything but deployment, I'm using django

#

What's the easiest way to deploy

raw bramble
#

OH ACTUALLY I HAVE A QUESTIOn

cerulean ravine
#

how did we get started on colors, and how can we stop? 🙂

craggy willow
#

lol

#

what color is your function, ned

jagged belfry
errant iron
#

Help me out

jagged belfry
#

also, patience

#

it hadn't even been 60 seconds

raw bramble
#

How would I create a GUI or something where I can have every hex triplet colour display on screen in like a grid iykwim

errant iron
#

I don't have much time left sorry

jagged belfry
errant iron
#

Thansk

craggy willow
raw bramble
raw bramble
granite wyvern
raw bramble
#

wait no :(((( why are there 3 addative colours

craggy willow
#

rgb?

raw bramble
#

I'd need to make a 3d diagram of colours

granite wyvern
#

I was counting 8 bit rgb

raw bramble
#

You'd only be able to view it in 4d

granite wyvern
charred tusk
jagged belfry
#

isnt there another new one?

raw bramble
#

another what

craggy willow
jagged belfry
#

oklab

raw bramble
craggy willow
#

well, i'm sure there are a bunch of different color systems that try to do that, i'm sure you could to

granite wyvern
#

There's some kind of funky grid traversal that covers eg a whole cube etc in single step increments, can't rememeber its name (or even its specifics).

craggy willow
#

yeah, some 3d space-filling curve

granite wyvern
#

I think so?

digital brook
#

Hello

#

To get verified 2years after joining to be 'verified' to speak in a general chat.

raw bramble
#

:( I want more, different colour cones and to be a 4th dimensional being

craggy willow
#

you want to be a mantis shrimp

raw bramble
#

YES

coarse salmon
#

theres lots of space filling curves

#

but i think hilbert is the more well known one

craggy willow
#

ur mom

#

peano

raw bramble
#

be nice

manic steppe
#

hi guysss

craggy willow
#

i think hilbert is used more often though in computer science

granite wyvern
#

whereas our approach is more crafty

manic steppe
#

guys

#

can you suggest where can i watch python

raw bramble
#

local zoo

craggy willow
#

watch python? you want videos?

granite wyvern
charred tusk
#

Hopefully not inside the house

craggy willow
#

there you go

granite wyvern
#

Of course inside the house.

charred tusk
#

How many sneks do you have?

manic steppe
granite wyvern
#

Personally? None.

manic steppe
#

what guys???

craggy willow
#

you can try cs50, but i've never watched it

#

maybe someone else would recommend it or not

manic steppe
#

where do you guys watch

charred tusk
#

NDC

raw bramble
craggy willow
#

maybe the mit course?

#

probably ok for a beginner

manic steppe
#

ohh

#

wow

pallid garden
raw bramble
manic steppe
#

is explanation is better

fallow ginkgo
#

here guys run this LLM I made tell me what you think. when you run it, it will create an empty dictionary file (possible with the basic words i forgot) and there is file training mode (just rescans files and builds on them), chat training mode (trains pattern data) and regular mode (should have no training). since the dictionary file is empty you may have to copy/paste the dictionary format and generate a small dictionary(300-400 words) that way.

pallid garden
raw bramble
fallow ginkgo
raw bramble
#

whats with the unprompted advertising??

fallow ginkgo
raw bramble
#

????

fallow ginkgo
#

called open source bud

raw bramble
#

@silver plover

charred tusk
fallow ginkgo
#

guys complains someone hands him a free million dollar system

pallid garden
fallow ginkgo
#

anyway go check it out its working as of rn

pallid garden
#

my guy, you dont even know how a URL works

raw bramble
rocky gust
#

guys lowk should I hack into the mainframe using the firewall

charred tusk
#

Mod rules are designed for that reason

#

They have snooze buttons

charred tusk
fallow ginkgo
#

Where the ai coders at than yall don't seem interested

raw bramble
charred tusk
#

ah right

raw bramble
fallow ginkgo
#

real ones

pallid garden
#

they are in delusion

raw bramble
#

Probably not advertising unprompted on a python discord server?

fallow ginkgo
#

its not advertising im linking you to an almost complete LLM system

raw bramble
#

anyway, how did the inventors of python3 come up with the best changes to a language ever?

cerulean ravine
pallid garden
#

im more interested in what you consider the best changes to a language

raw bramble
pallid garden
raw bramble
fallow ginkgo
#

trash collection is useless for a language but i shall take my leave

raw bramble
charred tusk
#

uhm excuse me the term is GC not TC

pallid garden
#

like, 6 months down the line, i can usually look at my own projects with a different lens

#

and find things to improve

manic steppe
#

guys is mit ok

charred tusk
#

It's a pretty highly respected university

pallid garden
#

learning from mit ocw is quite good actually

raw bramble
#

I spent a long time looking at some of my code today and I found one improvement.

if isLan then
  ports = router.device_ports(ip)
else
  ports = router.used_ports
end if

became

if isLan then; ports = router.device_ports(ip)
else; ports = router.used_ports
end if
pallid garden
#

if you build larger projects maybe you will find architectural improvements to be made?

raw bramble
#

I'm building up small projects I'm going to combine together into a big one (hopefully) soon, I just need to get my partial json parser to parse json

manic steppe
#

how about cs50

pallid garden
manic steppe
#

which better

raw bramble
raw bramble
cerulean ravine
pallid garden
#

a lot of people here have looked at cs50 before, if you encounter any problems during your journey you can ask your question and it would be very easy for people to answer your question

manic steppe
pallid garden
#

at first it might be tough but it will become easier with time, so dont give up!

raw bramble
#

Should I always aim for readability wherever possible (without harming my code itself)?

raw bramble
#

like


while u_inp != "exit"; u_inp = user_input("What would you like to run?\n> ")

    if u_inp == "nmap" then run_nmap
    if u_inp == "randip" then run_randip
    if u_inp == "clear" then clear_screen

end while

over

while u_inp != "exit"
    u_inp = user_input("What would you like to run?\n> ")
    if u_inp == "nmap" then run_nmap
    if u_inp == "randip" then run_randip
    if u_inp == "clear" then clear_screen
end while
cerulean ravine
raw bramble
#

The first one is valid

cerulean ravine
raw bramble
#

; treats everything after it as if it were a newline

pallid garden
#

i would even argue sometimes it might be better to take a little bit of performance penalty if the readability improvement outweighs it

manic steppe
pallid garden
raw bramble
cerulean ravine
craggy willow
#

i like the mit one cause it feels more like a classroom

raw bramble
#

I just don't have any python examples on me rn since I don't have my python files open

idle fulcrum
#

more people should be hiring python remote jobs catnod

#

not nodejs things NOPERS

pallid garden
idle fulcrum
#

nobody wants it

raw bramble
#

I understand why people criticize the use of indentation in python, I don't agree with them and I think indentation is a great way of discerning the hierarchy of ur code things, but not ```lua
if
...
end if

while
...
end while

abc = function
print("abc")
end function

pallid garden
#

sometimes halfway through writing tests i suddenly think of improvements i can make

raw bramble
#

writing tests as in tests for your code?

pallid garden
#

yea

raw bramble
#

How does one do that

pallid garden
#

automated tests

#

like pytest

raw bramble
#

I test my code by running it and if it doesn't give me an error then it's probably fineeee

gleaming marten
raw bramble
#

I feel like brackets make it look ugly and harder to read

#

Dicts should look like this

my_dict =
|--------------------|
|  "key1":"Value1",  |
|  "key2":"Value2",  |
|  "key3":"Value3"   |
|--------------------|
craggy willow
#

kinda insane to know how many ----- to use to surround my dict

unborn lagoon
raw bramble
cerulean ravine
unborn lagoon
ashen cipher
#

markdown was written by IETF people /j

raw bramble
ashen cipher
#

@raw bramble write an obsidian plugin for it

raw bramble
#

it'd be much better than random tables but ;w;

cerulean ravine
#

restructured text has list-tables.

raw bramble
raw bramble
summer crest
#

id have less of a problem with leading whitespace

drifting bobcat
#

Yooooo im on the reddit tab today!!!

#

Cool thats my first time since I joined this

craggy willow
#

i didn't even know there was a reddit tab

drifting bobcat
#

Me neither.

#

Tbh

#

But now I know and its cool seeing stuff like that. My thermal monitoring code was top post today

torn shuttle
#

MiniScript looks fire

sharp jackal
#

I have added demo images like @hasty island suggested...

#

Let me know if you have any suggestions... or you can contribute to my GitHub too!

rare gazelle
#

i also like the examples u showed

sharp jackal
#

Thanks a lot, @rare gazelle 😊

rare gazelle
#

np

raw bramble
#

If I want to learn to edit an existing programming language like CPython, I'll need to learn C?

celest osprey
#

not necessarily, there's different parts like the sdtlib which is mostly in python, but yeah ig so

#

soon you'll need to learn rust too :kekw:

steel whale
sand hornet
steel whale
#

I'm assuming they're wanting to make their own version

raw bramble
sand hornet
raw bramble
#

because it's fun to learn things :D

steel whale
#

so an esoteric purpose, no pun intended

celest osprey
#

lmao

sand hornet
raw bramble
#

haha, yeah kinda. I want to learn it so it's something I know that others don't, things that are esoteric...

celest osprey
#

yeah then you'd definitely have to learn c

steel whale
raw bramble
#

What are the bare necessities of a programming language

celest osprey
#

:bigbrain:

sand hornet