Python

Why the fuck would anyone use this? Does it have any advantage over other object oriented languages besides being accessible to normies?

Attached: python-logo-master-v3-TM.png (601x203, 82K)

Other urls found in this thread:

blogs.dropbox.com/tech/2014/07/open-sourcing-our-go-libraries/
learnpythonthehardway.org/book/nopython3.html
python.org/').read()
open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0707r0.pdf
twitter.com/NSFWRedditVideo

It's a Ruby for brainlets

It's only used because of it's huge library. Whitespace syntax is gay and ugly.

Its essentially for people who arent programmers but who need to program something to do small tasks for them. Its fine

Native c libraries support. Pretty easy and cheap to program, while maintaining good performance.

I'm doing a lot of python code related to work. Most I can complain of it is the identstion and the use of variants. Python is quite comfy once you get used to it

>while maintaining good performance.
Lol, python is slow as shit

Duck typing.

Have you ever tried it? It's quite a bit more flexible than any programming language than I've tried thus far. It's quite portable, too.

Coming from net and c I used to think the same however I now see python can be very powerful. What I still find bad to deal is the lack of some oo languages like interfaces but you can multiple inherit like c.

Python has inheritance.
It may not be *true* inheritance like C++ or Java, but it has some schemes.

By the way, C doesn't have inheritance. C has structs. That's about it.

Web mostly.
If you want good and easy framework such as Django/Flask, and its free, you just gotta roll with it.
Or face callback hell with node.js or shit performance with php.

Citation needed

I'm working with a full orm erp written in Python and it's pretty fast with shitty hardware.

I used to do a lot of code to arcgis, who is made in c and basically you manage it with python code.

When you need fast code just make a c library and use it on python.

You forgot go

>Ruby came before Python

Yes I should had said, c++, basic c has no inheritance.

>C has structs. That's about it.
That isn't as limiting as you think.

This.

> while maintaining good performance.
You clearly have no idea why Python is even remotely performant.
Hint: It's not because of any native python code

Python is only powerful in the sense that it supports lambda expressions and write-only one liners, which novice programmers mistake for flexibility and strength. It's not. It's a gigantic weakness.

Also it becomes a fucking nightmare the second you start working with anybody elses codebase, because
1) Function signatures literally don't tell you anything. What types are these arguments supposed to be? What is the full scope of this function? What return types can I expect? Oh wait I can expect anything because Python will return fucking anything, a tuple, an int, a bool, a string, and it could be any of these based on any condition the author set.

Its OOP is also a legacy interpreter hack, and it's somehow "Everything is an object!...except when it isn't!" in the biggest retarded design I've ever seen.
Oh, and it recommends spaces over tabs. In a whitespace syntax language. Spaces. The thing that's easier to fuck up and not notice. Over tabs. Fucking kidding me.

python is shit
just a toy language for students and sysadmins

this board is full of retarded students

>comfy
go finish your homework kid

Idk if its just a toy.
Most of the biggest websites are written in python.
YouTube/Dropbox and more.
Its just a tool, and edgelorde as yourself, who has never written anything in his life, claims out of the blue that its trash.
Fucking lol. Go finish atleast one of your projects, oh jk, it will end up being another abortion anyway.

because it's purrfect for something like web server shit I never used dat django though
too bad it's slow and will never make it

Attached: 1523249749496.jpg (210x210, 19K)

apparently the truth hurts
sorry, python is shit

__no__

>That isn't as limiting as you think.

This is something you're just inferring. All I stated was a fact.

Its logo is a swastika.

Google literally wrote a transpiler to convert Python codebases into Golang because they realized "Holy shit this language is slow as balls".

>Dropbox
blogs.dropbox.com/tech/2014/07/open-sourcing-our-go-libraries/

That's what documentation and comments are for. I bet you're the type that loves Ada because you believe safety supersedes freedom. Just because you *can* shoot yourself in the foot with it, doesn't mean you will. Especially if you're a competent programmer. I bet you hate void pointers too.

On the tabs part, I'll agree with you. Tabs are superior in the sense that they have adjustable space and no ambiguity. However, to python's defense, it's *only* a recommendation. It's not enforced.

Google also uses Perforce instead of Git.

Your argument is invalid.

this

I'm in academia in mech engineering, and it's EXTREMELY common in my field. Jow Forums needs to realize that the entire universe doesn't revolve around fields like CS and software engineering; there actually exist other real human beans out there.

Kubernetes is written in Go, so any cloud-native tooling naturally ends up written in Go as well.

It's because everyone use it.

if you use python for oop youre going to have a bad time

biggest websites are react and angular

>Why the fuck would anyone use this?
it's easy as piss
python makes it easy to actually do shit without much effort at all, and that's before you get into the wide variety of libraries
people on Jow Forums wank on about speed when they're mostly just doing shit to absurdly small data sets on recent, fast machines (where even a machine from twenty years ago would do it fast enough in python that you wouldn't care)

python exchanges more cpu time spent for less programmer time
write the bits that need to be really fast in another language

What’s wrong with perforce? Until very recently git didn’t even have a way to deal with large files. Now there is LFS but Perforce used to be the best for that

Javascript es6 is more portable with better syntax. Monty meme syntax is what kills python. Python only exists because of libraries

>All I stated was a fact
You're not wrong. I just think you're being implicating unfairly.

>you're being implicating unfairly

Again, that's all something you're inferring. It's in your head.

He was pointing out that the other guy said C and not C++ when discussing inheritance. C does not have inheritance unless you extend it.

>> Javascript.
>> Good.
No. Python is indeed shit, but it's still better than JS.

Python has interfaces. It's duck typed, so you just implement all the methods that the interface needs to support, there's no special syntax needed.

If you want to enforce that everything that inherits from a given class implements a given set of methods, you can use ABC.abc from the abstract base class library. Python's metaclasses are powerful enough to let you implement that kind of stuff yourself instead of needing the language to implement it for you.

Python's OO model is strictly more powerful than Java/C# style OO, at the expense of not being statically typed (and being slow as fuck due to not being designed for compilation).

The worst part about it imho is how python fields/variables work and how easy it is to assign to a misspelled variable or field and silently create a new one instead. It also means you have to read every method in a class and its superclasses to know what fields it might have. Also the syntax with significant whitespace where everything is a statement instead of an expression is annoying as fuck.

So I've been looking into trying to attempt to learn programming with Python. I decided to give this a read. Only, I didn't realize there were two versions. I've been reading from the Python 3 version. Apparently the author of these books makes a case against learning Python 3 if you're a beginner. Is there a difference between the two books that would necessitate me going with Python 2 instead, or should I just keeping going with Python 3?

Attached: showww.jpg (998x648, 215K)

Why does everyone else who also hates Python seem to hate it for utterly retarded reasons instead of the actually legitimate ones?

The advice to learn Python 2 is outdated at this point imho. It only has one year and 8 months before officially becoming unsupported.

>the author of these books makes a case against learning Python 3 if you're a beginner.
What are his stated reasons? It used to be that python2 was recommended to beginners because it was more ubiquitous, but nowadays many platforms are completely deprecating python2 and replacing it fully with python3. It's possible that the author's "case" is outdated at this point.

>Python's OO model is strictly more powerful than Java/C# style OO
That's just outright false.

>and how easy it is to assign to a misspelled variable or field and silently create a new one instead.

I fucking hate reading languages with this shit. Just by the shape of the code you can tell when variables are being instantiated in other languages but in python you have to keep track of every variable in each given scope to know what is happening.

>That's what documentation and comments are for.
And if everybody didn't think they had self-documenting code we'd live in a better world.
We don't. Python thinks syntax should make the language clear, but it only bothers with indentation. Almost every other language forces you to say up front what a function is gunna hand back and it what it expects. It's a retarded conflict of philosophy.
Also on the contrary, I love void pointers. Just not when I have to work on other peoples undocumented, unsafe, unclear code because "HAHA IT'S SO OBVIOUS RIGHT" until they look at it 2 years later and forget they even wrote it, and start bitching about "this dumbfuck".

It's a language, there's no reason to make everything that should be part of it instead be implicit and optionally documented. Golang does this pretty well in that everything everywhere is very explicitly typed. It fails in carrying the C tradition of "use as few characters for every variable possible" and poor generics-interface hack workarounds.

Javascript is fucking trash

>It's possible that the author's "case" is outdated at this point.

See that's why I'm worried. The page where he makes his case seems to be from a few years ago, so I'm not sure if its still applicable now that he's written a book about learning Python 3. Here's the page in question: learnpythonthehardway.org/book/nopython3.html

Java and C# don't have late binding or metaclasses. You can't implement a language feature such as enum classes or interfaces yourself. You can't write a proxy that forwards arbitrary message calls to other objects, like say a remote computer. You can't implement higher order messages. Etc etc.

Most pythonlets are admittedly too retarded to actually put those advanced features to good use, but Python and Ruby has much more powerful OO models than Java and C#.

python has awesome libraries.
list comprehension is pretty neat to, desu

>I'm not sure if its still applicable now
It's not. Use the python3 book

Either way, the differences between python 2 and 3 that you'll actually run into frequently are a small handful of easy to remember things. It's worth checking what they are whichever one you learn, in case you find yourself in an environment where only the other is available.

i just competed in the national cyber league over the weekend and about 80% of everything I needed to do was done in python, with the other 10% being assembly and javascript

just learn python3

>Java and C# don't have late binding
What the fuck am I reading?

Python for fun, Java for work. But it can be the other way around sometimes.

>Late binding
u wot
>Remote calls
What is RMI/RPC
>Can't implement enums/interfaces yourself
Again, u wot

I'm gunna need you to clarify on this before I disagree because otherwise it just sounds like you know absolutely nothing about Java/C#

>the differences between python 2 and 3 that you'll actually run into frequently are a small handful of easy to remember things
#python2
import urllib2
import urllib
response = urllib2.urlopen('python.org/').read()

response=urllib.request.urlopen('python.org/').read()
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'request'
[\code]
#python3
import urllib
import urllib2
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'urllib2'

response=urllib.request.urlopen('python.org/').read()
[\code]
i just dont get it

"Automate boring stuff with Python", read it and do the projects.

urllib2 is one of the things that changed. In python2, the module was just called urllib2. In python3, it was split into two modules, urllib2.request and urllib2.error. You should use from urllib2.request import urlopen and then use urlopen directly in your python3 script

>from urllib2.request import urlopen
Sorry, should befrom urllib.request import urlopen

The "2" was dropped in python3

#python2
import md5
md5.new("Nobody inspects the spammish repetition").hexdigest()

#python3
import hashlib
hashlib.md5("Another stupid Monty Python Reference").hexdigest()

>Why the fuck would anyone use this? Does it have any advantage over other object oriented languages besides being accessible to normies?
It has a lot of data analytics modules. Pyomo is absolutely amazing at hiding a good deal of the awfulness that is FOSS linear programming solvers.

Attached: 1418094585804.jpg (535x462, 34K)

No advantage but to keep people stupid.

Late binding in Java means something completely different and less useful than what it means to everyone else. In Java it's used incorrectly to refer to dynamic dispatch.

No, I do know what I am talking about. All of those features in Java/C# are hardwired into the language. In Python or Ruby you can implement them yourselves as libraries.

I'm not talking about *using* them. I'm talking about *implementing them*, i.e. the thing that someone writing a Java compiler would do.

- easy to get up and running
- prototyping is quick
- low technical overhead to maintain
- much like yaml for a configuration format, it's easy to read and understand from a glance
- lots of good libraries for any number of tasks
- std lib has a bunch of nice stuff packed in

Our ops dept uses it and Go. I've liked Python before I started here, but it's nice writing all of my team's tools in Python. We all know it to varying degrees and so it's easy to write something we all can use and contribute to.

> In Python or Ruby you can implement them yourselves as libraries.
Well, okay, yes, by nature of being interpreted and not compiled languages yes. But that's a feature of being interpreted, it doesnt really have anything to do with the language beyond that.
If you're speaking from a pure flexibility standpoint then I guess yes, Python/Ruby/LISP/SmallTalk/Haskell all share that level of flexibility at all the negative costs of being able to.
Whether or not there's actually a benefit to that is debatable.

>what is numba
kill yourself

I'm looking into it now. Thanks for the suggestion.

arent those frontend framworks?

>[\code]
>i just dont get it
It's clear that you don't get many things

def SieveOfEratosthenes(size):
array = [True] * size
for each in xrange(3,int(sqrt(size))+1,2):
if array[each]:
array[each*each::2*each]=[False]*((size-each*each-1)/(2*each)+1)
return [2] + [each for each in xrange(3,size,2) if array[each]]

You can actually have something like that in a statically typed compiled language as well if you have compile time evaluation.

In fact, Herb Sutter proposed adding metaclasses to C++ which is only slightly less powerful would let C++ do most of those things: open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0707r0.pdf

It has an experimental implementation as a Clang extension afaik.

trannies and bronies don't have enough IQ to handle real programming languages so they needed something for them.

Your sieve isn't even segmented. It's going to use at least a gigabyte of memory if you want to sieve all primes less than a billion.

Because its simple and straightforward. A simple interpreted language.
Meaning if you want to test an algorithm you can make and test it in seconds without having to worry about casting and types. Just throw it in an array and pull it out when you need it.

Python is so slow that changing to a fast language often gives a bigger payoff than going from a naive to a fast algorithm though.

>being accessible to normies?
in uni, normies who attempt to try learning any programming language end up quitting and suffer the rest of their years, regretting why did they take IT/CS courses. the world you are looking for is brainlets.

Library support. I'm doing work in machine learning and data science and Python has the best libraries for this. I'd rather not use it but unfortunately it's currently the best tool for the job.
But I also don't really understand the hate it gets. I prefer Ruby (as far as interpreted dynamic scripting languages go) and dislike the use of whitespace, but it's not miserable to use or anything.

>Shit performance with php
Lmao. No. Php is miles ahead of pyhton

Because so called programmers on youtube emphasize on learning python as a beginner's program and how it is great. Fucking dumbtards.

> face callback hell with node.js
wake up grandpa it's 2018

php is dead.

we are going to sent a spaceship to Mars completely written in Python. MARK MY WORDS

sure you understand that a spaceship it built from hardware, you cant make a spaceship written in python unless it is in a game

It is super quick to do simple shit with. If runtime is not a factor, you can save a lot of time coding with it. That is about it. In other words, if you are lazy, it is great.

>unrelevant thing

>it recommends spaces over tabs
That is an issue of standards, not the language. Also, take that reddit spacing you are using and shove it up your ass, soy boy nigger.

Attached: 3a7.jpg (680x680, 77K)

It's the official syntax standard as recommended by PIP8. The fact that people don't adhere to the syntax standards set forth by the designers in a *language that relies on whitespace syntax* is inherently problematic, you'd know that if you ever worked on other peoples codebases. People just fucking looooove mixing tabs and spaces willy nilly without having a strict formatting tool.

>Reddit spacing
>Between entire paragraphs
Begone, newfriend.

>implying you cannot use one of a million style managers
>switching back to correct ">[text]" instead of ">[space]"
Begone, reddit trash.

>that post makes sense

You're retarded if you don't understand why using style managers is just as bad as ignoring official whitespacing in a language that literally relies on the style to work correctly. You haven't fucking fixed the problem.
Also learn what reddit spacing is you dipshit, fucks sake.

This is reddit spacing.

Do you see the difference?

Between this?

And two paragraphs?

Or are you functionally retarded?

Not him, but I have to say: literal retard.

>Getting defensive over being called out for reddit spacing
It is only fucking april. How come the summer is here?

Attached: soy.png (173x42, 2K)

Lick my butthole

>summer
Has literally never been a thing. Moot even came out and posted average post rate differences and it came out to a statistical error.

>Lick my butthole
Dude, eat my boogers.

Only if I get to suck your dick after

t. Soy

Lick my soybean

No you.