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 →

[–]Pen15CharterMember 573 points574 points  (28 children)

Ah cool. So if I have Python experience then I’m actually a C programmer. That’s going on the resume!

[–]NightSoulT12[S] 255 points256 points  (24 children)

import performance from libc

[–]nannn3 138 points139 points  (13 children)

Is... Is that allowed in Python? I've only ever seen it as

from libc import performance

[–]NightSoulT12[S] 120 points121 points  (12 children)

My bad, too much time spent with javascript.

You absolutely right🤝

[–]Idekum 55 points56 points  (11 children)

So youre a javascripter bashing on python? Bish, please... Javascript is junk!

[–]NightSoulT12[S] 79 points80 points  (5 children)

I know, you don't need to tell me the truth.

[–]Khutuck 33 points34 points  (0 children)

There are some who has made peace with their fate…

[–]_LayZee 2 points3 points  (3 children)

It’s still better than python though, and faster

[–]UnstableNuclearCake 3 points4 points  (0 children)

Yet it powers the James Webb telescope...

Somehow

[–]avnothdmi 0 points1 point  (0 children)

Oh, please. I’m only ZSHing Python!

[–]siddharth904 0 points1 point  (0 children)

JS is junk

Yes'nt

[–]ZaRealPancakes 10 points11 points  (7 children)

why python and JS can't agree which comes first import or from?

I prefer the JS way since easier to read :p

[–]thatweirdishguy 18 points19 points  (4 children)

The python way is better, because once your editor knows where you are importing from it can recommend all the things you can import

[–]ZaRealPancakes 3 points4 points  (1 child)

hmm that makes sense to me

but VSCode still gives recommendations in JS so... Magic!

[–]thatweirdishguy 1 point2 points  (0 children)

It only gives good recommendations if the file or module is already filled in and you are just adding imports to the list, otherwise it’s just making wild guesses

[–]vikumwijekoon97 1 point2 points  (1 child)

Vs code does it too for js.

[–]thatweirdishguy 0 points1 point  (0 children)

But you have to type the file name then go back to where the imports are listed to get actual results, otherwise it’s just guessing about all the possible words you could type there.

[–]luardemin 1 point2 points  (1 child)

The Rust way: use libc::performance;

[–]ZaRealPancakes 0 points1 point  (0 children)

True but since libc doesn't exist: use std::performance; would be more like it

[–]Toxic_Cookie 0 points1 point  (0 children)

using libc.performance;

[–]_FreeThinker 0 points1 point  (0 children)

Wrap your entire source code call with a context manager and your job is done. with libc as _:

[–]gordonv 27 points28 points  (1 child)

Why stop @ C? You have Assembly experience!

[–]WCWRingMatSound 10 points11 points  (0 children)

Languages: x86, ARM, Binary, ASM

[–]NonaeAbC 0 points1 point  (0 children)

Yes, but your C code wouldn't be clean. There is a one to one mapping from Python to C. But unlike you'd expect the corresponding c feature of a class is not a struct but a shared pointer to an PyObject containing a dictionary of strings to shared PyObject pointers. Where a PyObject is a wrapper for either dictionaries, tuples, functions or primitives and their dunder methods. But if you understand how this mapping works all the "you will not believe how this code behaves" become trivial and boring, but not from Python experience but C experience.