If python compiled to machine code like c/++ you would use it

If python compiled to machine code like c/++ you would use it.

Truth

Other urls found in this thread:

docs.python.org/3/extending/embedding.html
docs.python.org/3/library/typing.html
security.coverity.com/blog/2014/Nov/understanding-python-bytecode.html
twitter.com/AnonBabble

No. Because even weak type checking is vastly superior to dynamic type checking.

Python devs still too fucking lazy to drop Python2.

Yeah no thanks.

>python with curlies instead of indentation

does this exist?

Ruby?

it does compile to machine code

I already use OCaml. It's more expressive than Python, compiled and fast.

strong type checking is shit though

right now most real world applications use python2 so i couldn't care less about 3 and switching to it. also pypy is faster and will kill cpython eventually, then we will drop guido

Python team says "Python 3 and 4 are the future"

> b-but muh Python 2 just works

Yeah you made the point.

nobody cares about python team since they screwed up transition from 2 to 3. also guido merged that retarded tau commit, so fuck python team.

>b-but muh Python 2 just works
you misunderstood. only python 2 works, python3 _doesn't exist_ in infrastructure i use, so i can't use it if i wanted too. atm python3 is used mostly by bored virgin software enthusiasts who have nothing else to do. we ll see if anything changes in 2020. meanwhile i have important stuff to skill up on and python3 is not important stuff.

At least the ruby and perl devs know what they are doing.

Golang is basically C if it were as simple as python.

The language you're describing is golang.

Golang

>nobody cares about python team since they screwed up transition from 2 to 3

Nobody cares about the python team since they haven't cared about consistency even long before python 3
>"Let's create an update to the language that fixes all the inconsistencies!"
>the "fix" (python 3) becomes by far the largest inconsistency to ever hit the language

I love Go, but this is completely incorrect. Ruby was the correct answer.

>"how about a switch statement?"
>"rejected, syntax would look confusing, just continue using if then else sequences"

...

This kind of shit from python devs just makes me want to chimp the fuck out. They don't even have naming conventions for their own standard library's *modules* (much less functions).

The python codebase is consistently polluted by beginners who learn the bare minimum to cobble together something that almost-works and then proceed to publish their code.

Ruby has every language feature to have been conceived, yet looks less confusing than python (not having 6 levels of 4-space indentions helps, too).

Still, the language devs allow decorators and ternary expressions but not switch statements

It does compile to machine code, you fucking moron. The issue is that even with a compiler, it's still slow as shit compared to it's alternatives because of the way the language is designed.

You could probably implement your own preprocessor for that pretty easily. Remove whitespace, convert { to : and then use an iterator to manage indentation levels.
The simple fact of the matter is that nobody who uses Python likes {} so it'd be useless to anyone.

I was not trying to insult you, user. But the thing is that this whole Python 2/3 scenario is pretty messed up.

I'm also not saying that you are wrong, but by now wouldn't it be the right choice to just ditch Python3?

Right now, ditching python 2 would probably be the right choice, as it has been for years. Chances are you aren't using any library whatsoever that need python 3 (as that would imply they aren't maintained).

Or just use a real man's language like ! I guarantee you'll get better long-term benefits out of the intellectual masturbation that is writing all of your programs in the form of formal proof logic!

No because for the small scripts and prototypes I use Python for it doesn't matter.
And for actual projects I want a language with static typing.

yes that's why nim is so popular

Anyone in science is basically forced to use python 2 just because of all the libraries. So there is that.

>Python doesn't have do{}while{} and probably never will

>If cpython compiled to machine code like c/++ you would use it.
FTFY. In the parallel universe where that happens Python would probably have suitable semantics, so it's plausible.

who gives a shit?
give me a real "for" instead

you mean while loops? i googled do while and it looks exactly the same as a while loop.
you just do
var=1
while var:
#do something
if (condition):
var=0

It's the same as a while loop but the syntax is nicer. It cleans up the variable you used to check the condition.

Also, in some cases the thing you're doing in the while loop doesn't exist until after you've started the loop, so if your while loop checks the conditions at the start of the loop you'll get an error. The way around this is to manually write the first iteration outside the loop, but then you're duplicating code.

Just in case you're serious: a do-while loop will always be executed at least once. So the proper equivalent would be:
do:
# Do something
while condition

# Would be equivalent to
# Do something
while (condition:
# Do something

Cython?

a clunky hack

Still better than nothing.

true, i guess

it would still be nice if it was cleaner, though

I wish Guido would have called this guy out.
>boo hoo hoo, your language is not a Lisp, so I'm going to be passive aggressive and mail you a book as a "gift".
Autistic jerk.

sup guido

good point, nearly nobody uses that

list = 1
Just broke python!!!

>weak typing
>whitespace syntax
No.

No. Even if it did that, it would still be dynamically typed language, so every operation would still be slow as fuck as the runtime needs to keep a huge memory overhead for every object (or primitive) and it would still need expensive runtime checks before performing any operations.

[citation needed]

common knowledge
Why do you think HipHop compiler was cancelled for HHVM, Cython requires jumping through hoops for performance and some Lua LLVM frontends didn't perform that good?

[citation needed]

>being delusional

What do you mean? Just look at the way the language is implemented.

In C++ for example, when you have something like
int a = 5;
int b = 6;
int c = a + b;

Then the compiler will just know "Okay, adding 2 32 bit numbers together. I'll use 2 32 bit registers and call the processor architectures add instruction".

In python, there can be no such thing. Maybe in some very trivial example where the type is obvious because it is only ever assigned one constant value and the value is only used in one scope, but in all realistic cases, instead of just using 2 32 bit values in registers or on the stack, a Python object struct must be allocated to hold all kinds of information about the value in additon to the 64 bits (no 32 bit ints in Python) for each variable.

And when encountering a "+", it can't just say "yeah, I'll just use the add instruction". It can't know which one to use. After all, what if one of the values is a string? Or some custom object? It needs to "call" a "RuntimePlus" function which needs to look at the python object to figure out what kind of object it is and what the plus operator actually does for it. After having found that out (Either by looking in some hashmap or a series of ifs) it can finally use the correct "add" instruction. And this needs to happen for everything you do in Python and this is what makes it orders of magnitude slower.

This is the price you pay for comfortability. C is fast because developers need to keep track of the types throughout the program. C++ is fast because the complicated type system was designed to be able to track types throughout the program in nearly every sitation. Python is slow because this stuff is done at Runtime.

>Python and this is what makes it orders of magnitude slower.
That's not even the worst part. The other half has to do with preallocations and mutability of classes.

(let* ((a 5)
(b 6)
(c (+ a b)))
(declare (integer a b c)))

Why would preallocations make it slower? Isn't that a perf for increased memory usage tradeoff?

That's right, even some meme languages are faster than Python when it matters.

What is that? Lisp?

*impossible preallocations

Yes, Common Lisp.

Pretty cool. But how does it deal with more complex situations, like when these numbers come from a container? Do you need to manually keep track of their type or does the language allow you to say that the container only contains ints?

why even? you will end indenting the code anyways and more than two levels of indent is likely symptom of bad code

no, why would anyone copy the exact mediocre semantics for another syntax
That said, it's possible, there are other languages targeting cPython bytecode.

b = 1337
try:
b = 1 / 0
except ZeroDivisionError:
pass
print b

Yeah, it's a fun ``meme" language to play around in. With regard to your question, and off the top of my head, I think you can do this with the CONS (aka list) type. I believe you can get finer control with vectors though.

Examples:
;just negative integers
(lambda (x)
(declare (type (integer * -1) x))
x)
---
(defun five-vector (v)
(declare (type (vector integer 5) v))
v)

>more than two levels of indent is likely symptom of bad code
found the webdev

if for webdev you reffer to those who learned algorithms yes, else fuck you

So I can't have any control structures inside a method?

is it wrong of me that i like python/

like, a lot

thinking about this, yes, python is shit: why the method definition would be inside the class definition?

>Would you use it
No.

And I'm sure this has already been mentioned, but you c𝑎n compile Python code, because you can embed in a C program, then compile that C program like any other.
docs.python.org/3/extending/embedding.html

Because it makes sense?
What OOP language other than C++ doesn't do that?

It has recursion, everything else can be implemented.
Functional programming ftw.

because it's part of the class retard

>he defines his methods inside his classes

Studying CS now and have a job on the side where I write python, I'm kinda worrying I won't be able to get a non-python job later just because I'm so used to easy-mode python. Is my worry justified?

Since when goes Ruby have curly brackets for syntax?

I don't know if any other language does that, but don't seem necessary to put a definition (which is not a declaration) inside the class. It's just the language that doesn't allow this. Maybe it's redundant, but I like how in C++ I can watch a class in a header file and have an overall view about what it does.

>(You)

they've always been an option, but no one writes ruby like that because why would they

yes, blank spaces are stupid

yes, like in haskell
those academics sure are dumb

> ((( )))

To be fair, Haskell lets to bypass this behavior.

>blankspacesarestupid

Python 3.6 introduced optional type annotations,
allowing for more efficient compilers
from typing import List
Vector = List[float]

def scale(scalar: float, vector: Vector) -> Vector:
return [scalar * num for num in vector]

docs.python.org/3/library/typing.html

Can those types depend on values?

No, use Haskell and cash that $300k/yr paycheck

Best way to compile python 3? Pyinstaller, cython?

Is ruby as easy as python?

only if you are lgbt

>allowing for more efficient compilers
Not gonna happen.
pypy people have said that annotations provide next to no useful information they couldn't obtain otherwise

I do look forward to a world where all python libraries have annotated public interfaces though.
The shittiest thing about python is the lack of proper code completion.

if you don't like it then dont use it.

why do autismos get so butthurt?

Python "compiles" to byte code which is interpreted. security.coverity.com/blog/2014/Nov/understanding-python-bytecode.html

Meaningful whitespace is cancer. Dynamic typing is cancer. no I would not use python.

I agree I hate required formatting.
It's not bad to write with, but it can make modifying code an absolute nightmare.
It seems like a completely unnecessary requirement too that serves literally no purpose.
People indent automatically anyway.

Even compiled to machine code, it would still have a number of performance problems from being a dynamic language. A simple expression like a + b requires a type check on both a and b, as you have no idea if you are adding two integers together, or two objects together.

Ruby does not allow curly braces for the majority of things. You can use it in blocks, and they are used to denote hash tables, and that's basically it. For module definitions, class definitions, method definitions, if/else statements, case statements, loops, etc... you're using a matching keyword end, as opposed to indentation. Using braces is not actually an alternative.

Honestly I would not.

I am a C programmer. First language that I ever learned followed by thumb2/asm. I am very good at programming realtime applications and tend to take DSP work the most.

My python skills are that of an autistic quadriplegic gorilla during mating season. I've actually tried to learn it too, but the language makes no sense to me.

I like that you have to do everything in C, where in Python you write two lines for a complex program but have no idea how it ACTUALLY works. I like that I have to declare my variables and give them a type so that I know what variables I've used and their scope at a glance. Hell, I use strict in perl even for the simplest scripts just to make sure everything is neat.

Does this make any sense? Anyone agree?

I agree completely. C is for monkeys :^)

No it doesn't make sense at all.
I use both python and C for two entirely different purposes.
I don't need to know how angular momentum works to ride a bike to work.

What's wrong with tau commit? It's just one more constant that some people prefer, what's the problem?

What's the best programming language?

See:

>Meaningful whitespace is cancer.
Why though?
I format my C and C++ just as meticulously anyway. Bad formatting aggravates me, no matter what language.

I use it anyway faget.

Sure if you are pajeet.

>tfw learning python3 instead of python2
Did I fuck up? Should I upgrade to 2?

Nah, I'd rather use crystal or one of the lisps that compile to native. I'd rather be able to compile javascript than python desu.