Hacker Newsnew | past | comments | ask | show | jobs | submit | chrisheller's commentslogin

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


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.


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.


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


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.


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.


You're right but that is irrelevant, it's a somewhat contrived example anyway. It's not like I spent a lot of time trying it out.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: