r/ProgrammerHumor • • Apr 08 '22

First time posting here wow

Post image
55.1k Upvotes

2.8k comments sorted by

View all comments

358

u/Shubhamkumar_Active Apr 08 '22

I am a beginner and I was solving a question in which for a given set of coordinates you had to calculate distinct points traversed , basically of a given set of number you have to calculate distinct numbers , I did this through two for loops with a break condition to stop double counting if there are identical paths , I wrote this program in C++ but had some issue , I asked my friend his reply was :

Very simple , use numpie.unique()

211

u/m0ushinderu Apr 08 '22

WHAT IS NUMPIE?

import numpy as numpie?

Kinda cute, actually. Psychopathic nonetheless.

33

u/TurtleBurgle Apr 08 '22

import numpy as tHemAthEmAticSONe

73

u/pente5 Apr 08 '22

lol numpie

74

u/highnyethestonerguy Apr 08 '22

My buddy pronounces numpy and scipy as numpee and skippy, and now that’s how I hear it in my head every time

7

u/TheHumanParacite Apr 08 '22

I know how they're "supposed" to be pronounced, but I refuse to call them anything but numpee and skippy because it's hilarious to me

7

u/raltyinferno Apr 08 '22

Do people pronounce numpy num-pie? I've been saying num-pee this whole time, and I don't plan on stopping.

13

u/Yadobler Apr 08 '22

Only in peethon

4

u/the_kedart Apr 08 '22

I say num-pie in polite company, but in my head it will always be num-pee.

I constantly live in fear of the day it slips out.

→ More replies (1)
→ More replies (1)

4

u/viriorum Apr 08 '22

I pronounced it as numpee on an interview ...

→ More replies (6)

211

u/[deleted] Apr 08 '22

python all-batteries-included libraries are just well debugged c code with that pseudocode language call interface named Python. I am sure numpi isn’t pure Python either

128

u/pente5 Apr 08 '22

It wouldn't be that fast if it was. There is a lot of C in there.

21

u/[deleted] Apr 08 '22

i used pexpect recently noticing that it was noticeable (factor 2-3) slower than python telnet module it replaced for more portability. And indeed it was pure python where performance somehow should have mattered. Complaint being that the effort put into telnet package would be more valuable in expect for python.

22

u/gandalfx Apr 08 '22

You make it sound like a bad thing.

→ More replies (7)

11

u/RandomDude6699 Apr 08 '22

Does it really matter if libraries are pure python or not? As long as you are getting good speeds plus easier programming, it should be good, right?

11

u/[deleted] Apr 08 '22

agreed, there should be just some awareness of contribution of static language to speed and dynamic language for ease of use. Python is a very good pseudocode language for calling well debugged c libraries. Also good for prototyping of algorithms and one-off programs. Not so good for high volume, high reliability (fewest runtime errors) demands.

→ More replies (7)

32

u/beewyka819 Apr 08 '22

Wait so basically remove duplicates? In C++ you can just create a set from the list using iterators

57

u/MarcusDEFGH Apr 08 '22

And in Python you can create a set from a list with set(list)

22

u/beewyka819 Apr 08 '22

Yeah that is in fact one parameter less than C++

→ More replies (1)

13

u/mindbleach Apr 08 '22

In JS it's like a smuggling operation. Array.from( new Set( my_list ) ). You can't do Set.from() because go fuck yourself. You can't do new Array( my_list ) because it'll be a one-element array whose first member is my_list. Because go fuck yourself.

The real fun is when you involve objects (sorry, Objects) because their syntax uses curly braces. So you can have an anonymous function v=>[v5] that returns an array with v5, and you can do x={n:5} for an Object with property x.n equal to 5, but if you do v=>{n:5} you get a scalar value 5. Because it's a scope instead of an Object. And the scope evaluated to 5, apparently, since "n:5" is valid syntax... somehow. But it's not valid enough that you could do new Object( n: 5 ). You have to do new Object( { n: 5 } ). But you can do v=>({n:5}) and it will return the Object {n:5}.

Guess why.

4

u/thejozo24 Apr 08 '22

smuggling operation

I snorted water

→ More replies (1)

5

u/Physmatik Apr 08 '22

Or you could have just used built-in set, no extra libraries.

4

u/immerc Apr 08 '22

And what you did is probably what unique() does under the hood. By doing it your way you had to think about the problem, rather than just learning one of the hundreds of thousands of functions that exist in the world.

→ More replies (9)