Gains 10x productivity

>gains 10x productivity
why are you still declaring array lengths, importing libraries for strings, and declaring pointers in 2018?

Other urls found in this thread:

morepypy.blogspot.hr/2018/01/leysin-winter-sprint-17-24-march-2018.html
github.com/dropbox/pyannotate
twitter.com/NSFWRedditVideo

>not being able to leverage the power of macros in 2018
do yourself a favor and learn you a common lisp

Why is there perpetually a thread about Python on Sup Forums?

Yeah, at some point the 2/3 split was bad.
Yeah, you can literally just "import solution".
Yeah, it's slow.
Yeah, it's fast enough.
Yeah, the scientific stack is pretty damn good.
Yeah, multithreading sucks.
Yeah, Guido is kinda retarded sometimes.
Yeah, if you're retarded and you literally never used Python you are probably going to complain about fucking whitespace as if it makes a fucking difference.

Python's implementation of bytes and bytearray don't get enough hate t b h

I work enterprise. Anything else I'll just use Lua. Python is obsolete.

But you just described Java without the multithreading.

Can't read Borland .dlls.

Why is Python 2 backward compatible with Python 1, but Python 3 isn't backward compatible with Python 2?

Lua and Python's domains don't overlap significantly

Productivity means shit when what you produce is crap, user.

>Multithreading sucks

It's current year, cpus have a million cores unlike 10 years ago. Just use multiprocessing

]
> Relevant python software still needs to be written mostly in C

So I wrote this kind of mathematical algorithm implementation (some CART variant), and i think it could be faster

Could someone suggest Python tools for function/memory profiling so that I can try and find out where there is still more room for optimization?

>global interpreter lock
Fucking with concurrency since 1991

How so? I've never seen any problems with them even after using them.

#define kv_roundup32(x) (--(x), (x)|=(x), (x)|=(x), (x)|=(x), (x)|=(x), (x)|=(x), ++(x))

#define kvec_t(type) struct { size_t n, m; type *a; }
#define kv_init(v) ((v).n = (v).m = 0, (v).a = 0)
#define kv_destroy(v) free((v).a)
#define kv_A(v, i) ((v).a[(i)])
#define kv_pop(v) ((v).a[--(v).n])
#define kv_size(v) ((v).n)
#define kv_max(v) ((v).m)

#define kv_resize(type, v, s) ((v).m = (s), (v).a = (type*)realloc((v).a, sizeof(type) * (v).m))

#define kv_push(type, v, x) do { \
if ((v).n == (v).m) { \
(v).m = (v).m? (v).m

Python was never meant to be doing what it's doing these days with web applications and scientific computing and so on.

Holy fuck people don't understand concurrent programming

C/C++ is meant to make fast programs.
Python is meant to make programs fast.

And at any given point, you will need both of those.

>as if it makes a difference
I think people blame more issues on whitespace significance than whitespace significance deserves.
Python is designed to force you to program the way Guido wants you to.

/thread

>productivity
but its slow af

Yes.
But there are situations where your code will run for 2 seconds and then exit.
If your python version takes 10 seconds, but you take just half hour to code it instead of two hours, you got quite a net time gain.

lua is only justifiable for console games

>Yeah, the scientific stack is pretty damn good.
Actually, it's not. It's full of global opaque state.

>there is just crappy system programming languages and crappy scripting languages and we need to combine them
what a pittyful waste of trips

>why are you still declaring array lengths, importing libraries for strings, and declaring pointers
It's not a negative thing to have control over these things. In fact there are use cases where it is not only necessary to, but will make for a more efficient program.

Python programmers don't seem to care about algorithm performance or how long it takes their program to run, they only care how much time they spend programming.

For example? Any better alternatives?

>gains 10x productivity
yeah, just try writing anything more than 2k lines of code in a language without static typing

>how long it takes their program to run, they only care how much time they spend programming
It's almost as if they care about how long it takes them to solve a problem.

pypy is fast and nobody uses it

The python shilling needs to stop.

I use it.
9 out of 10 times it's a drop in replacement.

They are planning to improve support for the scientific stack in an upcoming sprint morepypy.blogspot.hr/2018/01/leysin-winter-sprint-17-24-march-2018.html

Are you retarded

Precisely. They only care about slapping together a half-assed solution rather than implementing a fast and efficient program.

hilariously enough, it's a matter of time until you have to fall back to C
matplotlib
Not that I know, but I don't care, because thanks fuck I'm not doing "scientific" computing.
7x - 8x faster than CPython isn't remotely fast.
PyPy is just another proof that JIT compilers can't fix sloppy language design
actually, it's not even justifiable there
/thread

>matplotlib
Use a better library like bokeh.

>7x - 8x faster than CPython isn't remotely fast.
But up to 50 times faster than CPython is.

>PyPy is just another proof that JIT compilers can't fix sloppy language design
PyPy is surprisingly good considering that it started as a research experiment and is not backed by a single company aside from an occasional donation.

Nobody cares if you spend a week to rewrite a Python program that runs once per minute in C++ and it runs in 0.05 seconds instead of 1 second.

>50x
PyPy (as most tracing JIT compilers) is only that fast in cherry picked cases that are trivial to trace and optimize. Like muh number based benchmark.
That said, yes, they did amazing work. Imagine it went into something worthwile.

>use something better like X
I won't, because thanks fuck I'm almost out of the faggotry called scientific computing.
There are other really shitty scientific libraries without a better counterpart, but naming those posesses a small chance of doxing me.
At the end of the day Julia is next in line; and while it is faster it seems to be also broken from an engineers perspective.

>Like muh number based benchmark
which is a big deal because that's what cpython has trouble with, i thought python was crap until node came along and realized it could get so much worse

>which is a big deal because that's what cpython has trouble with
Actually, that's only a symptom of a handful of problems and a general lack of direction.

That said, yes, node people should have lacked direction instead of poisoning the world with their garbage.

dems sum real big uns

>Imagine it went into something worthwile
This is worthwhile. They proved that you can automatically create a reasonably fast JIT from the same code you use for the interpreter.
Rust folks are working on a similar project called HolyJIT. Writing JITs manually is very easy to get wrong and they are hard to maintain.

>There are other really shitty scientific libraries without a better counterpart
The reality is that programming requires you to constantly juggle with shit.
I'm sure there's plenty of shitty libraries out there but that doesn't change the fact that Python is your best option if you're doing that kind of stuff.

>This is worthwhile. They proved that you can automatically create a reasonably fast JIT from the same code you use for the interpreter.
>Rust folks are working on a similar project called HolyJIT. Writing JITs manually is very easy to get wrong and they are hard to maintain.
The trick is to not requiring a JIT compiler because you did your math on language semantics before.

>The reality is that programming requires you to constantly juggle with shit.
True, just not with projects that are clearly a bunch of bachelor theses implementation.
>I'm sure there's plenty of shitty libraries out there but that doesn't change the fact that Python is your best option if you're doing that kind of stuff.
True but that's not a compliment.

No but you sound retarded.

>dynamic languages
Gross

>The trick is to not requiring a JIT compiler because you did your math on language semantics before.
Compiled languages aren't as flexible. At least not as easily. Creating a class at runtime is something you might want to do at some point.
Sure you can get the same result in a compiled language but it's much more cumbersome.

>True but that's not a compliment.
When everything is shit, being the least shit is a compliment.

The Virgin "Pythonic" Solution
class User(object):
def __init__(self, id, name):
self.id = id
self.name = name

def __str__(self):
return "{0}-{1}".format(self.id, self.name)

users = [
User(0,"Hero"),
User(1,"Dunn"),
User(2,"Sue"),
User(3,"Chi"),
User(4,"Thor"),
User(5,"Clive"),
User(6,"Hicks"),
User(7,"Devin"),
User(8,"Kate"),
User(9,"Klein"),
]

friendships = [
(0,1),
(0,2),
(1,2),
(1,3),
(2,3),
(3,4),
(4,5),
(5,6),
(5,7),
(6,8),
(7,8),
(8,9)
]

def user_for_id(user_id):
for user in users:
if user.id == user_id:
return user



def friends_of(user):
for friendship in friendships:
if friendship[0] == user.id or friendship[1] == user.id:
for other_user_id in friendship:
if other_user_id != user.id:
yield user_for_id(other_user_id)

def mutual_friends_of(user, otherUser):
for friend in friends_of(user):
for other_friend in friends_of(otherUser):
if (friend.id == other_friend.id):
yield friend

The Chad Kotlin Solution
fun main(args: Array) {

data class User(val id: Int, val name: String)

val users = listOf(
User(0,"Hero"),
User(1, "Dunn"),
User(2, "Sue"),
User(3, "Chi"),
User(4, "Thor"),
User(5, "Clive"),
User(6, "Hicks"),
User(7, "Devin"),
User(8, "Kate"),
User(9, "Klein")
)


val friendships = listOf(
0 to 1, 0 to 2, 1 to 2, 1 to 3, 2 to 3, 3 to 4,
4 to 5, 5 to 6, 5 to 7, 6 to 8, 7 to 8, 8 to 9
)

fun userForId(id: Int) = users.asSequence().filter { it.id == id }.first()

fun friendsOf(user: User) = friendships.asSequence()
.filter { it.first == user.id || it.second == user.id }
.flatMap { sequenceOf(it.first,it.second) }
.filter { it != user.id }
.map { userForId(it) }

fun mutualFriendsOf(user: User, otherUser: User) = friendsOf(user).flatMap { friend ->
friendsOf(otherUser).filter { otherFriend -> otherFriend.id == friend.id }
}

mutualFriendsOf(users[0],users[3]).forEach { println(it) }
}

>Creating a class at runtime is something you might want to do at some point.
If you are mentally ill. Sane people use proper compile time meta programming and proper native plugin systems instead.
In fact, the more static software is, the better.
For example, for 13 yr old edgy kids homoiconic systems may sound all great and powerful, in reality they invite security flaws, loss of performance and general buggyness.

>When everything is shit, being the least shit is a compliment.
When discussing Python libraries, it's more like the only shit of its kind in existence.

>Computers are so good I don't need to optimize
You are the cancer that is killing the industry.

>people use proper compile time meta programming and proper native plugin systems instead
As I said, more cumbersome.

>the more static software is, the better.
I agree.

>When discussing Python libraries, it's more like the only shit of its kind in existence.
There is no alternative to Python's scientific stack.

don't want to be __that__ guy. but even though Go has types they use linting. Python with pep8 or pylint linting works great.

>When discussing Python libraries, it's more like the only shit of its kind in existence.
Have you seen npm?

Don't blame the sheeple, blame the tards that created and pushed this languages. They baited all the "wanna-be" hackers and programmers. These non-techs don't know what GIL is.

>As I said, more cumbersome.
>prefering monkeypatching to proper programming
Ok. Technically, proper programming is the better solution and less cumbersome for the users.

>There is no alternative to Python's scientific stack.
That's my point. So it's not a compliment. If the only scientific stack is smeared with shit, the world would be better off without it, so at least there is hope for someone to write a good one instead.

Preposter meant the scientific computing libraries of Python, not all libraries.

>ITT: mathlets who could barely scrape by precalc and introduction to probability complain about scientific computing and libraries they've never used
wew lad

> produces crap
> blames the language

Creating a class at runtime is not monkeypatching any more than loading a dll is.
I'm glad we both agree that Python's scientific stack is the best in the world.

>I'm glad we both agree that Python's scientific stack is the best in the world.
this but unironically

>defining vertices and edges separately
>not via Name->Name adjacency list
it's like you want your data entry to be error prone
>needing to resort to explicit int ids
pfft

>Creating a class at runtime is not monkeypatching any more than loading a dll is.
Most of the time, it is, because loading a dll requires a properly defined interface, whereas creating a class doesn't necessarily.
>c.f. Minecraft mods

>you are probably going to complain about fucking whitespace as if it makes a fucking difference.

>working on group project in Python
>all members have different ways of indentation
>shit gets fucked up

It's a limited comparison, the Python code doesn't even use classes.

bitch pls i've taken calc 1 like 5 times

>working on group project in Python
>all members have different ways of indentation
There are standards for this. Try configuring the repository to reject code that violates them.

>actual mathematics
>not using Wolfram language exclusively

*locks interpreter globally*

this was a cuck uni project but that is good idea

shit pissed me off

The Chad Python 3.7 Solution

from itertools import chain

@dataclass
class User:
id: int
name: str

users = list(map(lambda x: User(*x),
enumerate(["Hero", "Dunn", "Sue", "Chi", "Thor", "Clive", "Hicks", "Devin", "Kate", "Klein"])
))

friendships = [(0,1), (0,2), (1,2), (1,3), (2,3), (3,4), (4,5), (5,6), (5,7), (6,8), (7,8), (8,9)]

def user_for_id(user_id):
return next(u for u in users if u.id == user_id)

def friends_of(user):
return (user_for_id(i) for i in chain(*(f for f in friendships if user.id in f)) if user.id != i)

def mutual_friends_of(user, otherUser):
return (u for u in friends_of(user) if u in friends_of(otherUser))

Huh, didn't know 3.7 could do that.

Try using unicode. It's hell.

>dataclass

huh I wonder why no other language supports such an elegant way to implement a data structure.

Kotlin does.

kotlin, scala, haskal, frogcaml, etc
ayy, jvmlang bro!

what are structs faggets?

the unicode situation is fine in 3.x

A byte array and an array of bytes are two incompatible types.

Structs (and tuples) typically lack additional functionality. In Kotlin, I can call stuff like .hashCode, .equals, .copy, .toString et cetera.

There are alot of situations where execution speed is not your main bottleneck also one time use scripts for setting up an enviroment or testing hardware. Give me a data sheet and I can write you a library to communicate with just about anything in an hour an a half. And since com speed is your main bottle neck python is the right choice.

And then the software engineer has to recode your script in Java because it's not production ready.

that's correct, python is for prototyping

Is dropbox production ready?

dropbox fell for the go meme

Exactly. It takes a bit of trial and error for things like start up procedures, PID tuning, parsing unknown outputs, etc. Not to mention the data sheet is almost never right. And when I'm crammed in the bottom of some plane or other vehicle trying to figure that sort of thing out I prefer to be down there as short a time as possible.

>Use objectively shit tools
>Be so shit you don't even realize how shit your tools are
>Think it's a case of PEBKAC when people point towards shit results produced with the tools you use

Their frontend is almost entirely Python.
They are a big contributor to mypy and they recently released github.com/dropbox/pyannotate

> wasted time learning old, shitty programming languages
> have to vigorously and futilely defend them online despite so called "shit" languages taking up more and more industry space
> be obsolete

import collection.{mutable => m}

val in = """Hero - Dunn
|Hero - Sue
|Dunn - Sue
|Dunn - Chi
|Sue - Chi
|Chi - Thor
|Thor - Clive
|Clive - Hicks
|Clive - Devin
|Hicks - Kate
|Devin - Kate
|Kate - Klein""".stripMargin

val u2u = in.lines.map{_.split(" - ")}.toArray
val users = u2u.flatten.toSet

val peers = users.map{_ -> m.Set.empty[String]}.toMap
for (Array(a, b)

i know bra i see those PyQt5 libraries and like dropbox, prototyping language isn't an insult

The absolute state of python

Ruby is my favorite language, convince me to switch to Python anons.

because python 3 made several fundamental changes to base functionality. raw_input() turned into input() for instance.

ecosystem, depending on the type of projects you're working on
perf

Not possible.
Ruby is the antithesis of pretty much every idea in The Zen of Python.

There is no argument, unless you felt for the science meme.
Ruby is minimally less shitty, so that's it.

ruby is a dead language for trannies

look up generators and start using them. Also, look up 'itertools'.

>being too lazy or stupid to do these small tasks for performance gains
>claiming you gain 10x productivity from something as simple as not giving a size to an array

but the tech "journalists" told me it was the den of misogynist brogrammers, who am I to beleeeb :O Ɑ===8

>ecosystem
I found Python's library support awkward at best, pip is shitty compared to gem/bundler (not that gem is great). Numpy is useful I suppose, but I don't do math/science heavy things.

>perf
Aren't they both pretty close since they are both interpreted languages?

great argument