hi, asking a style question that feels off-topic for SO. coming around to classes and OO, and wondering about whether it's bad practice to have a method of MyClass, say modify_instance(), that just changes instance attributes and doesn't return anything? this feels bad coming from an R style where you're supposed to only use side effects for file I/O and similar
^ As long as you don't need anything else from the function (like a return value) it's fine. Unlike a lot of languages functions in Python don't actually need a return statement. It's completely optional.
@wim is there a good way to communicate then that you should use such methods like my_instance.modify_instance(), instead of trying to do things like modified_instance = my_instance.modify_instance()? or is the latter just not something you would expect
I'd love to have something like the exclamation point convention some languages have for mutative operations, but we don't have explicit "this is mutative" indicators in Python.
Cbg folks, just was wondering, what is the right way to add and remove elements to a template in django dynamically (aka on the same web page). I.e. I load the first 25 assets out of 50 as two pages in a subelement of a template and then remove and place the other 25 only when they load the second page.
you've got 2 options: either you rerender the page wholly for every change on Django side, or you use JavaScript to interface with the Python code via XHR, i.e. for example the $.get or $.post of jquery
Well that was the first and last time I installed a Desktop app from the Windows Store... "Do you want to unlock tabs and the dark theme for $1.49?" Nope. No I don't.
@roganjosh Aran was looking for a file manager specifically with tabs. I presume he downloaded a promising one, only to find out that it's free-to-play freemium and doesn't actually do what he wants to do, not for free
Ahh, thanks. tbh I've never actually had to visit the Windows Store I don't think.
I find Windows 10 utterly distressing. I currently have my laptop plugged into the TV because the screen is obliterated but I know that replacing my laptop means I'm going to have to make the upgrade
Luckily anything I've needed Linux for has always had a server and I can just bridge the port and use it from Windows. Eventually all my work moves to Linux but I find Windows 7 more intuitive for developing (but then, I've worked in places where that's a forced decision and I've also grown up with Windows)
The point at which an 10 year old fixed some settings in Windows 10 while I was still faffing trying to navigate it was the point I decided it was a distasteful OS :)
Pretty much that. 10 has done quite a bit to abstract away the serious settings in favour of making things like game apps more accessible.
Thinking about it more, I imagine that's quite a difficult space to work in. The generational gap in what is intuitive is pretty huge, I'm not sure I could make something that would appeal to a younger generation
I can't read the actual text, but I'd say the math in that paper is a bit advanced for a kitten. Maybe you're pushing them too hard?
Kittens are more accustomed to things like "If I paw this off the windowsill with a force of x, will I hit the TV screen with y and destroy it?" Not integrals.
@AndrasDeak "[...] style. Beauty. Grace. That’s what matters. If cats looked like frogs we’d realize what nasty cruel little bastards they are". — Granny Weatherwax in Lords and Ladies, by Terry Pratchett.
If you understand Ned's article you'll understand why this 3 line program does what it does: lst = [[1],[2],[3]]for a in lst: a *= 2print(lst) — PM 2Ringyesterday
@bendl I suspect it's not for loops per se that are the problem, but you may have a core misunderstanding about Python objects and name binding. Take a look at the Ned Batchelder linked in the page I just linked.
@roganjosh Someone actually upvoted that. :( I'm was almost tempted to not del-vote it, so that the OP and answerer wouldn't get their points refunded.
Should it be actionable in this room? I'd say 15 questions where the answers are just terrible. I downvoted, but does that mean I should raise it here?
@roganjosh Did you see this gem from yesterday? The question is ok, but most of the answers are face-palm material stackoverflow.com/questions/50986441/…
@AndrasDeak I know I can see who edited the answer. I was making a point because it ended up removing code entirely. I'm trying to work within the "be nice" framework
@roganjosh calling OP silly in a passive aggressive manner is not more nice than calling them silly directly. Frankly you've come across unusually abrasive all day, so perhaps you should take a break before you lose your mind
Instead you could've told OP that they shouldn't have approved an edit that made their post worse, it's fine to reject what conflicts with their intent. Simple as that, and next time OP would have known better.
@Permian Better, thanks. What I also meant is that there are a lot of users here who come and go (well, less "lot" on the weekends, unfortunately), and instead of waiting for someone to volunteer for your unknown django problem you should ask about your problem directly, and if someone is willing to help they will stand up
Ok, I'm trying to evaluate this properly but I was responding to " @roganjosh vaultah seemed to get it on the first go". That says "duh,you missed the point"
There's no other way to read that comment as it's put in text
I don't take them at face value. I am quite stressed at the moment and you seem to have identified that I'm interacting with people with that stress behind me so I should take a step back.
I would like to implement a system with a persistent Queue registering tasks, and a distributed set of worker nodes taking tasks, making some processing and updating the status of the task
can someone recommend me some reading or framework?
I don't know why, but I always get a little put off when someone uses "grumpy" to describe a grown person's mood. You usually associate "grumpiness" with a child's unreasonable tantrums
@coldspeed yeah, the word "grumpy" definitely bothers some people. Also "relax". Telling someone to just relax in a heated discussion is typically a great way to escalate the situation :P
I'd love it if OP's problem was that they inadvertently set a breakpoint on the given line in their IDE, but I'm afraid the true reason is much more prosaic
FWIW that shouldn't cause an error even if it's a new file. On the other hand they probably don't have an error, because who knows what they have. I've probably spent way too much time musing about that question already.