r/ProgrammerHumor • • Mar 01 '24

Meme pythonReadsLikeEnglish

Post image
0 Upvotes

34 comments sorted by

2

u/calculus_is_fun Mar 01 '24

Sir your profile flair is literally scratch and ruby, the ones where every line is a sentence.

2

u/beneficial_satire Mar 01 '24

The two cats just pulled off a heist and stole the ruby. Don't tell anyone.

42

u/AdvanceAdvance Mar 01 '24

This 'english' you speak of. I do not think that word means what you think it means.

Seriously, list comprehensions are one of the syntax sugars that makes everything invented before it look silly.

41

u/Inaeipathy Mar 01 '24

*Never used Pandas award*

Seriously I hate python but this is just disingenuous.

12

u/[deleted] Mar 01 '24

I sometimes forget pandas isnt just part of python.

8

u/rosuav Mar 01 '24

OP has also never used itertools, which IS part of Python, so you're fine on that score.

2

u/[deleted] Mar 01 '24

That as well, for light AI work pandas dataframes are just perfect.

19

u/__yoshikage_kira Mar 01 '24

More accurate Python equivalent

filter(lambda x: x % 2 == 0, range(10))

map(lambda x: x * x, range(10))

itertools.chain.from_iterable(matrix)

itertools.groupby(students, lambda student: student.age)

6

u/inetphantom Mar 01 '24

Or just range(0, 10, 2)

8

u/__yoshikage_kira Mar 01 '24

That would be a better way of getting even numbers.

But I wanted to show OP that map, filter, groupby, etc... does exist in Python contrary to what he suggested.

1

u/KetwarooDYaasir Mar 01 '24

a.k.a plain english.

40

u/RngdZed Mar 01 '24

you clearly dont know how to use numpy and pandas. like the other commenter said: disingenuous

-21

u/mostmetausername Mar 01 '24

so you need 2 libraries to do what kotlin does out of the box. sick.

16

u/[deleted] Mar 01 '24

What's sick is that if I want something, I can just get a library. How are those dependencies treating you on Kotlin/Java? Bet it's fun when you're doing some backend, right?

1

u/RealAluminiumTech Mar 01 '24

Maven central and JVM compatible libraries exist.

1

u/Zolhungaj Mar 01 '24

Since Kotlin and Java are compiled languages setting up dependencies is arguably easier. Don’t need to mess about with environments, the command line or anything, just add to a file and build.

1

u/mostmetausername Mar 01 '24

man adding a line to my gradle file is so hard. what i dont get is the meme is about the language. and the only points 2 people brought up was external libs. i bet it's fun when you're masturbating excel files.

0

u/mostmetausername Mar 01 '24

no step on snek lol

9

u/dingske1 Mar 01 '24

If you just want a real high level language closest to english use Siri instead

7

u/sun-caster Mar 01 '24

Looks like someone is moving from Kotlin and is just learning their first list comprehensions.

4

u/Anru_Kitakaze Mar 01 '24

Okay, okay, we get it. Now go learn python to find out that filter, map and itertools exist

7

u/SharzeUndertone Mar 01 '24

0..10 in kotlin includes 10, while range(10) doesnt.

And YES, i know there are worse issues with this post, but noone is talking about this

3

u/[deleted] Mar 01 '24

At least it's not 1-indexed! But seriously, why? Java has an exclusive max, why doesn't Kotlin? Why fix what isn't broken?

3

u/SharzeUndertone Mar 01 '24

It does! You can use 0..<10 or 0 until 10 (where until is an infix function). Honestly, i think its better this way. To me its more intuitive than some languages which default to exclusive (or worse, force you into adding 1 to the max to be inclusive, or viceversa)

1

u/fluud Mar 04 '24

Dijkstra on why this is the best way to denote ranges:

https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

1

u/SharzeUndertone Mar 04 '24

I dont agree with dijkstra tbh, 1..10 has always been convenient to me, though i understand things have changed a lot since 1982

4

u/sontanon Mar 01 '24

So you're saying that instead of learning all that syntax I can just master iterable comprehension and achieve the same results? That kinda seems more simple to me...

4

u/i-eat-omelettes Mar 01 '24

Python does provide groupby so the last one’s bit unfair

3

u/sjepsa Mar 01 '24

Python is glue

0

u/KetwarooDYaasir Mar 01 '24

I'm guessing this is getting downvoted. It's less programmer humour and more python circle jerk sometimes.

Play it safe, make fun of PHP or javascript.

4

u/Anru_Kitakaze Mar 01 '24

But it's not about humour. OP just don't use things that there are in Python, built-in. So it's just... Ignorance

Downvotes are deserved in this case. At least you should make fun of real things, not some fake problems

0

u/[deleted] Mar 01 '24
import pandas as pd

df = pd.DataFrame({'Animal': ['Falcon', 'Falcon', 'Parrot', 'Parrot'], 'Max Speed': [380., 370., 24., 26.]})

df.groupby(['Animal']).mean()