|
Luigi Thirty posted:folks, I bring you this thing that appeared on my twitter timeline huh I thought vaccines protected against mumps yet here we are in yospos talking about mu.... Oh wait no I see now.
|
# ? Mar 6, 2019 23:07 |
|
|
# ? Apr 24, 2024 18:28 |
|
Luigi Thirty posted:folks, I bring you this thing that appeared on my twitter timeline cursed IDE pls share your Atari TT stories with us
|
# ? Mar 7, 2019 04:12 |
|
eschaton posted:cursed IDE I'm writing a mastodon client in C++ targeting m68k-atari-mint atm it's only 206kb so far!
|
# ? Mar 7, 2019 05:49 |
|
Currently: it can make calls to the accounts API, parse the result, and display a couple strings lol https://twitter.com/LuigiThirty/status/1103539212312293379
|
# ? Mar 7, 2019 07:51 |
|
Luigi Thirty posted:Currently: it can make calls to the accounts API, parse the result, and display a couple strings lol
|
# ? Mar 7, 2019 16:23 |
|
how do i get at a method/function's arguments in a way where i can fall back from **kwargs to *args? i have this decorator:code:
Carthag Tuek fucked around with this message at 13:59 on Mar 8, 2019 |
# ? Mar 8, 2019 13:55 |
|
args[1] has to be evaluated in order to even call kwargs.get with it as an argument - it's not short circuited.code:
|
# ? Mar 8, 2019 14:05 |
|
ahh thanks, that makes sense
|
# ? Mar 8, 2019 14:18 |
|
it works! wrote up a little helper for it code:
|
# ? Mar 8, 2019 16:29 |
|
this is probably more robust re possible "None" argumentscode:
|
# ? Mar 8, 2019 16:43 |
|
Krankenstyle posted:this is probably more robust re possible "None" arguments You don't need that else though? Edit: code:
|
# ? Mar 8, 2019 16:49 |
|
right also i considered going code:
Carthag Tuek fucked around with this message at 16:59 on Mar 8, 2019 |
# ? Mar 8, 2019 16:57 |
|
ratbert90 posted:You don't need that else though?
|
# ? Mar 8, 2019 17:00 |
|
Krankenstyle posted:right * Rushes in with heavy breathing * HAVE YOU SEEN PYTHONS LIST COMPREHENSION?!?!?! It's unnecessary and stupid.
|
# ? Mar 8, 2019 17:00 |
|
semicolons are unnecessary in javascript but I still use them like a good boy scout
|
# ? Mar 8, 2019 17:05 |
|
lol at all the code golf-y alternatives here: https://en.wikipedia.org/wiki/%3F:#Python
|
# ? Mar 8, 2019 17:08 |
|
ratbert90 posted:* Rushes in with heavy breathing * HAVE YOU SEEN PYTHONS LIST COMPREHENSION?!?!?! one of them is actually a tuple with an index (because true/false evaluate to 1/0): (args[index], kwargs[name])[name in kwargs]
|
# ? Mar 8, 2019 17:10 |
Krankenstyle posted:this is probably more robust re possible "None" arguments what you want is code:
cinci zoo sniper fucked around with this message at 17:13 on Mar 8, 2019 |
|
# ? Mar 8, 2019 17:11 |
3 notes: this is going to get ugly if it is permissible for a kwarg value to be None if you have imbalanced input data (e.g. majority of kwargs is like this or like that) then its better to rewrite this via try/except if you can guaranteed that all kwargs values will be truthy then you can reduce "is not None" to basic truthiness check
|
|
# ? Mar 8, 2019 17:15 |
|
SciFiDownBeat posted:semicolons are unnecessary in javascript but I still use them like a good boy scout iirc there are some really weird gotchas if you don't use semicolons so it's not a bad habit really
|
# ? Mar 8, 2019 17:22 |
|
cinci zoo sniper posted:what you want is wouldnt this work just as well then? code:
|
# ? Mar 8, 2019 17:22 |
|
Symbolic Butt posted:iirc there are some really weird gotchas fixed for all of JavaScript.
|
# ? Mar 8, 2019 17:25 |
Krankenstyle posted:wouldnt this work just as well then? yea, this would. {'foo': None} would get you a None, if that matters. it's what i originally wrote replying to you, but then i brain sharted somewhere, this was a hellweek at $job and i was completely fried by like tuesday afternoon
|
|
# ? Mar 8, 2019 17:42 |
|
ya I'm fine with a None showing up if that was indeed what th method was called with
|
# ? Mar 8, 2019 17:48 |
Krankenstyle posted:ya I'm fine with a None showing up if that was indeed what th method was called with you're all set then, kwargs conditional should not have any meaningful failure modes remaining. args[index] can go sideways - i'd at least do some index check in a "better safe than sorry" fashion
|
|
# ? Mar 8, 2019 17:54 |
|
good call tho I doubt it'll happen. better safe as you say
|
# ? Mar 8, 2019 17:57 |
Krankenstyle posted:good call tho I doubt it'll happen. better safe as you say if you doubt it will happen, wrap what you have into a try/except IndexError block.
|
|
# ? Mar 8, 2019 18:01 |
as everyone who has followed my database posts itt might imagine, im really into "defensive coding" by now
|
|
# ? Mar 8, 2019 18:02 |
|
cinci zoo sniper posted:if you doubt it will happen, wrap what you have into a try/except IndexError block. on second thought, i want my app to blow up if the argument is missing cause theres no reasonable way to go forward without a fileid anyway
|
# ? Mar 8, 2019 18:15 |
|
yes, but when you don’t have a compiler telling you “hey dipshit you haven’t returned anything from all code paths” then I like to code in a way that I’m less likely to forget to return something SciFiDownBeat posted:semicolons are unnecessary in javascript but I still use them like a good boy scout this is way more confusing than the other thing and is not a good comparison
|
# ? Mar 8, 2019 19:04 |
|
ratbert90 posted:It's unnecessary and stupid. so are my posts but that's enver stopped me
|
# ? Mar 8, 2019 20:14 |
|
pokeyman posted:yes, but when you don’t have a compiler telling you “hey dipshit you haven’t returned anything from all code paths” then I like to code in a way that I’m less likely to forget to return something I agree in practice but it's a two line utility function for pete's sake
|
# ? Mar 8, 2019 20:23 |
|
SciFiDownBeat posted:I agree in practice but it's a two line utility function for pete's sake whatever you're coding is now doomed to be mission critical line of business code
|
# ? Mar 8, 2019 22:02 |
|
Captain Foo posted:whatever you're coding is now doomed to be mission critical line of business code College stoner me: "Like, the universe isn't straight-up malevolent, it's just totally indifferent to us man" Working programmer me: "I dunno, maybe there's a case to be made that it actually is malevolent"
|
# ? Mar 9, 2019 00:20 |
|
ctps: writing unit tests for the first time in my life and I'm exhausted. this is taking me an ungodly amount of time, but I'm anxious about hitting all the corner cases. anyone has examples handy of "good" unit tests for some simple real world library? I suspect I'm maybe overdoing it a little
|
# ? Mar 9, 2019 01:00 |
|
me, 3 hours ago: this C GEM library sucks, I want object oriented controls me, 5 minutes ago: I think I’ve accidentally invented WinApi common controls but for the Atari ST
|
# ? Mar 9, 2019 01:05 |
|
hackbunny posted:ctps: writing unit tests for the first time in my life and I'm exhausted. this is taking me an ungodly amount of time, but I'm anxious about hitting all the corner cases. anyone has examples handy of "good" unit tests for some simple real world library? I suspect I'm maybe overdoing it a little not sure if it is possible to hit all corner cases or even most of them before you need unit tests on the unit tests seems to be a thing where practice will help you figure out the balance personally I try hitting only the corner cases that I think might be occurring actually or the cases that could be difficult to detect and debug later on
|
# ? Mar 9, 2019 01:36 |
|
hackbunny posted:ctps: writing unit tests for the first time in my life and I'm exhausted. this is taking me an ungodly amount of time, but I'm anxious about hitting all the corner cases. anyone has examples handy of "good" unit tests for some simple real world library? I suspect I'm maybe overdoing it a little check ur coverage (no really, it points out when you miss branches)
|
# ? Mar 9, 2019 01:41 |
|
also I think unit tests are meant to force you write the software in easily testable layers so you can replace the layers later on if you need to without messing with tests ie like when you replace your thing which handles db interaction then you can focus on only that and know that whatever you do in the code as long as tests succeed you should be good
|
# ? Mar 9, 2019 01:44 |
|
|
# ? Apr 24, 2024 18:28 |
|
i've been wondering if unit testing in embedded/kernel/IoT space can be useful, there's an itch to try but when you don't even compile in all of the standard library into the firmware to save space it's fairly hard to design tests which would actually be meaningful and still run on the device and most of the bugs come from a complex interplay of PCBs/firmware/components/third-party software anyway obviously hardware testing/black box testing is important, but that's another kettle of fish entirely e: there's the design verification route of running in a simulator maybe, but I don't know if that wouldn't bring in even more issues than it would solve Private Speech fucked around with this message at 02:19 on Mar 9, 2019 |
# ? Mar 9, 2019 02:06 |