#python-discussion

1 messages · Page 212 of 1

silent whale
#

Yes amazon is indeed laying off people, but how can you be sure it's due to AI? Look 2021 and 2022 right off the pandemic how many people Amazon fired.

ebon hollow
#

"Cybersecurity software maker CrowdStrike said in May that it’s laying off 5% of its workforce or 500 employees, and directly attributed the cuts to AI."

golden mortar
#

And again, these are companies that have a vested interest in the idea that AI is good enough to replace human workforce, whether that's true or not.

ebon hollow
silent whale
fossil steeple
#

i think theory lemme pull up my notes

golden mortar
chilly whale
golden mortar
#

Lots of companies prematurely fired a lot of people and tried to replace them with AI, and then had to rehire them later when it turned out the AI was too unreliable.

fiery yarrow
ebon hollow
golden mortar
ebon hollow
fossil steeple
golden mortar
#

Maybe there will be some other technological revolution in the future, and I can't speak about that.

harsh anchor
#

8 years is a long time

silent whale
slender urchin
fossil steeple
golden mortar
#

But the current transformer architecture I think has fundamental limitations that will ensure it's never more than a tool.

ebon hollow
silent whale
#

But at the endd of the day, you can still not do Computer Science if you think that's true. Like if yo u truly believe AI is going to replace coding, then don't do it!

fossil steeple
golden mortar
sullen dust
#

how would it work if AI took over programmers jobs? like how would they continually run and update files wouldnt they still need human operation?

fossil steeple
ebon hollow
golden mortar
#

It'd be as if it was a person.

sullen dust
#

yeah lets hope AGI doesnt get implemented

#

isnt Elon Musk wokring on one?

golden mortar
dull dune
#

AGI is pure marketing, it's not worth talking about

oblique spindle
dull dune
#

that's a silly statement

golden mortar
#

Elon Musk least of all.

sullen dust
golden mortar
sullen dust
#

true but its entertaining

#

oh nvm its was complete bs lol i js searched it up

oblique spindle
ebon hollow
dull dune
golden mortar
dull dune
golden mortar
dull dune
#

frankly, it's not happening

fossil steeple
golden mortar
dull dune
#

tech was on a decade long hiring glut, and is correcting

fossil steeple
fiery yarrow
#

bug bounties on open source projects are probably among the strongest damnations against llms right now. cURL is killing theirs because they're getting absolutely swarmed with hallucinated reports of CVEs that don't actually exist with code fixes that don't actually compile

dull dune
#

without LLMs, not much would have changed re layoffs

golden mortar
fossil steeple
fossil steeple
#

so then consequently, in a few years time there should be a boom?

oblique spindle
#

Because it was a technology boom then a tech shortage then another boom now due to AI Misinformation there's gonna be another shortage then another boom due to this shortage...

golden mortar
# fossil steeple why is that now

That's because of post-COVID layoffs and rising interest rates reducing positions and releasing a bunch of more experienced developers into the job market.

dull dune
#

also, legitimately, while there may be good individuals in leadership and management, at any scale leadership and management are largely shit

dry yacht
dull dune
golden mortar
fossil steeple
#

why is just in speech marks

dry yacht
fossil steeple
fiery yarrow
fossil steeple
#

i heard a thing that ai is meant to be getting worse due to more ai slop could be wrong tho

golden mortar
fiery yarrow
#

granted, but it'll hurt pretty bad for a while

oblique spindle
fossil steeple
#

@golden mortar what do you work as

golden mortar
#

in fintech

fossil steeple
golden mortar
fossil steeple
golden mortar
#

I graduated in 2014

ebon hollow
golden mortar
#

Nope

fossil steeple
#

no as in how long does it take u to do an m.sc

golden mortar
#

5 years

fossil steeple
#

plus the undergrad is 9

ebon hollow
#

I mean Fintech

fossil steeple
#

9 years jeez

golden mortar
golden mortar
ebon hollow
fiery yarrow
charred python
#

funtech sounds fun, though

sullen dust
#

damn i just got accepted for an interview for my post 16

fossil steeple
# golden mortar Huh?

oh wiat maybe ur college system works diffrently is the m.sc a stand alone degree or did u have do smth before it

fossil steeple
golden mortar
rustic needle
granite wyvern
# fossil steeple 9 years jeez

When I did my BSc in CS it was a 3 year degree. Honours was an additional year. A masters was probably 5 all up then - BSc plus further work.

ebon hollow
#

Can you still get hired without a degree even if you know everything?

fossil steeple
rustic needle
#

In Sweden they changed it a while ago so thatnow you usually (always?) get a bachelor on your way to the M.Sc.

golden mortar
ebon hollow
rustic needle
#

My time was 5 years as well

ebon hollow
#

I dont need 5 years

rustic needle
#

No bachelor

granite wyvern
#

Having a degree helps at the outset though - it effectively says "this person's spent time and learnt an expected spread of knwoeledge".

robust ledge
ebon hollow
rustic needle
rustic needle
charred python
#

Some industries or companies that do government contract may require a degree. Other companies don't care (but without a degree, you'll need other experience, usually)

ebon hollow
ebon hollow
charred python
#

right

granite wyvern
# ebon hollow Ill build an impressive portfolio and ill just take the exam of CS

There's no "exam of CS". A degree requires attending and passing courses so that the university knows you've covered what they consider necessary. You can get extra credit for some things to avoid some courses, but that's usually when you switch degrees or come from another university where you've already done equivalent stuff.

robust ledge
rustic needle
#

If there is one person with a degree, and one without, I would probably pick the one with.

granite wyvern
#

There's stuff you learn in a degree you don't learn independently in the world unless you're interested in the theroy etc, and the theory does inform the way you think and gives you better tools for thinking.

rustic needle
ebon hollow
granite wyvern
rustic needle
rugged vapor
#

hey guys

rustic needle
#

Of course you can skip the lectures. But to me they were a great (the best) way to learn. At least for mathematics.

chilly whale
#

passing tests without learning the material only works for basics you already know, and falls apart once you need to learn new stuff

dusk adder
#

or just do what i do
learn the material at home and skip the lectures

ebon hollow
harsh swallow
ebon hollow
#

And also I'm saying if you know the material, if you don't then ofc you have to attend

chilly whale
granite wyvern
ebon hollow
dusk adder
ebon hollow
#

cuz I want to have multiple degrees without doing 10 years of attending classes

granite wyvern
dusk adder
#

i dont like the public setting of universities too much

granite wyvern
chilly whale
# ebon hollow Well Ill just learn what they learn right now

sure, obviously you can self-study all of the material required for a degree. Most people struggle to do it, though. Most people really have trouble forcing themselves to learn material that they don't find interesting without the pressure of grades and deadlines

rustic needle
granite wyvern
#

And answers always from one student also reduces their engagement.

dusk adder
charred python
#

just answer second.

rustic needle
harsh swallow
golden mortar
steel whale
golden mortar
#

Which was most of the time

steel whale
#

it's called being fair

dusk adder
#

what i can recommend for people in my position is that it might be better to ask questions rather than giving answers
good questions make professors happier than good answers for some reason

granite wyvern
rustic needle
vestal scroll
#

personally I don't see the benefit of the lecturer asking closed questions during lectures. much better for students to ask questions themselves instead

dusk adder
harsh swallow
chilly whale
rustic needle
harsh swallow
#

Non-engineering degrees here are 3y for BSc + then 2y for MSc
Engineering is 3.5 + 1.5
Unified programme (no BSc in between) for e.g. medicine is 5y

rustic needle
harsh swallow
#

Poland

rustic needle
#

Cool, I did python programming for Ericpol at Ericsson, so visitted Krakow twice 😄 Cześć @harsh swallow

undone wagon
#

would people in 200 years be impressed with coders not using ai like we're impressed with mathematicians 200 years ago not using calculators

charred tusk
#

Depends on how useful AI gets

#

In its current state?

#

No.

oblique spindle
#

I mean I'm not impressed by mathematicians not using calculator

#

Like Obviously we didn't use calculators whole learning mathematics

chilly whale
#

and using LLMs while learning to code is like using a forklift while lifting weights at the gym

charred tusk
#

Well, OP didn't specify learning

chilly whale
#

you can't be a coder without learning to code, right?

charred tusk
#

Right

ebon comet
charred tusk
#

Even if "AGI" does replace you, that just makes you a prompt-inator, not a developer yourself

ebon comet
#

I've been personally arguing with a prompt engineer about the quality of his code (since it's generating ginormous files etc) and lots of smells and he is convinced the toolchain doesn't need a good dev any more!

harsh anchor
ebon comet
#

You can 'dress up' proper formulated mathematics in code and tensor arithmetic but it might still not be peer reviewed actual quality content and might even be pseudoscience written by a carried away philosopher

finite rose
ebon comet
# harsh anchor huh?

I'm referring to some messy code and ideas that a non dev friend has shared with me but doesn't want sharing publicly in a sarcy manner

finite rose
#

AI code reminds me of perl. It’s best for a single one time use then discarded.

ebon comet
#

I saw that 'pearl' of wisdom!

charred python
#

funny, one of the few times I use AI it is to make single-use perl code.

#

like to edit a bunch of config files or some other one time refactor.

rustic needle
#

People discarding AI like this, have you tried agents like Claude Code? (I haven't but I might soon)

finite rose
#

Theo has a recent vid reacting to an article about how code is now cheap, but software is still expensive.

charred python
#

I have a claude code subscription at work and a trying to give it an honest go.

ebon comet
#

I tried google gemini as well; did not get on with it

finite rose
#

I have access to various AI agents through my IntelliJ Idea subscription

rustic needle
ebon comet
#

Some friends of mine had some fun with local AI generating little 10s vids. They used a 5090

#

I'm a poor man with only a 4060 🙁

finite rose
silver plover
undone wagon
#

old joke

harsh swallow
#

Old joke, doesn't work, and we don't like even "joke" malicious code here

rustic needle
granite wyvern
#

Please don't use potentially destructive things as examples, even as a joke.

marble mesa
#

Ok sorry

harsh swallow
#

It always annoys me that those "jokes" use os.remove which literally can't remove directories, ever. At least be creative and verify your joke, making this mistake shows it's just the same "joke" copied over and over again...

tall vector
#

That's exacly why they're jokes, why they're fine, and why it's still silly that pydis removes them; because they cannot do actual harm

tropic locust
robust ledge
granite wyvern
cerulean ravine
tall vector
robust ledge
tall vector
#

Classic Pydis, "your opinion is wrong, leave"

granite wyvern
robust ledge
cerulean ravine
tall vector
chilly whale
#

have... have you read 1984?

robust ledge
frosty oriole
#

george orwell definetely wrote about this in his hit novel 1984

granite wyvern
tall vector
#

I'm not against moderation, I'm against the misconstruing of jokes as potentially harmful when it takes a huge amount of effort to go from what was posted to code that actually can break stuff

charred python
harsh swallow
granite wyvern
tall vector
granite wyvern
chilly whale
#

I'm confused how someone who has read the book could possibly think that telling people not to post commands that look harmful is "Orwellian"

harsh anchor
#

if someone knows about shutil.rmtree and wants to modify that program to use it... pithink

marble mesa
#

It wasn’t even potentially destructive then

harsh swallow
tall vector
chilly whale
#

ok. That's not what "Orwellian" means.

torn viper
#

When type hinting class attributes, should I use the most concrete type possible (as I would for function return types) or the most abstract type possible (as I would for function arguments)?

tall vector
#

My bad, let me rephrase, "I believe the approach taken here is poor community management" instead then

robust ledge
harsh swallow
tall vector
#

(I do appreciate calling out the 'orwellian' thing, I would rather be correct in my phrasing/anaologising, I just also don't want that to be a detractor from what I'm trying to say)

robust ledge
# torn viper Concrete

Then you'll want to make your annotations as accurate to the implementation as you comfortably can.

torn viper
#

It's really a choice between list and Iterable. But now that I think about it, I should probably be specific.
-# After all, if my principle is "as specific as possible" then why not "Any" for everything, which is not helpful.

chilly whale
# tall vector (I do appreciate calling out the 'orwellian' thing, I would rather be correct in...

wrt. policing commands that appear to be malicious, there's two aspects that come into play. One is that this community has a ton of beginners, and beginners are known for pasting commands they don't understand - which is why we don't want people sharing things that would cause harm if executed. The other thing is that things that look harmful at a glance and require people to figure out whether or not they're actually harmful are a drain on our very limited moderation resources. It's harder for us to moderate if we need to treat looks-harmful-and-is differently from looks-harmful-but-isn't, and it's much easier to just say "don't share things that look harmful"

charred python
#

But officer, it wasn't a real gun.

chilly whale
#

it's just a joke, bro

finite rose
lusty spoke
#

wsg bad bitches
I want to add a toggleable overlay for a plugin I'm making but I want it to impact performance to the least degree possible, what python option should I use BijouThinkHmm

robust ledge
tropic temple
torn viper
robust ledge
charred python
#

Can you give us some examples of that class attributes you refer to? I can think of both cases (concrete and abstract) being valid.

torn viper
cerulean ravine
zenith lintel
#

so you want a gui for it basically @lusty spoke

torn viper
finite rose
#

Is “pydis” an overloaded term? Beyond a python disassembly library?

robust ledge
zenith lintel
#

isnt it python discord

charred python
#
@dataclass
class ShoppingCart:
    items: list[Item]

Here I use list because I expect my shopping cart dataclass to contain a concrete list, instead of something like an iterable that fetches something dynamically (or whatever)

But I can imagine other use-cases where you may want to be as abstract as possible. I think it depends.

tropic temple
#

pygen also

#

but it aint gen no more :(

robust ledge
#

#bringbackpygen

half pewter
#

Pepperidge Farm Remembers

finite rose
robust ledge
#

✨ Language ✨

torn viper
#

@dataclass(frozen=True, slots=True)
class FilterGroup:
    target: str
    filters: list[Filter]

    @classmethod
    def ofType(cls, target: type, filters: Iterable[Filter]) -> Self:
        return cls(target.__name__.lower(), list(filters))

-# Don't ask why I need to store class names. It's the culmination of a number of bad decisions that I'd rather just keep running with than making the objectively correct choice of fixing at this point.

#

Though, given that I'm literally converting to a list… it probably should be a list and not an iterable

robust ledge
torn viper
robust ledge
#

Does order matter?

harsh anchor
#

just don't mutate it

robust ledge
#

Well, a tuple would be the frozen alternative. A frozen set if Filter is hashable and order doesn't matter.

#

Now I'm curious, does a frozen dataclass allow mutation of a list attribute?

torn viper
#

I'd rather have the assurance that order is preserved (and not have to worry about what counts as a duplicate filter)

nova grove
#

is there any library out there that allows python to crosscompile to windows? I've been compiling with a windows VM so my friends can use my apps and its annoyin

torn viper
edgy krakenBOT
#

Hey @torn viper!

Please edit your message to use a code block

Add a py after the three backticks.

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

This will result in the following:

print('Hello, world!')```
robust ledge
#

That they do. darkoHmm My head, right now, does't like this but I'm also certain I've allowed this before in things I do.

edgy krakenBOT
#

src/trackbear_api/models.py lines 291 to 292

work_ids: list[int]
tag_ids: list[int]```
tropic temple
#

Huh i've never thought about using mutable things in frozen dataclasses. maybe because my only usecase of frozen=True is to make it hashable, which makes using list in it impossible

robust ledge
torn viper
#

-# Probably dataclass' instead of dataclasses'

tropic temple
robust ledge
spark quiver
#

hello everyone im looking to start learning python does anyone know where is a good place to start thank you

edgy krakenBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

chilly whale
edgy krakenBOT
robust ledge
spark quiver
chilly whale
#

one of my favorite Python weirdnesses

torn viper
#

To me it makes sense, since it's no different than in a langauge like Java writing:

final List<int> items = new List();

-# It's been awhile since I did Java, so I could have the grammar wrong there.

robust ledge
#

I like the idea of a frozen dataclass. Python gives me a "close enough" solution. I roll with it, and then get pointed to neat things like this in hindsight.

#

That and anything hashable can be used in sets and I use sets a lot.

#

Set operations make things go brrrr

chilly whale
granite wyvern
torn viper
#

-# Replied to teh wrong thing

chilly whale
#

yes. and that's the explanation for this weirdness.

#

🙂

robust ledge
remote geode
torn viper
remote geode
#

Also seems against python ethos

#

its just the wrong language if u want privacy like that

robust ledge
frail scaffold
#

Whats deepfreeze and deepcopy?

robust ledge
#

I do agree that at some point you cross over a boundary and the request of the system exceeds what it should be able to do.

torn viper
#

At least I'd assume it would be to dict as tuple is to list

remote geode
robust ledge
spare raptor
#

why are all objects heap allocated in python

remote geode
harsh anchor
spare raptor
robust ledge
remote geode
#

I guess a fully slotted class could go on the stack

rapid bridge
#

Python can't do the kind of analysis required to guarantee an object allocated on the stack would actually have no references when the stack pops the frame

remote geode
# spare raptor no

if you can add arbitrary amount of size to an object, how can it safely go on the stack?

rapid bridge
#

And the internals don't allow relocation to try and mitigate this

harsh anchor
#

just don't deallocate it 📈

spare raptor
chilly whale
tropic temple
#

i would assume any language that does reference counting couldn't put their stuff on the stack think_eat

chilly whale
#

at least not without some way to copy it to the heap after the fact

rapid bridge
#

Recently Python even moved parts of the call stack off of the conceptual assembly stack

spare raptor
rapid bridge
peak valve
#

Guys I code with python since 4 years and I have no clue of what language I should learn next. I was thinking something like c++, c or go. Anyone got any suggestions for me

harsh anchor
#

everything in any language should stay alive until it's not used 🥴

rapid bridge
#

Are you suggesting implicitly unboxing values?

slender urchin
rapid bridge
#

Pypy does do that afaik

spare raptor
tropic temple
spare raptor
peak valve
rapid bridge
#

For local variables, pypy would probably unbox those. Maybe Pythons experimental JIT would as well

spare raptor
rapid bridge
#

There's a separate optimization for ints where their instances are reused rather than allocated anew every time.

rapid bridge
chilly whale
torn viper
rapid bridge
rustic needle
charred python
#

That is "being used". Remembered for later.

rapid bridge
chilly whale
rapid bridge
#

Cache can't even use a weak dict

#

It just kinda has to work like that

spare raptor
# rapid bridge Yea

like how js does it with like (not exactly)

struct Object { 
  ObjectType type;
  void* ptr;
  
  short small_int;
};
rustic needle
spare raptor
rapid bridge
spare raptor
chilly whale
rustic needle
rapid bridge
#

(to be clear, so would a real JS impl)

spare raptor
chilly whale
#

no, that's not what I mean

rapid bridge
#

Even if the first was lost before the second one was even constructed

chilly whale
#

I mean that even if you do ```py
x = 10
y = 9 + 1
z = int("10")

spare raptor
#

java does similarly with like strings

chilly whale
#

!e ```py
x = 10
y = 9 + 1
z = int("10")
print(x is y is z)

edgy krakenBOT
spare raptor
#

nice

chilly whale
#

which means that if the integers were put on the stack, the program would use more memory, not less, and have less cache locality, not more

charred python
spare raptor
rapid bridge
#

If you consider the cache in a thumbnail service, keyed by say ("path", w, h), the tuple of a previous invocation would be long gone before the next invocation could happen given a weakdict (of course, functools.cache would be incorrect here)

chilly whale
charred python
#

ahh, ok 😌

chilly whale
#

it's the "small integer cache"

rustic needle
chilly whale
silver plover
chilly whale
#

Python already interns strings pretty aggressively, and lets you choose to intern strings yourself if you want something even more aggressive

spare raptor
rustic needle
chilly whale
silver plover
#

Oh, I don't really see the current behavior as 'aggressive', more opportunistic/ low hanging fruit, as I understand it. I've never directly used intern... I know it's there, but somewhat wondered if it should be used more widely. Or perhaps it is in some libs I use, dunno.

rapid bridge
#

It's not possible to check anywhere but at runtime

chilly whale
rustic needle
spare raptor
rapid bridge
chilly whale
rustic needle
chilly whale
#

sum takes arbitrary Python objects. You need everything you pass to sum to be a PyObject* (or some similar discriminated union)

spare raptor
chilly whale
#

it wouldn't help, because it could still take something that's not an int

#

or an int that's larger than the limit of long long

spare raptor
chilly whale
#

that works until someone wants to pass a 129 bit int

spare raptor
#

can python ints scale infinitely?

chilly whale
#

yes

spare raptor
#

ah

#

yea that would be difficult

#

to get py ints on the stack

chilly whale
#

even setting that aside, think of functions like print

rapid bridge
#

You can assume the sum is given only integers within the scope, construct byte code that assumes this, and when it turns out it's wrong, rewrite the bytecode to do the more general setup

chilly whale
#

print takes completely arbitrary objects

charred python
#

I can finally count all the atoms in the observable universe?

rapid bridge
#

Tho I think they go general -> specific

spare raptor
#

hm

spare raptor
chilly whale
#

it's not really analogous, no

#

printf in C takes a format string that tells you how to interpret each of the things you've passed it

#

print in Python doesn't have a parameter like that, so print needs to discover for itself what type each argument is

spare raptor
#

hm

#

python types could provide optimizations

#

in the future maybe

chilly whale
#

in printf, the format string is the discriminator, in print the ob_type field of the PyObject structure is the discriminator

spare raptor
chilly whale
#

🙇‍♂️

granite wyvern
chilly whale
#

yes, sure

spare raptor
chilly whale
#

but even so, the point is that it couldn't just take a long long off the stack

rapid bridge
#

str is looked up on the ob_type

chilly whale
#

it needs to be passed something that tells it that the pointer it's been passed should be treated as a pointer to a long long and not to some other type of thing

spare raptor
#

yea

chilly whale
#

you can only get rid of the PyObject wrapper if you replace it with some other way to introspect the type

spare raptor
#

dynamic typing is difficult to optimize it seems

spare raptor
rapid bridge
#

The idea would of course be to implement everything a second time for long long specifically, and wrap it back into PyObject when needed. It'd be pretty nightmarish in practice tho

#

Graalpy does work like this

chilly whale
#

either that, or have a new base type of PyObject with an extra field saying whether this thing is a PyObject or some optimized type

#

or jam that directly into PyObject

spare raptor
chilly whale
#

not for all objects, no

spare raptor
chilly whale
#

I mean, very easy example, you could make the ob_type field store a sentinel that indicates that this is some optimized type

spare raptor
chilly whale
#

like, if ob_type == 0x1 then the ob_refcnt field isn't a refcount at all but the value of an integer object

#

you can do this, and it would save space, but it would probably cost far too much CPU by littering special cases everywhere

#

there is no ob_ptr field

spare raptor
#

like whatever points to the underlying object

chilly whale
#

PyObject is 16 bytes, composed of exatly 2 fields, each 8 bytes - ob_type and ob_refcnt

spare raptor
chilly whale
#

after the PyObject header

#

all objects start with the same common prefix, and the ob_type field dictates what comes after that prefix (and before it, actually, because the gc sticks some fields before it depending on the type)

spare raptor
#

ah

#

so pyobject is dynamic size

chilly whale
#

more or less...

#

the better way to think of it is that PyObject is a base class, that base class is 16 bytes, and subclasses of it might be larger

chilly whale
#

no, but its memory layout is very similar to one

spare raptor
#

so like

#
struct Point { 
  // PyObject header
  int x;
  int y;
};
edgy krakenBOT
#

Include/cpython/longintrepr.h lines 93 to 101

typedef struct _PyLongValue {
    uintptr_t lv_tag; /* Number of digits, sign and flags */
    digit ob_digit[1];
} _PyLongValue;

struct _longobject {
    PyObject_HEAD
    _PyLongValue long_value;
};```
chilly whale
#

the memory layout of a Python int object is:

PyTypeObject *ob_type;
Py_ssize_t ob_refcnt;
uintptr_t lv_tag;
digit ob_digit[n];
spare raptor
chilly whale
#

yep

spare raptor
#

that's cool, but how are these put in arrays?

chilly whale
#

that's more or less how a tuple looks in memory

spare raptor
#

it seems like it would be very slow to iterate over them, because you have to figure out each element's type, then increment the pointer by that many bytes

#

is that why for loops are slow in python?

chilly whale
#

you don't usually put a PyObject itself in an array, you usually put a pointer to it in the array

spare raptor
#

oh

dusk adder
#

would you prefer it if python used curly braces instead of : and indent?

granite wyvern
edgy krakenBOT
spare raptor
dusk adder
celest osprey
#

because python is a stack vm so it pushes and pops and decref/increfs the refcount of each object in the for-loop

fervent plank
#

man

#

why do I find python harder than java 😭🙏

celest osprey
#

subjective but I think most people would say otherwise

robust ledge
granite wyvern
dusk adder
spare raptor
chilly whale
# spare raptor oh

like a Python list is basically ```c
PyTypeObject *ob_type;
Py_ssize_t ob_refcnt;
Py_ssize_t ob_size;
PyObject **ob_item;
Py_ssize_t allocated;

chilly whale
spare raptor
chilly whale
#

if you're comparing to C loops, it's apples to oranges. C loops know that they're only dealing with integers. Python loops can deal with any type of object, so there's overhead involved in figuring out what types of objects they're dealing with

celest osprey
# spare raptor please elaborate?

Python's interpreter is a stack machine, and it executes bytecode.
The interpreter reads the bytecodes, and some bytecodes push values onto the stack and some pop values onto the stack. Because of the pushing and popping, the stack owns a reference to the object and it has to increment the refcount and decref it when it is popped of the stack, so there is a lot more overhead. Not to mention the dynamic typechecking which adds evern more overhead

spare raptor
chilly whale
#

in Python you can do for line in file: or for elem in some_list: or for number in itertools.count():. That abstraction isn't free, and since Python is an interpreted language it doesn't know until runtime what type of object it's actually looping over

spare raptor
#

ah

#

so dynamic typing is difficult

celest osprey
#

i mean yeah it's slow ig

spice hill
#

that should hopefully improve once the JIT gets better

celest osprey
#

so to optimise python you got to assume types

#

and then fallback if that assumption fails

spare raptor
#

also the gil is being removed, what is it being replaced with?

celest osprey
#

it's not being replaced with anything, it just allows for free-threaded python, afaik

spare raptor
chilly whale
spare raptor
chilly whale
#

everywhere 👀

spare raptor
#

like what gets wrapped in a mutex

chilly whale
#

but in particular, in free-threaded builds, every object contains a mutex for locking access to that object

spare raptor
#

ah

chilly whale
#

and there's other types of locks, too

spare raptor
#

so is that in like the pointer to the pyobject or the pyobject itself

chilly whale
#

in the pyobject itself, I believe

spare raptor
edgy krakenBOT
#

Include/object.h lines 156 to 167

struct _object {
    // ob_tid stores the thread id (or zero). It is also used by the GC and the
    // trashcan mechanism as a linked list pointer and by the GC to store the
    // computed "gc_refs" refcount.
    _Py_ALIGNED_DEF(_PyObject_MIN_ALIGNMENT, uintptr_t) ob_tid;
    uint16_t ob_flags;
    PyMutex ob_mutex;           // per-object lock
    uint8_t ob_gc_bits;         // gc-related state
    uint32_t ob_ref_local;      // local reference count
    Py_ssize_t ob_ref_shared;   // shared (atomic) reference count
    PyTypeObject *ob_type;
};```
chilly whale
#

yep

spare raptor
#

what is _object?

#

a gc object?

chilly whale
#

every object

spare raptor
#

ah

chilly whale
#

PyObject is a typedef of struct _object

fervent plank
#

I tried python first it was too hard, then I tried java and found it easy

spare raptor
#

oh

#

well, java makes things more clear

fervent plank
#

ppl told me python is simple

harsh anchor
#

it's about as easy as java

spare raptor
#
public static int add(int a, int b);

this tells you everything you need to know

def add(a: int, b: int) -> int

these types are optional in python, which means you sometimes just dont know

fervent plank
#

I think that's the reason

chilly whale
robust ledge
chilly whale
#

the biggest part of learning to program isn't learning any specific language, it's learning concepts - what's a function? what's a variable? what's a loop? how do I read this error message? - and a lot of that is common no matter what language you're using

fervent plank
# robust ledge Usually is.

yeah in college when we code with python it's in stuff like Webot which I'm not interested in and I don't understand, but when we code in java it's stuff small window applications, many console-based programs etc etc

#

so ig I associate python with hard stuff I don't understand

chilly whale
#

it definitely is much easier to learn if you find what you're writing interesting

fervent plank
fervent plank
robust ledge
#

They do. They teach you how to learn.

fervent plank
#

I don't get why this "webot" thing was even there in the first semester

fervent plank
frosty oriole
#

you just need to get past the introductory stuff

chilly whale
# granite wyvern It really doesn't care much. `obj.__str__` FTW.

hey, wait - I let this slip by earlier, but this is wrong. It does care, because the type is the thing that holds obj.__str__! You can't get the __str__ without the type (the PyObject points to the PyTypeObject, and the PyTypeObject contains the tp_str field). You're right that it doesn't have, like a switch over every possible type, but it instead indirects through a vtable owned by the type.

fervent plank
#

okay thanks for making me realize chat

chilly whale
#

for what it's worth, Python and Java are very similar languages, in the grand scheme of things. If you get good with either one, you'll be able to pick up the other one pretty quickly.

harsh anchor
#

quite

pallid garden
#

ive never thought of python and java as "similar"

#

then again, i dont know java in-depth enough

finite rose
#

Java is based on C

dry pike
#

You could even say that Java is the father of Python

rugged barn
#

A lot of concepts are very transferable

#

Which I found incredibly nice

pallid garden
#

i mean...

#

ive never had to think of private/public in python

robust ledge
pallid garden
#

or return type of main

finite rose
#

I think most Turing-complete languages are going to share many similarities

pallid garden
#

i dont think there's a concept of static in python?

finite rose
#

Static methods?

pallid garden
#

static class

dry pike
pallid garden
#

or rather, static functions

dry pike
robust ledge
rugged barn
#

!d staticmethod

edgy krakenBOT
#

@staticmethod```
Transform a method into a static method.

A static method does not receive an implicit first argument. To declare a static method, use this idiom...
finite rose
#

A static class in Java is really just a scoping control

pallid garden
rugged barn
#

pithink How would that look like?

robust ledge
pallid garden
#

-# yes ive just been listing each of the keywords from public static void main

dry pike
#

mods, get her

rugged barn
#

Mods, mods!

pallid garden
#

wait what

rugged barn
#

Also, minor rant

#

But I actively dislike the "right way" to write Javadocs

#

Because what do you mean, I'm supposed to write @implsec on the documentation

#

Teaching people how to implement stuff is weird

finite rose
#

Well in Java there’s no such thing as “outside a class.” There is no global space like in Python

pallid garden
#

correct

#

and so... i struggle to think of them as "similar"

#

there are so many differences between them

rugged barn
#

There are many similarities too

#

Depends on where you look

pallid garden
#

there's no list comprehension in java

robust ledge
rugged barn
#

I don't usually write them on the docstring

#

I usually do that on a separate document so I can easily share as markdown

pallid garden
#

java never had a GIL

#

etc, etc.

autumn pelican
rugged barn
#

I kinda get that Java is a lot more contract-bound and all that but, I don't find it great to tell people how to do things

#

But when in Rome, do as the Romans so
Whatever

robust ledge
#

The way I see it, even the function signature is telling the next-dev what to do. If it's any more complex than that, the instructions in the docstring only further helps the next-dev.

wet fox
#

once i got to concurrency in java i was out

#

ugly looking code

#

still my first lang and has a place in my heart

#

for a video game funny enough that wasn't minecraft

finite rose
#

A static method in Java is the same kind of thing as a static method in a Python class…… mostly.

wet fox
#

for a private server 👿

dry yacht
wet fox
finite rose
#

But Python gives you three scopes in a class, instance, class, and static. Java only has instance and static. I’m tbh I still don’t really understand the difference between a static and class method in Python, other than you cannot refer to a static class method via an instance reference, only via the class name reference, like Foo.my_static_method()

autumn pelican
spice hill
#

@staticmethod could arguably be removed from python with no major loss (besides breaking existing code)

jagged belfry
edgy krakenBOT
finite rose
#

Well I was lied to! See, even the one thing I thought I knew I didn’t know

#

So what’s the difference then?

spice hill
dry pike
#

classmethod gets the current subclass passed

jagged belfry
#

Static methods are methods that are organized with a class, and are passed nothing by default.
Class methods are methods that operate on the class, and are passed the class as cls by default.
Instance methods are methods that operate on the instance, and are passed the instance as self by default.

finite rose
#

Not to confuse the issue, but a “static” method in Java aligns more closely to what you’d call a class method in Python

charred tusk
#

I don’t really get why static methods need to exist

finite rose
#

static methods in Java know what Class they belong to

spice hill
#

actually, maybe not quite...

#

Can you override a static method in a subclas in Java?

finite rose
#

So static methods in Python seem to just be a namespace for methods.

steel whale
#

does anyone have an article about how the L3 cache works?

charred tusk
#

On your CPU?

steel whale
#

the general workflow of most L3 caches

jagged belfry
finite rose
dry pike
#

what happens if you call the Java static method from a subclass? it still refers to the superclass?

dry yacht
finite rose
#

And that’s generally considered bad practice in Java, whereas in Python (and I think JavaScript?) it’s a useful feature.

dry yacht
steel whale
rugged barn
#

you arguably can do static with classmethods anyway but like
eh

#

classmethods are much more powerful

finite rose
dry yacht
# dry yacht It depends on the static type of the object

@dry pike Java has two types for each variable: The static type and the dynamic type
If you do:

A variable = new B();  // assuming B inherits from A
variable.func();
```then the static type of `variable` is `A`, but the dynamic type of `variable` is `B`, so if `A` has a `static` function `func()` then it would call `A.func()`, even if `B` overloads it
dry pike
#

but I mean, within the functin

#

because someone said that the function gets a reference to the type

rugged barn
#

the only like, actual valid reason may be semantics

dry yacht
timid ember
#

dude how do you read the pyrr documentation

finite rose
#

It’s bad form to call a static method from an instance variable because of the possible confusion. So you would call Foo.aStaticMethod() from an instance method in the Foo class and never this.aStaticMethod() and then you will never be surprised.

timid ember
#

i had to go to the source code to find what the parameters of a matrix creation function expect

spice hill
# finite rose No, you can hide them though by redeclaring a static method with the same name. ...

!e
That's the difference between static methods in Java and class methods in Python then. You can do this in Python: ```py
import math

class Point:
def init(self, x, y):
self.x = x
self.y = y
@classmethod
def from_xy(cls, x, y):
return cls(x, y)
@classmethod
def from_polar(cls, dist, angle):
return cls.from_xy(math.cos(angle) * dist, math.sin(angle) * dist)

class LoggedPoint(Point):
@classmethod
def from_xy(cls, x, y):
print(f"creating a point with {x=} and {y=}")
return super().from_xy(x, y)

p = LoggedPoint.from_polar(425.63012111456584, 0.1628311844604171)
print(p.x, p.y)

edgy krakenBOT
finite rose
#

Yes, class methods can be overridden in subclasses. It’s nice. You can probably only do it in Python because it’s a dynamic language. Java resolves a lot of things at compile time so they are fixed in stone at runtime, whereas Python can happily redefine your foo:str variable to be foo:int at runtime. Now, the fact that you can do something like this doesn’t mean you should do something like this.

robust ledge
#

Substitution principle was respected in their example though.

spice hill
#

LSP is kind of a handwavy thing

finite rose
#

It’s an aspirational goal, not a roadblock

#

Is a square really a subclass of a rectangle? It depends.

spice hill
#

Whether a subclass method is compatible with the superclass method depends on what promises the superclass makes. If the code has no docstrings or comments, one is often left to speculate what the intended promises were

finite rose
#

a square has a restriction imposed on it that rectangle doesn’t have. Then again, a square can just be a degenerate case of a rectangle where width = height

jagged belfry
#

I guess here's an example of where staticmethod is helpful:


class Shape:
  @staticmethod
  def compute_area():
    raise NotImplemented

  def area(self):
    raise NotImplemented


class Rect(Shape):
  def __init__(self, width: int, height: int):
    self.width = width
    self.height = height


  @staticmethod
  def compute_area(width: int, height: int) -> int:
    return width * height

  def area(self):
    return self.compute_area(self.width, self.height)

data = Rect(5, 5)
if data.area() > Rect.compute_area(5, 4):
    pass
steel whale
#

i'm having fun with SIMD

spice hill
jagged belfry
#

To raise if the subclass is improperly implemented. Could be an ABC but I didn't bother

steel whale
#
Collecting numpy
  Downloading numpy-2.4.1.tar.gz (20.7 MB)
     ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.8/20.7 MB 18.5 kB/s eta 0:17:56
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (786 kB/20.7 MB, attempt 1)
  Resuming download numpy-2.4.1.tar.gz (786 kB/20.7 MB)
     ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.8/20.7 MB ? eta -:--:--```
what the fuck is my ISP on
granite wyvern
granite wyvern
jagged belfry
#

18.5 kB/s
What year is it

#

It's 1995. I'm getting 18.5kb/s on a download over my isp via dial-up
It's 2026. I'm getting 18.5kb/s on a download over my isp

spice hill
#

148 kb/s in 1995 was probably very good

spice hill
edgy krakenBOT
steel whale
#

they genuinely have something against me icl

granite wyvern
#

18kbps was pretty good for dial up. ISTR that trailblazer modems would achieve that, and not much else. At one point, anyway.

dry pike
#

wait you can get 11Gbps in some places now?

#

oh god nvm, 50Gbps

#

that means you could (theoretically) download 1TB of data in 160 seconds

chilly whale
# pallid garden ive never thought of python and java as "similar"

Python and Java are both high level object oriented garbage collected imperative procedural algol-derived languages where objects are passed by and assigned by reference. And both are compiled to bytecode and then interpreted by a virtual machine. They're very similar in the grand scheme of things. Both of them are much more like each other than something like Fortran or even something like C

spice hill
#

yeah, the big difference is static and dynamic typing

#

otherwise, pretty similar

charred tusk
dry pike
#

yeah this is consumer, Ziply Fiber that I found online

#

I assumed enterprise stuff was much higher since a while ago

charred tusk
#

Can I just like, live, in the data center?
All I need is a sleeping bag
I just want the Ethernet cable

granite wyvern
charred tusk
#

That’s okay

granite wyvern
#

And a warm coat or something.

charred tusk
#

I’ve got fur

#

Now what about this thing labeled “halon”??

granite wyvern
ionic bluff
#

certain spots are not so bad in a dc.

charred tusk
#

Do I inhale or exhale first?

granite wyvern
ionic bluff
#

having to stand in a cold aisle does suck after a few minutes.

dry pike
#

first exhale, then exhale again

#

then forgot how to inhale for 10 seconds

#

then inhale

jagged belfry
dry pike
#

what if we put fiber in da PC

jagged belfry
#

you can do that

dry pike
#

lemme guess it's so expensive that no one makes those

dry pike
jagged belfry
#

Amazon has a bundle: PCIE card to SFP, SFP transceiver, 3.8m cable for 48$

#

of course, you need a router, and probably a longer cable, but like

dry pike
#

why would you need a router

jagged belfry
#

Well, because this replaces ethernet?

dry pike
#

it's not replacing ethernet wdym

#

fiber within the PC, not to the PC

jagged belfry
#

oh

granite wyvern
#

It's a NIC. Replaces an ethernet NIC.

jagged belfry
#

Yeah, and a fiber cable, replaces the etehrnet cable

granite wyvern
#

I went looking for "optical sata" and didn't get what I wanted.

jagged belfry
#

Fiber within the pc isn't worth it. Too many turns and you're already electrically so close the translation between light and electric isn't worth it

dry pike
#

does it introduce some latency?

#

wow, optical computer

granite wyvern
jagged belfry
dry pike
#

that's what I meant

dry pike
jagged belfry
#

Probably? Like, I'm gonna be real, if we die it'll be self-inflicted. Modern crops and fertilizer techniques aren't going away and could resurrect us even after most apocalypse scenarios. Despite the global economic chaos, "Everyone is gonna die" isn't particularly realistic. It's hard to kill an entire species. To clarify, if the US set up a relatively small array of modern nuclear reactors, it could reverse the flow of the mississippi river and desalinate all the water needed.

#

As for individuals, idk. Depends. A fucked up political state can last a few centuries, but the internet has kind of changed everything (and with the advent of mesh and ham networks, isn't going away ever)

dry pike
jagged belfry
#

And there are trillions of species on the planet. As bad of an ecosystem disaster as it is, there is a big difference between a disaster and obliteration.

#

You can think of it in terms of nines of uptime/reliability

dry pike
#

I don't know what "nines" means

silent whale
jagged belfry
#

99.99% (4 nines) is 52 minutes of downtime per year

granite wyvern
#

which is 3 9s.

jagged belfry
#

99.9999% (6 nines) is 32 seconds of downtime yearly

fiery yarrow
jagged belfry
#

It's estimated there are about 8 million species on earth. 99.9999% of 8 million is 8 species lost per year

dry pike
#

I think a puzzle site I play on has about 3 nines scheduled

jagged belfry
#

Now there's a lot of impact variance. For example, there's a lot of species of bugs and bacteria that are not as striking as losing big cats or rare birds.

#

But to drag this back to humanity

jagged belfry
#

At one point in history, it's estimated there were about 1300 humans left alive.

dry pike
#

the world was so close to healing

jagged belfry
#

To get there from today, 99.9999999% of humanity would need to die

#

nine nines. That's just intrinsically difficult. Not much in reality can be that thorough. so, no, I don't think there's a concern there in a "wipe out" moment. Same with regular cats and regular dogs.

silent whale
fiery yarrow
#

catastrophic events to large-scale environments can occur when a single species disappears

silent whale
granite wyvern
#

This all came from NWJ asking if we would live longer enough to see all optical computers.

jagged belfry
#

No. It's that humanity is very far from it.

#

It also relates to optical computation as it exists today

#

A modern CPU has a bit error rate somewhere south of 1/10^12

dry pike
#

apparently quantum entanglement is not instant

jagged belfry
#

or 99.9999999999% accuracy

#

If you want to compete, then optical transistors also must reach that error rate, which is (IIRC) one of the main struggles today with that and quantum chips

silent whale
dry pike
jagged belfry
#

My blog is six nines, roughly

#

discord.. significantly less

#

github less than discord

dry pike
#

how much work did it take to get your blog to 69s?

half pewter
#

coming dangerously close to six sevens

jagged belfry
#

Not much. A stable framework, nginx, and then hosting it on a vps instead of a cloud service.

fiery yarrow
#

32 millis is 9 nines

tropic temple
fiery yarrow
#

the 3d printing website thingiverse is infamous for being constantly broken. there's a joke their uptime isn't 5 nines, but 9 fives

dry pike
#

What if we do hexadecimal

#

4 Fs

fiery yarrow
#

huh, not usually the case where one can pull an "i saw that" on nedbat

pallid garden
#

good morning (again)

ashen cipher
#

well depending on what website wer'e tlaking abuot

fiery yarrow
#

that's too high. make it 12 zeros

ashen cipher
#

i mean it needs to be up for a bit

#

10 zeros sounds more correct

pallid garden
#

if my website is hosted on say, cloudflare, and cloudflare goes down, how could i switch over to aws programmatically?

harsh anchor
#

what do you mean by "hosted"

pallid garden
#

change dns record?

pallid garden
#

just a simple html

pallid garden
harsh anchor
#

you can't

robust ledge
#

Are you looking for a DNS failover solution?

pallid garden
#

huh, i never heard of that

#

let me look into it

pallid garden
pallid garden
#

or does this mean when the dns goes down, a secondary dns takes over

robust ledge
#

I'm confused by "dns goes down".

pallid garden
#

so what happens when cloudflare goes down?

#

like last year

robust ledge
pallid garden
#

my website worked just fine, it was on aws

robust ledge
#

You want a multi-cloud solution?

pallid garden
#

i guess if you want a service to survive these kind of events, you basically need to be the nameserver?

robust ledge
#

It sounds like you want load balancing (or whatever name said service calls it). Mutli-cloud just means you're using more than a single cloud provider. To your "what if cloudflare goes down"; there are 300+ cloudflare datacenters. Not all of them go down at once. If all of cloudflare disappeared, nobody would care your website was down. Least of all, you.

pallid garden
#

i can imagine having my website hosted on vercel (and by proxy, aws), cloudflare and on-prem, and then just having the dns failover to the secondary and tertiary host

#

but if the dns nameserver goes down theres basically nothing you can do?

robust ledge
#

The DNS host that can change the route needs to be somewhere.

pallid garden
#

If all of cloudflare disappeared, nobody would care your website was down. Least of all, you.
this is just an hypothetical scenario

robust ledge
#

Hypothetically, that is a freaking doomsday situation. darkoMEGALUL

pallid garden
#

im not actually going to spend the engineering effort to ensure my little site survives internet catastrophes

#

this is all just academic discussion

robust ledge
pallid garden
#

i dont even know whether my question even makes sense

#

turns out it is possible, but it's only for enterprise customers

robust ledge
#

🤷‍♀️ I think I know what you're asking. But take the AWS us-east-1 dynamodb issues that took down a chunk of the internet for a day. The takeaway for corps there wasn't that they needed a multi-cloud solution. They just needed to use what they had more correctly. ((multi-region in the case of aws))

#

So maybe work on being resilient to failure in your cloud of choice. Once those patterns are understood you can tackle the increased difficulty of a multi-cloud solution.

pallid garden
#

my surface-level understanding of nameservers goes like this: if i request for say example.com, and their nameservers is cloudflare, my computer first gets directed to cloudflare dns to ask for the IP address, and then it gets directed to that IP address where the site is hosted

#

so what if the cloudflare dns goes down?

#

suppose i need this service to be like crazy resilient

robust ledge
#

The world cries.

granite wyvern
#

Anyone dependent only on them is stuck.
Most people have a few.

granite wyvern
#

Eg 1.1.1.1 (cloudflare) 8.8.4.4 (google) and etc

pallid garden
#

it's possible to have your records on multiple dns nameservers?

granite wyvern
#

I'm talking about the upstream nameservers a client like your laptop might use. On UNIX, the /etc/resolv.conf file.

pallid garden
granite wyvern
pallid garden
#

so if cloudflare goes down, will i still be able to access my site through quad9, which i have registered on cloudflare?

robust ledge
#

Define "goes down".

granite wyvern
#

So my laptop here's using:

search wauk
nameserver 172.16.3.1
nameserver 1.1.1.1

at present. The 172 address is my home firewall/dns/dhcp server.
The 1.1.1.1 is cloudflare.

pallid garden
granite wyvern
#

Zones are usually hosted on multiple machines/services also.

pallid garden
#

i should probably look into it

granite wyvern
#

It's the collection of records for a domain.

pallid garden
#

so i can host it on multiple services?

#

i can use both cloudflare dns AND route 53?

#

turns out yes

#

and this is quite commonplace

granite wyvern
dry pike
granite wyvern
#

NS == nameserver

robust ledge
granite wyvern
#

So when you talk to a public service like 1.1.1.1 it in turn talks to other DNS servers to get your answers. There's lots of caching.

pallid garden
#

OOMs

granite wyvern
#

More swap.

robust ledge
#

Just buy more memory.

granite wyvern
#

Or fast disc.

pallid garden
dry pike
robust ledge
dry pike
#

also, rust is always on topic

#

also, it's just a fun emoji

pallid garden
dry pike
#

mods will say it's not, but that's because of their programming

#

deep down they know

pallid garden
#

TIL route 53 is called route 53 because dns port is 53

robust ledge
#

Just wait until you learn why boto3 is called boto.

pallid garden
#

idk, why is boto3 called boto

granite wyvern
#

Why is GNU called GNU?

pallid garden
#

bottle dolphin?

#

OHHHHHHHHHH AMAZON

#

haha

robust ledge
#

🐬

granite wyvern
pallid garden
#

boto is apparently a species of bottle dolphin that lives in the amazon river, which is a play on amazon web service

crystal scarab
#

i used python for something that has made my life easier, and it is amazing (im very new to coding)

barren sentinel
#

Any thoughts for making this faster? I want to try removing a directory, run a command, then put it back if it fails. Currently I’m using shutil.move + tempdir.TemporaryDirectory, but it’s very slow for large folders. Any ideas for speeding it up?

crystal scarab
#

like 10x faster then how fast used to do it

#

just felt like saying that here

pallid garden
orchid pier
#

Python too hard bro

pallid garden
barren sentinel
pallid garden
#

i see

#

hmmm

#

maybe ignore all **.temp.**?

crystal scarab
# robust ledge Sweet! What'd ya do?

i work at a car dealership, and i have to make facebook ads (no i did not make an auto fb ad maker and am not advertising 😭) but it just scrapes info from my companys website using selinium, then i have a little qt gui that comes up and it fills in the answers for the fb prompts, and it also downloads the listings images so theryre easy access and i experimented with threading for the first time, and it made the scrapping go from 2 min to 20 sec, and it felt like i waas einstein, and i made the gui really pretty took me like 2 days, all around went from taking 20 minutes to making a fb add to 2 min, i just have copy and paste boxes for the writable stuff

#

its not automated just makes life easier

pallid garden
#

🎉

barren sentinel
#

Ooh, that is an idea. Similar would also be like adding a command line config for forced ignoring a file, though that would be hard to persist

pallid garden
#

oh right

#

that might work

crystal scarab
#

i dont have img perms

#

😭

#

how do you get img perms

barren sentinel
#

Either of these would also make it easier to re-run, since it things go wrong it’s quite annoying having to unzip a 1 gig zip again

crystal scarab
pallid garden
barren sentinel
# crystal scarab i dont have img perms

You can’t, at least for this channel. You can post images in any of the off topics or in the help post channels though (though also please don’t dox yourself)

crystal scarab
pallid garden
crystal scarab
barren sentinel
#

Gaming, what ui framework did you use?

crystal scarab
#

pyqt5

barren sentinel
#

Hm, I might have to push that up my list of ones to look at from my project

crystal scarab
#

emojis make everything look better😎

barren sentinel
#

(For those in the know I still haven’t pinned down what to use for my regex visualizer ;-;)

crystal scarab
#

it auto opens my dealerships page, aswell as my fb, and it saves the cookies for my fb, and also has a feature to delete those cookies its amazing

pallid garden
crystal scarab
#

so emojis on top

pallid garden
#

i guess im too boring a person haha

barren sentinel
#

Though I did have an idea for making a backend-agnostic easily transpilable gui framework, does this sound completely insane or semi reasonable?

It would be immediate mode, based around only percent-based or absolute positions (so no flex boxes) layouting outside-in

crystal scarab
#

i also just sent a photo of what it looks like when i input a url

#

the cycle took 14 secounds to pull all the data

pallid garden
barren sentinel
fathom vortex
crystal scarab
# pallid garden how many pages?

it pulles one listing, i downloaded 20 images, ran all the info in open ai to get a description, and pulled all the web data for the info to fill in things, it could prob be faster but im happy with it for now

pallid garden
#

i guess it's way faster to code it like this

crystal scarab
#

im also very new to coding

#

i started learning python maybe 4-5 weeks ago

pallid garden
#

oh wow that's impressive

barren sentinel
# fathom vortex A GUI framework without Flex boxes would be kinda useless tho?

That’s one of the main things I’ve been thinking about with this, since I really like immediate mode, but that makes flex boxes basically impossible easily, so my idea is to have inside out layouting using only absolute positions or percentage based sizes which should cover my needs, since I don’t see myself needing flex boxes for most of my uis

fathom vortex
#

If it works for ya, cant say much about it

#

I have written a layout engine and yeah, flex boxes make things tons complicated

crystal scarab
# pallid garden oh wow that's impressive

my job said i was alowwed to spend time doing anything that would help me sell more cars, i have been spending atleast 8-12 hours a day learning to code for the last 35 ish days 💀

crystal scarab
#

my brain hurts beyond belife

white knot
#

Wow am learning new patterns from copilot suggestions

dry pike
#

hope they aren't antipatterns

fathom vortex
#

Writing code like an llm is not desirable skill to have

white knot
#

Ah but they are quite easy when i think about it.

Like its inserting to a db. I thought of dumping everything at once or one by one

But it suggest to make it into chunks which is better for network calls

white knot
dry pike
#

how would you know that they're good?

fathom vortex
white knot
dry pike
#

but why would middle ground be better?

fathom vortex
#

That feeling is called intuition and you get that from experience

white knot
fathom vortex
#

Ideally dont really use AI for learning, take stackoverflow or other resources

white knot
fathom vortex
#

Batching isnt always faster

dry pike
white knot
dry pike
#

that's probably quite within range of default limits of the web server you are interacting with

white knot
#

Oh

#

I thought supabase would block me

dry pike
#

you think they would block one large request and not a bunch of chunks of the same data?

dry pike
#

the chunks take more resources to deal with

white knot
#

So i have to time.sleep it ?

dry pike
#

for what reason?

#

if you can do it all in one request, do that

white knot
#

Ok I will try. But this what copilot suggested

granite wyvern
dry pike
white knot
barren sentinel
granite wyvern
#

Well I'd have thought so, but yousaid it was slow.

#

A cross device move involves a recursive tree copy, which would be slow. But on the same fs? Just a rename of the top dir3ectory should be immediate.

barren sentinel
#

I don’t that that matters for this, but that is actually a good thought, since in one of my setups the default tempdir behavior would make the rename cross-drive

granite wyvern
#

You can tell TemporaryDirectory to put the directory in the same directory as the thing it will be replacing. If you're doing what it sounds like you're doing.

barren sentinel
#

But then it would still be discoverable

granite wyvern
#

With eg listdir? Yes. But it will be unreadable IIRC (at least by people who aren't you).

barren sentinel
#

By the program being run (ty in this case)

granite wyvern
#

It's not clear to me what your use case is. I've got an atomic_filename(target_filename,.....) context decorator I use to make files atomicly. Make a temp file, write to it, rename to the target file is nothing goes wrong. And I've a similar thing for directries.

granite wyvern
#

Sorry, temp dir. But the same applies.

#

I don't know ty's habits, but most things won't bother examineing dot names (.foo)

barren sentinel
#

Hm, would module discovery still happen if the file was renamed

granite wyvern
#

Again, I don't really know what you're doing.

#

If you need to import stuff, having the right dirs in sys.path does the trick. If you're doing something else, provide details.

marsh fulcrum
#

Hello

barren sentinel
marsh fulcrum
#

I am a Python script developer

granite wyvern
#

So:

  • move something away, try ty
  • repeat until happy?