HackerTrans
TopNewTrendsCommentsPastAskShowJobs

txbuck

no profile record

comments

txbuck
·3 ปีที่แล้ว·discuss
Not necessarily advocating for unidiomatic python/code, but you could use a decorator to automatically wrap the function call with a try-catch and package the return value appropriately. Lot less mangling of function bodies that way, just return and raise exceptions like normal. You *could* specify the expected Exception type, but considering the rest of the ecosystem probably won’t be following along with documenting expected exceptions, I assume it wouldn’t be worth it and would be more straightforward that all the exception types in the signatures be the plain vanilla Exception. Would also be super inefficient pre-3.11 but ¯\_(ツ)_/¯
txbuck
·3 ปีที่แล้ว·discuss
Surely you didn't comment before viewing the post.
txbuck
·3 ปีที่แล้ว·discuss
For reference, something like like this (Python regex):

  ^[a-zA-Z_]+[a-zA-Z0-9_]*(-?[a-zA-Z0-9_]+)*$

  some-name
  some2-name
  some-2-name
  some-2name
  some-name2
  some-name-2
  some2other-name
  some-other2name
  some-othername2
  some-2othername
  some-0-other-name
  a-0-name
  a0-0a-0a-a0
  kebab-case-pls
  tbh-didnt-write-any-underscore-tests

  -negated
  -negated-variable
  -(negated)
  -(also-negated)
  -(-double-negated)
  binary - operation
  binary + operation
  double - binary - operation

  2-syntax-error-4-me
  2syntaxerrorforme
  1-2-3-4-syn-tax-err-or
  80086-syntax-error
  syntax+error
  syntaxerror+
  syntax-error+
  syntax-error-
  syntax-(error)
  (syntax)-error
  syntax--error
  syntax++error
txbuck
·3 ปีที่แล้ว·discuss
(Hot damn, that was a super thorough/thoughtful reply in a short amount of time.)

You're spot on about the quirky syntax, but I don't think it's as serious a trade-off or addition in complexity (or even a change), given that:

- (IIRC) many style-guides/formatters already enforce spaces between binary operators and their operands (but especially identifiers) and in my super-subjectively-opinionated opinion you should already be doing that even without a formatter

- I don't feel particularly strongly one way or another about any other special characters like "+", so really in this case I'm only considering the dash

- Requiring the dash be between alpha/alphanumerics makes it play nice with unary operators

- The language would be terrible for code-golfing, but that's a relatively niche application I'd definitely consider worth spurning
txbuck
·3 ปีที่แล้ว·discuss
I've seen it dubbed "sponge-case" and am pretty fond of the term.
txbuck
·3 ปีที่แล้ว·discuss
The fact that kebab-case support is a rarity constantly boggles my mind, nevermind that it isn't the de facto default for any language created after *sh/lisp. Readability, ease-of-typing, parallel with the way it's used in (Romantic) natural language. If I were writing a new language I intended to popularize this would be one of the features I would emphasize.

Spicy semi-snarky aside: if your counterpoint is that kebab-case prevents crushing your arithmetic operators together, I strongly suggest you either reconsider or never write any code you think may be read by another human being (and possibly yourself).
txbuck
·4 ปีที่แล้ว·discuss
If anything is gonna happen it's more likely The Powers That Be would limit use and/or distribution instead of mandating a change to code itself. Half of them probably don't know how to connect to their home Wifi network, nevermind authoring and mandating a commit.
txbuck
·4 ปีที่แล้ว·discuss
I don't plan on having kids of my own, but if life finds a way (or I end up with custody of a relative's children) I figured I would similarly put together some kind of loose "curriculum" to guide them along if they took an interest in computing. Never actually planned it out - is a pretty large domain of knowledge to cover for something I don't currently plan on using, but I wouldn't be surprised if there are already pre-existing FOSS resources along those lines.

Anybody know of any projects in the same vein?
txbuck
·4 ปีที่แล้ว·discuss
As far as ergonomics go, a controller-like form-factor is almost definitely the current ideal for a portable, carry-able, holdable keyboard. Obviously just slapping QWERTY on it wholesale may not be the best idea, and doing the R&D for a more appropriate layout or entirely different approach to input could be costly. carriers for phones or other devices could also complicate it. Might be the reason there aren't more on the market? Is there anything like it out there now? I searched around for something like this a while back, wasn't really satisfied with my findings, and haven't been able to stop thinking about it since.
txbuck
·4 ปีที่แล้ว·discuss
"I spend all day getting pissed at my machine for doing exactly what I told it to do."
txbuck
·4 ปีที่แล้ว·discuss
Would be neat to take a lot of the submitted sounds of old machines (computers or otherwise) and write a background process that manipulates and plays them while performing certain tasks, like loading from an external drive, or using the more ambient sounds for 'idling'. Lord knows if I could make my machine sound like Nostromo's Mother, I'd do it in a heartbeat.
txbuck
·4 ปีที่แล้ว·discuss
Not exactly what you're talking about, but I've seen a few RaspberryPi + iPad + External Keyboard setups where they either use the iPad as an external display or VNC into the Pi from the iPad. IIRC you can power the Pi via USB C -> PoE on iPads with sensible ports on them, so you don't need an external battery or UPS.

Again, not what you actually want (I share your pain/longing), but damn if it isn't starting to get close.
txbuck
·5 ปีที่แล้ว·discuss
"For Tesla, Facebook and Others, Misusing AI and Pretending It's a Magic Bullet Is Getting Harder To Ignore"