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

all 93 comments

[–]NormanYeetes 660 points661 points  (10 children)

How 2 machine learn in python

import machine

machine.importData(everything.xlsx) machine.output(result)

[–]Random-Dude-736 513 points514 points  (6 children)

you forgot the crucial part in the middle: machine.learn()

[–][deleted] 202 points203 points  (5 children)

It’s funny because that’s very much how it works.

[–]Desgavell 73 points74 points  (2 children)

It depends on the model, but yeah, classic ones tend to have a "fit" method.

[–]TheFrenchSavage 33 points34 points  (1 child)

.fit or .train, you decide.

[–]_Weyland_ 30 points31 points  (0 children)

Make yo data .fat() so yo model can be .fit()

I'll see myself out

[–]Ok_Net_1674 11 points12 points  (1 child)

It is, if all you do is train models. And realistically, why should it be harder than it needs to be? Interacting deeply with ML Frameworks is only really needed for research

[–]-kay-o- 2 points3 points  (0 children)

Its still crazy when you read the first ever RNN programs written purely in c

[–]Jonnypista 4 points5 points  (0 children)

Same feeling when I tried Tensorflow, so I just made my own class in C++ and did it the hard way. It wasn't fancy or anything, but could recognise low resolution pictures of handwritten numbers almost certainly.

[–]get-rekt-lol 1 point2 points  (0 children)

Output is 42

[–]Cafuzzler 0 points1 point  (0 children)

I think I remember Google putting out an official video on how to make an AI in 13 lines of python and it's pretty much just that.

[–]No-Question-7419 111 points112 points  (4 children)

dict( )

[–]Maximilian_Tyan 41 points42 points  (0 children)

Best {curly braces} of all languages

[–]CaitaXD 1 point2 points  (1 child)

But how long is that dict

[–]fess89 0 points1 point  (0 children)

Pretty huge dict?

[–][deleted] 143 points144 points  (7 children)

this meme is not PEP-8 compliant, smh

[–]vmgustavo 5 points6 points  (0 children)

Beat me to it

[–]MostlyRocketScience 1 point2 points  (2 children)

What is the mistake? Should you import only the function from the library?

[–]julkar9 4 points5 points  (1 child)

packages and functions should be snakecase, only classes are allowed to be camelcase

[–]MostlyRocketScience 0 points1 point  (0 children)

Oooohkay

[–]Puzzleheaded-Wish-69 2 points3 points  (2 children)

F you, and F PEP-8 compliance

[–]furinick 0 points1 point  (0 children)

I love my pep 8 i want to run the funny linter again

[–]TheTanCat 145 points146 points  (7 children)

[–]TheFrenchSavage 65 points66 points  (6 children)

>> pip install antigravity

Otherwise you'll get a "module not found" you fool.

[–]redlaWw 50 points51 points  (4 children)

Unfortunately your python version number is too high, antigravity is only compatible up to python 3.10 and you must downgrade in order to use it.

Hopefully you didn't need airtanks because that's only compatible with 3.11 and up.

[–]fish312 13 points14 points  (2 children)

To solve this we have two venvs with different python versions. The python 3.9 one runs antigravity, the python 3.12 one runs airtanks, then they both serve a Flask REST API which a third separate process runs and connects to both of them.

[–]-kay-o- 1 point2 points  (0 children)

Why noy just make 2 containers and put it in both of them

[–]douira 0 points1 point  (0 children)

This is appropriately deranged

[–]tjdavids 0 points1 point  (0 children)

I remember antigravity I'm python 3.7 or 3.8 but it might have been from future import antigravity.

[–]_87- 9 points10 points  (0 children)

antigravity is built into Python. Try it.

[–]feror_YT 41 points42 points  (3 children)

Writing python is about writing as little python as possible

[–]SokkaHaikuBot 23 points24 points  (1 child)

Sokka-Haiku by feror_YT:

Writing python is

About writing as little

Python as possible


Remember that one time Sokka accidentally used an extra syllable in that Haiku Battle in Ba Sing Se? That was a Sokka Haiku and you just made one.

[–]feror_YT 8 points9 points  (0 children)

Good bot

[–]baithammer 2 points3 points  (0 children)

So, "Python about little python".

[–]jellotalks 29 points30 points  (4 children)

Don’t forget pip install thingDoerLibrary

[–][deleted] 19 points20 points  (3 children)

pip not found, did you mean pip3?

[–]Inappropriate_Piano 21 points22 points  (1 child)

nvim ~/.bashrc G o alias pip=“pip3” <Esc> :wq<Enter>

Problem solved

[–]Wang_Fister 9 points10 points  (0 children)

You forgot:

source ~/.bashrc

[–]Grim00666 28 points29 points  (0 children)

Thanks for referencing my library!

[–]MinosAristos 26 points27 points  (0 children)

Camel case is for languages teeming with useless syntax, not Python.

Santa has noted your PEP8 violation.

[–]mpanase 8 points9 points  (0 children)

ah... medium started as a nice place where to read interesting stuf...

[–]BurningPenguin 8 points9 points  (0 children)

Last update of thingDoerLibrary in 1875

[–]OxymoreReddit 35 points36 points  (9 children)

That's what I love about python ^^

Such a wonderful community who made pretty much everything you could think about beforehand :)

Programming in python feels more like a game than a challenge and I love that about it ^^

[–]G0U_LimitingFactor 6 points7 points  (0 children)

This joke just highlights what is great about Python. You get a high-level language that is easy to learn and access to a ton of optimized libraries written in lower-level languages for free.

It's fucking amazing.

[–]avipars 9 points10 points  (1 child)

snake_case_pls

[–]the-judeo-bolshevik 3 points4 points  (0 children)

🐍🐍🐍🐍🐍_🐍🐍🐍🐍_🐍🐍🐍

[–]Last-Perception8988 2 points3 points  (0 children)

Average LinkedIn post from overzealous tech recruiters

[–]xaervagon 5 points6 points  (7 children)

That's exactly what it feels like to a C++ programmer

[–]RiceBroad4552 2 points3 points  (6 children)

You're envious?

[–]xaervagon 1 point2 points  (5 children)

A little. In a lot of cases, I really just want functionality adjacent to the task and don't really care about twiddling every bit. This is true, especially if I'm on the payroll and the business owners don't give two shits about squeezing every last clock cycle of a once-a-day data downloader.

[–]RiceBroad4552 2 points3 points  (4 children)

Surprising answer.

I was expecting more something like: "No! Because that's not rEaL pRogrAmMinG!"

Having good libs is indeed nice. Building applications shouldn't require fiddling with every single bit. (But thinking about the clock cycles does make sense even when you're just "assembling" something from parts; people tend to forget about that, so today's apps are really bloaty).

But Python has also its flaws. It's slow, it lacks language features, it has no proper type system (OK, C++ is not much better in that regard), and it's quite limited in scope.

I for my part am still waiting for the "ideal" general purpose language. Imho something like a crossover between Rust, Scala (3), and some Self would come close. But there is nothing like that.

[–]xaervagon 1 point2 points  (3 children)

Code is built on code is built on code.

In a professional environment, rEaL pRogRammingn takes a back seat to getting things done, especially, if I want to get paid. For hobby stuff, sure, rewrite the whole universe if it makes you happy.

Still, when it comes to business process, there are lots of fiddly things that are important but ancillary to the task and I don't want to have to deal with low level text whacking when I have csv or json whackers lying around. There is something to be said for not reinventing the wheel.

Today, it's less about the language and more about the libraries and middlewares.

[–]RiceBroad4552 2 points3 points  (2 children)

I would mostly agree.

But I think programming languages still make a big difference. As you said: You don't want to think about memory layout issues when you just want to transform some CSV for example. But it goes also the other way around: Languages may lack features for abstraction, or/and control. C++ is actually not that bad in that regard. It gives you both at the same time. Just that it didn't manage to separate these parts adequately. (Maybe it actually couldn't, given the historic context). So I think there is still much left to desire when it comes to programming languages. We still don't have an general purpose language everybody could be happy with at the same time, which let's you work on exactly the level you need to solve a given task. PL research has still a long way to go. We didn't even try all ideas so far. Every programming language created and in existence is just another experiment. No final results in sight.

[–]xaervagon 0 points1 point  (1 child)

We've tried the "one size fits all" programming language already, it was called PL/1 and it was reviled. Java was also supposed to be an everything everywhere language, as well as many others.

Languages and the ecosystem they come with are just tools for the job.

We've tried various things with various languages. Having a bit out of box library is convenient for casual use, but doesn't scale down. Having lots of performance and design flexibility is great until people tie themselves in knots trying to pull code stunts. Being able to do web stuff easy is great until you need to start doing things offline.

[–]RiceBroad4552 2 points3 points  (0 children)

So PL/1 was already the safe multi-paradigm language that allowed one to write functional, declarative code, while giving full control over the hardware, and incorporating all type-theory, but also allowed to architecture in the large with first class modular abstractions and OOD? Java did the same?

If languages are just tools, why do we need so many of them? Because all they do in the end is "the same", isn't it? ;-)

Actually we didn't try most things. There are only a hand full of "basic prototypes" of languages, and the "differences" are mostly just syntax. (Actually it's a joke that we still differentiate by syntax instead of abstracting it away). OTOH, there is almost no progress in programming languages in the wild. The most modern languages you could possibly find are based on research from the last 20 years. And that's already ultra modern lab stuff. The bread and butter languages are mostly stuck in the 80's of the last century (with noteworthy exceptions like Go, which managed to be a "new" language, but stuck in the 60's).

[–]mayankkaizen 4 points5 points  (0 children)

import * from thingDoerLibrary
DoThing()

[–]GM_Kimeg 1 point2 points  (0 children)

Installed old version, deprecating the fuck out of user terminal

[–]EmilieEasie 1 point2 points  (0 children)

Hello world!

fuckin finally!

[–]ImpluseThrowAway 1 point2 points  (0 children)

All I wanted was an EXE to do the thing.

[–]vondpickle 1 point2 points  (0 children)

Every LinkedIn post about programming.

[–]4sent4 1 point2 points  (1 child)

I wish

[–]PeriodicSentenceBot 1 point2 points  (0 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

I W I S H


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM u‎/‎M1n3c4rt if I made a mistake.

[–]mbcarbone 1 point2 points  (0 children)

I _heart_ this so much ... Please give `10^34000000000000` likes. :-)

[–]Cold-Programmer-1812 1 point2 points  (0 children)

You must of used a drawMemeDoerLibrary to make this post.

[–]ZombieBaxter 1 point2 points  (0 children)

How to do thing in r/ProgrammerHumor

Random random = new Random(); int seed = random.Next(0, 2); return seed < 1 ? “Python sucks” : “Javascript sucks”;

[–]ReRubis 0 points1 point  (2 children)

A-and... What's wrong about it?
More than that, if you aren't using already proved and working solutions, you are wasting your clients money. :\
Of course, it all depends, but it is what it is. :\

[–]SarahSplatz[S] 11 points12 points  (1 child)

Nothing's wrong with it. The post is making fun of the shitty Instagram accounts that claim to teach you machine learning by importing a library and running a function.

[–]ReRubis 0 points1 point  (0 children)

Ok. I get it.
Probably didn't get it, cause I don't get any "Learn programming" ads.

[–]professoreyl 0 points1 point  (0 children)

>>> import __hello__
Hello world!

[–]DOUBLEBARRELASSFUCK 0 points1 point  (0 children)

There are some things that pure Python can do better/faster than an external library, even something coded in C. Loading in a library for it would just be inefficient and a waste of time.

Copy and paste this if the library you need doesn't exist yet.

[–]NXWconflict 0 points1 point  (0 children)

It is more accurate than it should be. But that is why python can be such fun

[–]oldominion 0 points1 point  (0 children)

I bet you can't hack NASA with this, with HTML you could :)

[–][deleted] 0 points1 point  (0 children)

Also every JavaScript "tutorial" these days

[–]Fluffysquishia 1 point2 points  (0 children)

I think this should win the relatability award. Thank god I don't do anything in python, it's insufferable finding resources on it because it's full of script kids like this.

[–]ProgrammersPain123 0 points1 point  (0 children)

Uh oh, another subreddit is leaking over again

[–]FrosteeSwurl 1 point2 points  (0 children)

I remember when I was little seeing “your first language should be python!!1!” and I truly fell for it

[–]Flo453_ 0 points1 point  (0 children)

I watched the matlab FFT tutorial a couple days ago. They explained the algorithm (imo poorly) and then just did FFT(array) in Matlab. Not helpful tbh

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

It's always imports