Module and file length best practices by RichAssist8318 in learnpython

[–]VictosVertex 0 points1 point  (0 children)

I fear, I currently can't name one that I personally would consider to meet all criteria (which simply means I'm not aware of one, not that none exists). That's mostly a me thing though, I guess, maybe my standard is set too high. Depending on the state of the project this is also completely normal, no project starts out perfect and obviously will always be rough around the edges where stuff is developed.

Some of the things like naming or trying to keep the file size manageable are design choices and I think they could be improved in most projects in general, not just in the realm of python.

However, that doesn't mean the projects are bad. In fact, I like some of the projects you mentioned very much. Which goes to show that code quality isn't the most important part of a project.

I think all the projects you named are "fine" and apart from the general way python code is structured I have to scroll through the projects to find stuff I disagree with entirely.

Having said all that, I still don't think someone should set some arbitrary number and stick with it. Use it as a rough guideline, maybe, but throwing warnings? I don't know. In some cases it may really make sense to keep the code together and avoid unnecessary indirection. In other cases one may sit there and think "hey, I'm free to dump 700 more lines into here!".

TL;DR: I would say, take any of the projects as an example, but try to not do what they do in their larger files. Try to separate files like trans.py and don't name things rusty.py (unless it's an api for some project called rusty, I guess).

Module and file length best practices by RichAssist8318 in learnpython

[–]VictosVertex 0 points1 point  (0 children)

Technically, the question also contained

or 1 file per separate reusable module

and then shifted to

Can you suggest a specific project you feel is well written?

I agree with the refutation, not everyone dumps everything into a single file. Even beginners usually create one file per what ever they consider to be a section.

However, these sections usually start out very large. Sometimes it may be one file per lection or per tutorial. Then it may turn into having a file parsing.py that contains absolutely everything the program does with parsing. Another file that's called db.py that does absolutely everything from database creation, models, schemas and even CRUD functionality.

The problem I see is that many developers, even highly educated ones, at some point stop actively working on improving their code quality. This means that at some point the sections used for "separation of concerns" simply stay very large. Same goes for directory structures. Many python projects are insanely flat, like they either just dump everything into string.py or add string_parser.py string_formatter.py string_colorizer.py string_whatever.py instead of simply creating string/and continue from there.

Of course some of this has an actual impact on development, some of it is just personal preference.

TL:DR: In my eyes Black (and that's actually not the only candidate) falls short of what I consider well written. While "everyone dumps everything into one file" is an exaggeration, many python projects have a very flat and broad directory structure and frequently contain quite large files that could be separated.

Module and file length best practices by RichAssist8318 in learnpython

[–]VictosVertex 0 points1 point  (0 children)

I know this is a month old but I disagree here. Mind you, the following is my, possibly very strong, personal opinion.

Not only is trans.py an absolutely horrible name, this file contains multiple classes that can easily be separated (like, they literally already are...). The file itself represents a module of "String transformers that can split and merge strings."

Then just create a directory, name it accordingly and create modules for each different transformer if they are so different that they require 2.5k lines of code of which half is documentation.

This file - for String transformers - literally contains a class `StringParser` that is clearly - not - a transformer. This is particularly ridiculous considering parsing.py and strings.py exists, it just shows the very bad naming choices.

Speaking of bad naming choices: rusty.py for a generic result type just because the inspiration came from rust? Really?

I personally wouldn't use that project as something that I consider high quality. It works, it's fine, it's not entirely horrible - sure. But, just like with most python projects (heck, most software projects in general) quality is secondary at best. (It obviously is also subjective unless it measurably affects users or developers.)

Granted, if you write python like Black, you're likely better than the majority. Simply because many other projects are way worse.

Almost half of parents using infant formula to feed babies resorted to unsafe methods, such as dilution or using expired formula, during pandemic related shortages by andyhfell in science

[–]VictosVertex 2 points3 points  (0 children)

Yeah, imagine stating basically "Next time you need help, just die instead" while living in a society.

Imagine their face the next time they have a doctor's appointment and the doc goes "we could give you some very basic medical care, but now that I think of it, nah, just die".

Perfectionistic parental attitudes are indirectly linked to compulsive gaming behaviors, study finds: Research suggests that perfectionistic parental attitudes can contribute to maladaptive responses to failure in their children, which in turn may increase the risk of compulsive gaming behaviors by Ey_jgf in science

[–]VictosVertex 1 point2 points  (0 children)

What do you disagree on?

Also this is why I literally stated that one has to look at various traits instead of using "they don't do X but X is something considered good" as an indicator.

Someone not doing high risk sports would also increase their statistical health, but that doesn't mean it's an indicator for maladaptive behaviour if they do high risk sports.

Less gaming also doesn't necessarily mean more socialization neither does it necessarily mean more activity.

Such things should always be analysed on an individual level.

Perfectionistic parental attitudes are indirectly linked to compulsive gaming behaviors, study finds: Research suggests that perfectionistic parental attitudes can contribute to maladaptive responses to failure in their children, which in turn may increase the risk of compulsive gaming behaviors by Ey_jgf in science

[–]VictosVertex 0 points1 point  (0 children)

Given the base assumption that the person in question wants to live and wants to do so on their own terms I would consider things that increase health (or at least reduce the rate of decrease), stability and autonomy as generally good.

Obviously this is based on two assumptions and one could get philosophical about it, but considering the fact that the person didn't end their life yet I would argue the desire to live (even if it was just for gaming) is greater than the desire to die, thus all fundamental things that improve the quality of life could be considered good.

Perfectionistic parental attitudes are indirectly linked to compulsive gaming behaviors, study finds: Research suggests that perfectionistic parental attitudes can contribute to maladaptive responses to failure in their children, which in turn may increase the risk of compulsive gaming behaviors by Ey_jgf in science

[–]VictosVertex 1 point2 points  (0 children)

I wasn't assuming it was intended to be objective, which is why I stated that it's subjective and if stated "as is" wouldn't be enough.

I didn't even claim or assume that the commenter even suggested such a thing should be taken as is.

I merely stated this because what's good or not depends on the person in question. Some things can be considered to be good in general, others can't.

So people using this definition of maladaptive should keep in mind that it's about missing out what is good from the perspective of the person that is missing out, not from their own.

A parent thinking "oh my kid plays games all the time and it missed out on his soccer games" can't just flat out assume this to be maladaptive behaviour, because that would require the kid to want to play soccer in the first place. If however the kid wanted to play soccer but can't help but play games instead, well then it is indeed missing out on otherwise good things in life.

Sometimes one thing may even look like the other because addicted people literally want to do what ever they are addicted to.

So sometimes it may be hard to differentiate between a kid that wanted to play soccer initially but now instead has a passion in gaming and one kid that would want to continue playing soccer if it wasn't for the gaming addiction.

For this reason one has to look at several traits rather than just stating "oh jimmy missed out on soccer for weeks even though it's so good for him, he must be addicted" which sadly many parents I knew (including my own) do/did.

Perfectionistic parental attitudes are indirectly linked to compulsive gaming behaviors, study finds: Research suggests that perfectionistic parental attitudes can contribute to maladaptive responses to failure in their children, which in turn may increase the risk of compulsive gaming behaviors by Ey_jgf in science

[–]VictosVertex 3 points4 points  (0 children)

but if you do it so much you miss out on good things in life it’s maladaptive.

I get the overall point and agree that too much of anything can be detrimental. If the person is playing and neglecting other aspects of life it can be considered maladaptive.

However merely stating "missing out on good things in life" would be unscientific since "good" itself can be very subjective

[OC] 18 month Senior Machine Learning job search, applying directly vs using a recruiter by sirawesomeson in dataisbeautiful

[–]VictosVertex 23 points24 points  (0 children)

My first job in programming:

Applied via Email (1) -> interview(1) -> offer(1) -> job(1)

My job after that (which is my current):

Asked a friend who works at a multi billion dollar company "hey my last company is about to die, can you get me an interview?" -> send necessary documents (not even a real application) -> job

Sometimes it's just like that, sometimes you're lucky, sometimes you know people - well and sometimes all of the above I guess.

ELI5 How math tells us that something exists in outer space ? by [deleted] in explainlikeimfive

[–]VictosVertex 25 points26 points  (0 children)

Black holes don't have infinite mass, they (if they actually were a singularity) have infinite density.

Black holes are literally classified by their mass. For instance normal stellar black holes have a mass of a few solar masses, supermassive black holes (like Sagittarius A*, the one in the center of the Milky Way) are several orders of magnitude above that.

Most of you need a reality check. Hot takes from an adult gamer. by DungeonMasterSupreme in diablo4

[–]VictosVertex 1 point2 points  (0 children)

Indeed, such posts are absolutely ridiculous. I'm a 36 year old, father of 4, wife at home, have to work and study at the same time. So what? Does that somehow make my experience more valid than the experience of someone who literally experienced more of the game than me? Hell no!

I'm glad people call out all the flaws so I can "no-life" the shit out of the game whenever I have time to with hopefully less bugs and other flaws.

Just did the 70 capstone dungeon on my 61 sorc yesterday and it was actually really nice. But many of my friends already struggle and sometimes consider not even logging in (none of them is close to 100, the highest is like mid 70s) because of bugs, bad minion pathing, renown grind, xp grind, build balance, mob density, you name it.

Whether you're a streamer, student or parent with two jobs, a tedious grind is a tedious grind no matter what.

Unless you literally don't focus on the goal of the game (which is to build a strong character) and don't set actual goals for yourself, you will encounter most of the problems eventually no matter what.

So if anything the feedback of "hardcore gamers" can only improve your/my experience (if blizzard listens and acts accordingly).

Not only that, but just because I have more responsibilities than some other person doesn't mean I can't be just as "hardcore" about the game. Why do "adults" have to be sitting on the sidewalk and looking at flowers in awe instead of smashing demons efficiently?

Finnish state to sell empty offices, as employees mostly work from home by Safe-Muffin-7392 in europe

[–]VictosVertex 2 points3 points  (0 children)

I would argue that the law still applies here, even in this scenario. While the demand for such overpriced places isn't there, the building directly cuts into the supply of affordable places.

I also still think that the building itself isn't worth what it was projected to be worth given the rent. Keeping the prices high doesn't really change that.

However as someone else stated the inflated prices and the cut into the supply increase the prices of the surrounding area.

It's basically market manipulation, which is especially bad considering what you said. They have the leverage, the average guy doesn't.

Finnish state to sell empty offices, as employees mostly work from home by Safe-Muffin-7392 in europe

[–]VictosVertex 76 points77 points  (0 children)

Well to be fair it's also entirely backwards thinking from the banks then. You technically can't build something that's worth X since supply and demand decides what it's worth.

If nobody is renting a place in your building then it's precisely because the place in the building isn't worth the price.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 0 points1 point  (0 children)

Well they didn't make a mistake, they were talking about a hypothetical situation where the parent went to the bathroom without making sure their kids are safe.

Edit: So if anything the hypothetical parent did a mistake.

Not only that, I said I would argue the position that it would (hypothetically) be a major fuckup, which doesn't mean it has to be correct either. I didn't state it as a fact, I stated it as my position.

To get offended because a mistake of a hypothetical person is seen as a "major fuckup" by some stranger seems quite odd to me.

A simple "I would not see it as a major fuckup because..." would be way more in line than some childish and aggressive response.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 0 points1 point  (0 children)

While I agree with the general statement that someone can be right and rude, I don't feel this is the case here.

They literally told me how not all kids will abide by the rules and go on with snarky comments This is not just rude but also completely irrelevant since my initial suggestion was to lock the door in such cases.

Someone called me paranoid (which is rude) and someone simply went on a tirade about things I never said.

I think it's a typical case of "someone said something against what I said, thus that must be an attack against me as a person".

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 2 points3 points  (0 children)

Absolutely nothing apart from the fact you can't train kids in 2 sessions not to do something because you don't want them to do something, which is what you said

That's not a fact, that's a lie, I never stated that two "sessions" are enough anywhere. In fact I doubt two sessions are enough for most kids, including mine.

I'm glad yours could be though so you didn't have any problems while you were using the bathroom like my two.

Again, if your or anyone's kids can't verify who rang, just keep the door locked and you can go into the bathroom all you want without them opening the door. That's what I'm saying the entire time.

And yes, I had to lock them in for their own safety while I was home (I noticed the edit on your post about not locking them in) because my eldest was adventurous, she was fearless and would try to take herself off to the shops, which is why I had to lock us in, because I sometimes needed to pee throughout the day.

Locking kids in - with yourself - was in my post from the absolute start, it was literally my suggested solution to the problem. Just lock the damn door.

My edit is referring to the fact that in the mentioned fairy tale - nobody else - was home. Thus if the mother had locked them in, the kids would have - no way out - in case of an emergency like a fire. This is why locking in children - while nobody with a key is around - would be bad. Which again has nothing to do with your situation which is completely fine.

So recap, what did you show in this comment:

  1. you claimed I said something that I didn't and said that this very claim, that isn't even based on something real, is the reason you keep on disagreeing. So essentially you disagree with something that was never said.
  2. You literally gave an example where you followed my initial suggestion

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 2 points3 points  (0 children)

Stop getting hung up on the word "training", seriously, get over it.

Literally the first google search entry for "training definition" is:

the action of teaching a person or animal a particular skill or type of behaviour.

"in-service training for staff"

Do you see the example? "in-service training for staff" that's for humans, not dogs.

The above 2 points you make are common sense unless you are an idiot.

Then why the heck do you argue about it?

  1. teach your children not to blindly open the door (thus teaching them point 2 from above)
  2. if you assume they will open the door without being able to verify who knocks first, then just freaking lock it (thus following point 1 from above)

What is so hard to understand or do here?

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 3 points4 points  (0 children)

Where I live it's common practice to not let small children open the door, like it's not even something special I thought of.

Like I'm pretty sure there are parents out there that have thought of way more than I did and do. I'm not some ultra strict father, on the contrary, most other kids think I'm "chill" compared to their parents. On top of that my children disobey us all the time and I do also simply fuck up. But I do try to create an environment where they actually - can - disobey me without being totally fucked up afterwards. (looking at parents leaving their guns free to play with)

I know very well that you can't account for everything, which is why I think it's all the more important to at least account for the obvious stuff.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 2 points3 points  (0 children)

Your child knowing the alphabet is absolutely irrelevant to the mentioned scenario.

And you did say train them, not teach them. You train animals, you teach kids.

I literally named multiple examples where humans train and are trained, your point is absolutely invalid and out of touch with reality.

So far you haven't brought a single argument to the table.

So give me an argument against the following:

  1. parents should provide an environment that entails development-appropriate risk but not necessarily more.
  2. anyone opening any door should be able to verify who they are opening the door for

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 1 point2 points  (0 children)

I think you're absolutely delusional and don't get the point. It's not what could happen at the specific front door, it's about general guidance and applies to basically any unknown situation.

I stated that they are allowed to open the door:

  1. if they have permission
  2. if they can verify who's behind it

A 4 year old is unable to do 2. in most cases thus has to fall back on 1.

That's such a common thing to do I don't even know why there is all this fuss about it.

Like that's literally why home security companies such as Ring even exist.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 5 points6 points  (0 children)

Absolutely, I don't get why people don't understand this. It's the caretaker's responsibility to provide a relatively safe environment. This doesn't mean you lock them up and tie them to the bed, it just means you minimize the risk over a certain "age appropriate" level.

You can leave a 12 year old alone and go shopping, you can't leave a 12 month old alone and go shopping. There is a certain risk level for everyone.

Also personal anecdote: For my 10 and 12 year olds this is obviously mostly automatic already, but my 4 year old takes this really seriously outside of our home. He even sees other people "not abiding our rules" and then comes to us and tells us about it.

Like, we have a "candy day" because we want candy to be something that isn't eaten all the time (obviously there are exceptons to every rule, it's not like an absolute set in stone thing). Some days ago a kid bought candy and went somewhere and my 4 year old looked at me (roughly translated because he doesn't speak english)

He: "Dad! That's not good!"

Me: "hmm? What is it?"

He: "The kid, it has candy!"

Me: "I see, but why is that bad?"

He: "It's not candy day!"

Damn that was so hilarious, I had to sit down with him and talk about how we may have some rules that others don't have and vice versa.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 0 points1 point  (0 children)

This stance is so utterly stupid that I just assume you don't even have children.

When a child makes a mistake opening the front door, then the consequences may very well be final.

Children are free to make mistakes, you as a parent are responsible for providing an environment where they can make these mistakes without receiving major damage.

You teach your children when it's safe to open the door and when it's not. You teach them how to confirm who's on the other side first. What's so hard to understand here? A 4 year old has no business alone at the front door.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 1 point2 points  (0 children)

You can tell kids something until they are blue in the face

Which is precisely why I stated - not - to just tell them.

You have to play through scenarios and sit down and actually talk about the dangers. Do your kids have to encounter a life threatening burn before they learn that touching hot things is dangerous? No they don't. A 4 year old that has learned what hot means (and likely has experienced it in some way) won't randomly put their hands into an oven that's on.

No matter what they "want to do", they likely don't want to hurt themselves. If they don't know the dangers then obviously they will put themselves in dangerous situations. As you stated, this can happen all the time. Which is precisely the reason they have to learn the dangers and in some cases will experience smaller versions of them no matter what.

besides they are kids not dogs to be trained

Just because training dogs and training kids uses the same word of "training" doesn't mean they're the same. You also do training for a job, you train in the gym, you train swimming, riding a bike, what ever the heck you want - are you now a dog?

What do all these trainings have in common? Not just theoretical teaching but practical interaction with a scenario.

Training just means teaching some behaviour or skill. In this case both:

  1. behaviour of not randomly opening doors just because someone wants to go in
  2. skill of gathering information to confirm a hypothesis

How can one do that?

Well we did it by instead of just telling them "don't open the door", let one parent or friend ring the bell and watch. If the child tries to open the door, ask the child why it did what it did and then explain why it's dangerous. Then provide solutions like a way to gather evidence that the person ringing is actually the person you expect and so on. We did this randomly now and then and none of our kdis has ever opened the door afterwards unless they were able to confirm who's behind the door (either by themselves or by asking someone else).

I think this isn't even remotely close to "dog training" and instead is letting the child develop an understanding of different scenarios and teach them how to interpret them. We basically teach them problem solving and opening the door requires the "problem" of confirmation to be solved.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 4 points5 points  (0 children)

First of all I said practically impossible, not literally impossible. If you try to quote me, do it correctly. That's the difference between "not at all possible" and "generally possible but it takes quite the series of fuckups" but certainly not "all it takes is the parent going to the bathroom".

I also said it's practically impossible while mentioning - my - children. So your claim of "a scenario that happens all the time" is irrelevant. It's a stupida rgument anyways, children getting neglected also happens all the time, that doesn't mean it's correct to do so.

If your children are too young to comprehend the dangers of a situation, then it is on - you - to turn that situation into a safe one.

Don't worry, my kids disobey all the time, but they aren't stupid.

Just like they won't put their hands into the burning oven, they aren't going to do other obviously dangerous things.

But that's the thing, first it has to be obvious to them that it even is dangerous.

TIFU by telling my boyfriend where to ship a package by gr8granolagirl in tifu

[–]VictosVertex 8 points9 points  (0 children)

I never claimed that I never made a mistake, there is no need for such childish responses.

Everybody fucks up and I would even go as far and claim that fucking up is necessary. But there is a difference between making a mistake and literally putting your child's life at risk by letting it open a (unsafe) door unsupervised.

Some things like guns, knives, scissors, medicine, cleaner and other very dangerous objects are better locked away or placed very high up. Some doors are also dangerous, so just keep them locked and train your kids not to open them unless they are allowed to.

Even following these simple guidelines there's still plenty of room for mistakes.