@Aran-Fey As in truncate (overflow: hidden) or bound (max-width: 100%)? IIRC max-width can't prevent child elements from sticking out -- if one of the children has a min-width higher than the max-width.
I basically want to have 2 rules for layouting: 1. Parents grow large enough to contain their children 2. If a parent has only 1 child, the child gets all the available space. Even if that's more than it needs
When I was in Uni, me and my best mate had a game to just loudly say the most ridiculous thing that came into our head as we walked past people on the street, just to see their reaction to our insane "conversation". In later life, I've realised that legit conversations between programmers must sound utterly bat-**** to anyone nearby
When I first created beatroute and it wasn't really known in our company, I would casually drop it in our internal meetings about how I could use it to calculate customer transport costs
"Just do the transform inside pandas, pass the result to beatroute and it'll give you back the distance as JSON, which you can unpack by key". I think most people would be sectioned if they weren't talking about programming
Programmer: "The output of this function is all wrong" Passersby: "Oh, he's a mathematician" Programmer: "Your class is a mess" Passersby: "Never mind, he's a math teacher" Programmer: "Does the process fork itself here?" Passersby: "Wut"
@roganjosh one of my favourite things about software is that the analytics software Splunk is so expensive it gets discussed at very senior levels, which means a load of c-suite people had to say a ridiculous word in meetings a lot.
@Aran-Fey I thought you'd just remove the width setting on the parent, and it'd grow, assuming the child doesn't do something to remove itself from regular positioning
I really have no clue when it happens, but sometimes the parent just stops growing past a certain point. One time it refused to become wider than the screen, for example
It's a nice addition to the totally baffling layout of the site where I find myself unexpectedly reading posts totally unrelated to the one I opened in the first place because the UI is garbage. Now I can have AI generate extra garbage! What a time to be alive
Most C-type languages will require you to traverse a list of indices and access a sequence using that index. Instead, Python defaults to looping through the elements themselves, so using enumerate is a convenient way to get the index back (which you need in your case)
I was just about to code it up but my taskbar has disappeared?! :O
You can quickly jump to the builtin type from the constructor "functions" in builtins. E.g. the builtins docs on list immediately link the the actual list class.
@DimitrisPapageorgiou Functions exist by themselves. Methods exist on classes.
The thing about builtins is they are accessible in global namespace, without any imports. You can type len([]) and get a result. You cannot type justappend(...), you need to append to something
You could, I guess, have append(my_sequence, item) but then it'll blow up on tuples, dicts and sets, so it doesn't really seem very useful
Almost entirely separately @DimitrisPapageorgiou notice that I changed the variable name to snake_case. It would be worth reading through PEP8 if you're going to be using python as the style is typically relied on more than just a "nice to have" feature
Perhaps. I've recently been making an effort to keep to camelCase in my frontend work but it's always tied to the backend in which I use underscores being developed in tandem. One thing I do know is that I immediately judge a library source code by adherence to PEP8 even if it's arbitrary. Opening the first .py is either going to be a "phew" or "oh man, this will be tough"
Evening pondering: asyncio storing Tasks weakly actually makes sense. If there's nothing that could execute your task and thus holds a strong reference, might as well reap dem zombies.
well, as far as my digging has revealed - actually not, no. The executing task and any task waiting on a select should be held strongly by design, but the rest not.
Say you could have a task waiting on an Event. If nothing else has a handle on either the task or Event there's no way for the task to ever run again.
To be clear, I didn't actually ask on Quora, that was just suggested by Google and the site then offered a bot-driven answer. I found separate human answers that talked about the information density in the English language and answered my thoughts. The bot just spewed generic garbage
Tried to reproduce it with pygame, but iterating through the json to draw the map take too long (and even in batch/chunk, it take so much ram). I'm sure there might be a better way though
In terms of pygame it might not be relevant tbh. I don't have any experience with it but from what you're saying, it seems like you'd want to load thing in the background and JSON is really not a good format to be analysing in real time
yeah, the json is really small (from openstreetmap) so I don't know why it's so slow even with chunk/batch. I guess I could ask on SO since it's been a while hmm
ah no, basically I used a package to download a specific tile of some map from openstreetmap (osmnx.readthedocs.io/en/stable), and then try to display it (not as image so I can draw path on top of it for different algorithm visualization).
But that just gives a vehicle route on a map? What does it have to do with pygame? (I can imagine a tab that shows a map with a supposed route for some in-game mission)
oh, it doesn't but I just wanted to find something that was close enough to what I wanted to do. So I could either 1. use it as it is, or 2. look at the code and trying to gain some inspiration from it for my own thing
Fair enough. In that case, I think those are the limits of my suggestions, sorry. I have no idea whether they can be reasonably translated into python proper
Hello everyone! Has everyone ever had a problem where you could import a library on a regular script (the library being installed on a venv and/or on your native python) but it gives a module not found on a Jupyter Notebook? I tried the notebook using the default setting and also using a venv. None worked
The library in question is chessdotcom (chesscom.readthedocs.io/en/latest). A wild guess is because it is installed with pip install chess.com but in the code it's imported as import chessdotcom, but I don't know, really
Would be lovely if someone tried to import on a notebook for me :) So I would know if the problem is on my setup
Either jupyter uses a different python interpreter (than the one you used to install the module) or the sys.path is different for some reason. Try looking at sys.executable and sys.path
Ooooor jupyter is so different from normal python that none of my knowledge applies ¯\_(ツ)_/¯