Better HN
topnewbestaskshowjobs
Log inSign up

chrisheller

10 karma · joined Jan 22, 2015 (11y ago) · 6 submissions

Submissions

comment 11y ago · link · parent

I'm not sure if the transposition was intended, but your comment shows another reason why using a calculated value here is good.

comment 11y ago · link · parent

Have you played around with Nimborg? That allows embedding Python in Nim fairly easily.

https://github.com/micklat/NimBorg

I've been able to call into the Nim side from Python by treating the Nim code as C functions to call. That works, but it would be interesting to come up with a more Pythonic way of doing that.

comment 11y ago · link · parent

I saw the original link on my phone yesterday. The screenshots in the post were unreadable since pinch and zoom was disabled, so I didn't fully understand until pulling up HN on a larger screen today.

I have no idea how many other people might have read your submission on their phone and had the same issue though.

comment 11y ago · link · parent

NimBorg is what you're looking for, https://github.com/micklat/NimBorg

comment 11y ago · link · parent

I haven't looked closely at the Vala stuff that you mentioned, but it is very straightforward to generate shared libraries in Nim with exported functions that you can access via ctypes. That's not quite the same as generating a python module that you can directly import, but it gets the job done.

You might also be interested in NimBorg, https://github.com/micklat/NimBorg , which supports embedding Python or Lua in a Nim program.

comment 11y ago · link · parent

You'll get an IndexError exception on that if there are any blank lines in the file.

Changing that to line.lstrip().startswith('#') would be an alternate approach.