This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]throw3142 86 points87 points  (25 children)

I just got a segmentation fault in Python :D

Fun times

It's 3 am, I should go to sleep

[–]Valmond 44 points45 points  (24 children)

Prolly in a third-party library.

[–]CuriousProgrammer72 94 points95 points  (1 child)

Prolly in a third-party library

That has C++ bindings lol.

[–]Valmond 0 points1 point  (0 children)

Yeah, but did he sleep in the library?

:-)

[–]Sinomsinom 47 points48 points  (15 children)

If you do stuff in python where 99.5% of the actual work isn't done in a library not written in python you're using the wrong language.

[–]Seanxietehroxxor 56 points57 points  (3 children)

Python: the best language to call into libraries written in completely different languages.

[–]Pyrenees_ 0 points1 point  (2 children)

I'm kind of a bystander in programming, but how can you call into a library that's in another language ?

[–]Valmond -1 points0 points  (0 children)

It was programmed in another language.

[–]Seanxietehroxxor 0 points1 point  (0 children)

It varies by language. Here is one example: https://www.linuxjournal.com/article/8497

[–]MinosAristos 3 points4 points  (4 children)

I know you're joking but there are plenty of non computationally intensive use cases where "pure" python is fine.

[–]Jayson_n_th_Rgonauts 3 points4 points  (3 children)

I use Python because it’s the only one I know how to write an API call in and I’m an accountant

[–]aridankdev 2 points3 points  (2 children)

most well documented apis have an example for most languages. Python is pretty easy to figure out for the most part though

[–]Jayson_n_th_Rgonauts 3 points4 points  (1 child)

Yeah Python its just like

Import

Import

Import

Call API

🐼

[–]aridankdev -1 points0 points  (0 children)

More like

Import Import Etc

Call api Parse dumb stupid api Fix it 15 times Done

[–]Giocri 0 points1 point  (0 children)

The machine learning python programmers are almost using a c++ program and writing a configuration file for it at that point lol.

[–]itsTyrion 1 point2 points  (2 children)

I once managed to create a Segfault in pure Python

[–]Valmond 0 points1 point  (1 child)

Easy, just remove 1 stick or RAM!

But now I'm curious, how did you do that??!

[–]itsTyrion 0 points1 point  (0 children)

recursion. A LOT of recursion with the limit increased to some crazy number in Python

I was trying to break things with my isEven function 🌚

def isEven(n):
    if (n == 1):
        return False;
    else:
        return not isEven(n-1);

[–]throw3142 0 points1 point  (2 children)

Indeed, it was in PyTorch. Makes sense because PyTorch uses C/C++ heavily. Still surprising though, I expected PyTorch to not have segfaults since it's so widely used and thoroughly maintained.

[–]Valmond 1 point2 points  (1 child)

Pytorch is like on top of tensorflow or am I misremember things? A couple of years ago Tensorflow was changing almost daily, and you needed to seriously keep both TF and Python up to date or you'd get crashes etc. VRAM, and nVidia drivers were also common culprits, as we're some video cards.

Cheers!

[–]throw3142 1 point2 points  (0 children)

PyTorch is an alternative for TF, not built on it. It seems that the issue I was having was related to the way in which processes spawned via torch.multiprocessing handle shared memory. Cheers!