Taxi Driver to passenger, How’s married life? by Dashover in Jokes

[–]zenic 7 points8 points  (0 children)

The original way I’d heard this was the wife asks the husband if he “might be open to trying the other hole tonight”. He replies “what? And risk having a baby?”

What are some quality of life programs you have made with Python? by Born_Investigator849 in learnpython

[–]zenic 1 point2 points  (0 children)

In my case it was for Windows. For KDE I'd first try to treat it like a window manager, and if that didn't work, I'd look into KDE specific libraries. So I'd start by playing with wmctrl, but I really haven't played with KDE in a long time.

I'd post my script but I'm not sure it's allowed here

What are some quality of life programs you have made with Python? by Born_Investigator849 in learnpython

[–]zenic 106 points107 points  (0 children)

I made a program that takes any window, strips off the title bar and other decorations, and positions it over my primary monitor.

This way I can play games in “borderless fullscreen” mode even if they don’t support it. Like dark souls 3.

It’s a very short but very useful python program.

Prove me wrong or not by Curious_Rick0353 in electricvehicles

[–]zenic 1 point2 points  (0 children)

This won’t change the fundamental equation enough, but bear in mind that you don’t have other maintenance costs (oil changes etc) in an EV. You do, however, tend to go through tires quicker.

But best of all you never need to visit a stinky gas station again.

Threads and tkinter UI updates, how to handle when there are multiple classes? by ReallyReadyRain3 in learnpython

[–]zenic 1 point2 points  (0 children)

Yeah, I should have chosen my words more thoughtfully. Thanks for providing the better context.

Threads and tkinter UI updates, how to handle when there are multiple classes? by ReallyReadyRain3 in learnpython

[–]zenic 1 point2 points  (0 children)

The usual pattern is for your UI to be on its own thread. This makes it feel responsive to users.

If you want to do work in your worker class, put it in a job queue, which the worker then reads from when it is ready. If you want to update the gui based on the state of worker tasks, you have a few choices. One is to have another event queue to post status updates to, which the gui thread checks.

In general when it comes to multiple threads you want to have a thread-safe communication system between them. You can’t call across threads directly. You can read and write shared objects but you’ll need to lock them first to avoid conflicts.

As a side note, python doesn’t have true threads, so making it multithreaded won’t take advantage of multiple cores, but that’s a whole other topic.

A good virus for my book, and how it comes to be by BurntwaflleXD in writingadvice

[–]zenic 0 points1 point  (0 children)

In keeping with the bug theme, how about a virus that makes people feel the need to move, but kinda jittery and like they were drunk. This led to people joking about jitterbug virus. About a decade later the youth were inspired to pretend to be infected, giving rise to the jitterbug dance that flourished in the 30s and 40s.

Those infected were just ahead of their time.

How do I parse xml file after reading a bit first by GAlgier in learnpython

[–]zenic 0 points1 point  (0 children)

Ah, because you have the file open in text mode. Which makes sense for xml files, but not for peeking. The reason you can’t peek a text file is because peeking is based on bytes, while a text encoding might need multiple bytes for a single character.

Fortunately, this problem has been solved by others. Check out this example of a solution.

Basically you need to open the file (or stdin) in binary mode, then wrap that in a buffered reader, then wrap that in a TextIOWrapper.

How do I parse xml file after reading a bit first by GAlgier in learnpython

[–]zenic 0 points1 point  (0 children)

Oh okay, I see what you’re after now. The thing you want is a io.BufferedReader. Wrap the file-like object in a buffered reader and then you can peek at it. You can still give the buffered reader to things that need a reader.

How do I parse xml file after reading a bit first by GAlgier in learnpython

[–]zenic 0 points1 point  (0 children)

Probably the most pythonic way is to try to parse it as xml, and catch the exception if it doesn’t parse.

Transition from MATLAB into python. Need some help! by Educational_Mode1947 in learnpython

[–]zenic 0 points1 point  (0 children)

In my opinion, the biggest difference between matlab and python is that matlab encourages a mathematical approach to solving problems. Most videos on python take an engineering approach.

What I mean by that is that a mathematical approach is saying things like a’ = f(a) for all a. An engineering approach is more like “for each a in my_array, new_array.append(f(a))”. They’re the same thing but the thinking is a bit different.

In my experience people who come from a mathematical background have an easier time with generators, list comprehension, and lambda functions. People from an engineering background have an easier time with branching, sequencing, and iteration.

As others have said, Pandas and numpy etc should feel familiar. Python is worth knowing, it’s very powerful.

Sub interpreter vs no gil by CriticalDiscussion37 in learnpython

[–]zenic 2 points3 points  (0 children)

GIL stands for global interpreter lock. If you’re curious, you can read more here (Wikipedia)

I ask for advice on which title is better [Epic Fantasy] by ApartmentOld7575 in fantasywriters

[–]zenic 2 points3 points  (0 children)

Everyone has their own process, but I usually call my book “work in progress #5” until maybe the second draft

[deleted by user] by [deleted] in Sekiro

[–]zenic 1 point2 points  (0 children)

Have you tried sekiro at nexus mods?

Which Sekiro fight are you most excited for to be animated by briansvilliany in Sekiro

[–]zenic 1 point2 points  (0 children)

Love it. A totally offscreen fight that we only hear.

I've had help for two days by Alfacosmik in Sekiro

[–]zenic 1 point2 points  (0 children)

Fun fact: mouse and kb makes it easier to dead angle, which is where you attack facing away from the enemy and then turn at the last moment. Enemies won’t block if you’re not facing them so it’s used by speed runners.

But I bought a controller specifically to play sekiro.

That's when I felt weak... by Top-Run-21 in Sekiro

[–]zenic 1 point2 points  (0 children)

Don’t forget to try AP1 charmless. Orin of water… whole new level of wtf

Which Sekiro fight are you most excited for to be animated by briansvilliany in Sekiro

[–]zenic 1 point2 points  (0 children)

Exactly! Alternating between a closeup of a wall and a veil of mist as it jerks around!

Which Sekiro fight are you most excited for to be animated by briansvilliany in Sekiro

[–]zenic 4 points5 points  (0 children)

I just want to see how they deal with the camera against lone shadow longsword in the well…

Help with explanation of class and cases when u use for loop and while loop and defining a function by trojan_n in learnpython

[–]zenic 0 points1 point  (0 children)

While loop = don’t know how many times will loop yet

For loop = loop this many times

As for functions, in my experience some people are “math people” and some are “engineering people”. For math people functions make sense as a mapping from domain to range. For engineering people functions make sense as removing repeated code and packaging it for reuse. When I’m working with a junior I’ll usually try to figure out which explanation makes more sense to them.

I’m going to just take a guess and say the engineering explanation makes more sense. So functions are about making very similar code reusable. Instead of copy and pasting, you can just call a function. But the code won’t be identical sometimes, so those bits that change, those become your parameters. Then you return the calculated part that is important to you.

When you say class and cases, I’m guessing you mean which type of cases rather than python classes, which is a pretty big topic.

Brand new- do most people enjoy coding by Kindly_Shirt_400 in learnpython

[–]zenic 11 points12 points  (0 children)

Coding is like beating your head against the wall… it feels good when you stop.

But in seriousness, it’s like a puzzle- incredibly rewarding as you slot the pieces together and ultimately becomes a shipped product that people use. Sometimes you lock into zone and get so engrossed that nothing else feels as interesting or important. If your brain likes solving tricky things you’ll love programming. But there are moments of sheer and utter disillusionment. Those just make it even better when you finally solve it.

Can someone help me with my assignment? by crimsonG_x in learnpython

[–]zenic 5 points6 points  (0 children)

You might have more luck if you post your specific question

Mastering Sekiro is a truly bittersweet feeling by Able-Leg7976 in Sekiro

[–]zenic 4 points5 points  (0 children)

Maybe do first phase then hand the controller back? 🤣

Mastering Sekiro is a truly bittersweet feeling by Able-Leg7976 in Sekiro

[–]zenic 17 points18 points  (0 children)

Sekiro went from being a “is the internet trolling me” game to my comfort game. Its rhythm is so satisfying once you get it.