@7 coding question

lets say I want to build a program that

a) interfaces with a web API
b) uses this data to direct a bot
c) gives the user the ability to check up on certain aspects of the bot, maybe change some of its settings while running

do I want to build a separate script for each and then wire them up together once each one behaves itself?

how does one do that in python?

I'm so used to having a single python script that follows one line of logic through a program but it seems this needs several processes running in parallel
Follow

@skells@freespeechextremist.com @7 ah I see I'm also retarded

ATM looks like I'll do a few more different modules, have them read and write from a text file

just scoping it out now so it's extensible

· · SubwayTooter · 2 · 0 · 1

@skells @skells I can’t speak directly about Python (I try to avoid it), but it would probably be best to hack on each problem individually then work out a way to piece them together, by refactoring scripts into modules and writing then another script to orchestrate them together. I do know that Python is persistently single-threaded due to how its GIL is implemented, which means relying on their async library. Also, if you want to be able to do settings you’ll want to start turning everything into a variable that can be stored and loaded with functions.

My brain is at work so I do apologise if this is a messy braindump.

@7 @skells this was super useful, especially the async keyword, thanks

I don’t write anything significant professionally in python, but I use it a lot in my hobby stuff. This could all be accomplished in a single program with aiohttp or another async framework. You could tie in something like Quart or FastAPI to allow runtime settings modification via http, or just use sockets (async sockets though!)

@ademan @skells @7 it might indeed be easier to just have a text file that handles the need for the modules to communicate, maybe this would circumvent the async, but it's hard to see from where I am right now. thanks for all the recommends

i guess things will become clearer in time, all i can do rn is make sure I have the flexibility going forward
@ademan @7 @skells ooi, why is it a pattern for professionals to avoid python? interesting that you use it only ofr hobby stuff ademan

For me it’s merely an accident, I write software for embedded platforms so my day is all C and C++. When I do something in Python for work, I’m usually working outside of my direct responsibilities.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.