I FUCKING HATE PYTHON

>I FUCKING HATE PYTHON
-Sup Forums

Ok and what have you programmed recently then?
>Fizzbuzz in esoteric language #231
>Hello world in rust but it didn't compile

Every time.

Other urls found in this thread:

udacity.com/course/intro-to-computer-science--cs101
twitter.com/NSFWRedditImage

How fast can I decently learn Python? I went to a job interview recently which desired "some programming language knowledge" and I claimed to know some Python even though I never learnt it past basic tutorials. They gave me a fizzbuzz task which I somehow solved and now they are offering me a job. I'm afraid my lack of Python knowledge will soon bite me in the ass

how can you solve a fizzbuzz problem with little to no knowledge of the language? I'm struggling to understand some of the fundamentals. Using codeacademy is alright but i'm seeking better teaching websites

You can learn python in a weekend. Practise opening files and parsing CSVs and you're good as gold. (For the business world)

I fucking hate python.

Wrote a utility program for fixing up some bad subtitles recently. Also a bot to solve a shitty Facebook game my friends were playing which initially had an nurses ui but then I just had it send clicks to my browser and read the screen for the game window. Both in python.

I ported a program that did a bunch of linear algebra on some points on a plane to approximate where a vanishing point they suggest would be from python to lua so I could use it as a script inside another program that loaded lua scripts.

I feel very strongly about the separation between expressions and statements which makes lambda expressions awkward to use. Also there's some weirdness that comes up occasionally where the time I expect variables to be assigned a value isn't always when it is assigned a value. When you mess it up it seems like all scoping rules were just thrown out the window but then I remember the issue and can fix it. The whitespace stuff is annoying, not a huge issue but just annoying. It's most annoying when pasting code into a REPL and there's a blank line in the middle of a function in your source file to space things out for readability. The REPL interprets the blank line as the end of a function because how else is it supposed to know when a function ends? Most recently I got to learn the hard way that python does not default to opening files as utf-8 which was a lot of fun to debug. It's 2017, even html is pushing for utf-8 everywhere.

GIL isn't even an issue and most complaints about it should be taken with a grain of salt.

xd
codecademy and LPTHW both suck. Try Automate the Boring Stuff With Python.

Currently learning python.
kys

An example if weirdness in scoping/binding
foo = "what is scope"
for foo in range(5):
pass

print(foo)
I don't know about you but I expect that to print "what is scope". Instead it prints 4. I get why it does that but it still feels really wrong.

Another example:
add_fns = []
for i in range(5):
def add_i(n): return i +n
add_fns.append(add_i)
Likewise instead of add_fns[0] being a function that adds 0 to its argument, add_fns[3] being a function that adds 3, etc, add_fns is a list of five functions that all add 4 to their argument. Again, it makes sense if you really understand how python handles binding names to values and scope but I don't think python made the right choice.

Also 0, "", [], and {} being falsey sucks a lot in my opinion. Especially in a dynamic, strongly typed language.

>tfw passion is programming language design
>tfw nobody to discuss it with
>tfw no jobs I can realistically land doing it

Do this course: udacity.com/course/intro-to-computer-science--cs101

Very fast and challenging. it will teach you pretty much everything you need in a very short amount of time.

Code academy is trash and won't teach you anything about programming. Only Syntax

What?

You have a problem with Python because when you redefine variables it redefines a variable? And that when you access a variable it uses its last given value?

The only thing I hate about Python is the class system, everything else is just kind of pedantry.

What's wrong with the class system?

nobody cares about programming language. Just make it werk fast and stable

Damn, I love the class system. Metaclasses and multiple inheritance are so powerful (although it has its pitfalls)

Block scope is a very natural way to handle scoping and python is subtly not block scope. I would expect the for loop to have its own separate variable shadowing the one that's scoped outside it only for the duration of the loop.
And my issue in the second example is that the i inside the functions doesn't even get bound until when the function is run. Essentially it means I need to be more explicit than I'd like to be dealing with closures.

>every method needs self
>implementing a built in requires double underscores (__init__, __equals__, etc)
>no private variables, you just have to mark them with an underscore and hope no one uses them
>no member variables can be declared outside of a function, so you have to do it in unit or when you need it

That's just off the top of my head, I'm sure there are more but at the end of the day it's not a deal breaker.

unironically
what are some advantages to using pythong over c++ for machine learning and the ilk?

>every method needs self
IDE does this, but yes it sucks.
>implementing a built in requires double underscores (__init__, __equals__, etc)
I would argue that it is neater than, say, c++
Overload multiplication
MyClass operator* (float x, const MyClass& y)
{
//...
}

>no private variables, you just have to mark them with an underscore and hope no one uses them
Well there are private variables but they're acessible if you really want to get them. (Who are you trying to keep out?)
class Jews:
__niggers = 7

print(__niggers)
AttributeError: 'Jews' object has no attribute '__nigger'

>no member variables can be declared outside of a function, so you have to do it in unit or when you need it
Yes and no. Using our example above you can always do setattr(My_Class, "Jews", "Did 9/11")
If you need to extend a class elsewhere you're probably better isolating it to a single py file or using inheritance anyway.

I don't know man, most languages will overwrite a declared variable if you use it as the counter in a for loop.

int i = 2;
for(i; i < 5; i++) {
continue;
}
printf("%i", i);


I would expect that to print 4. I can see how dynamic typing could be a gotcha in that scenario (i.e. i was a string)

And to your other point, I guess that's just a matter of view. Personally I would assume no variables get dereferenced until the actual call to the function (lazy evaluation, I think is what that is). Until then it's just a location where to find that variable, no matter the value.

It's easier to write, you can quickly throw together some Python scripts that handle the computational heavy lifting by offloading it to another library written in a proper language.

Because the heavy lifting is already done in c++. With python you can write code a trillion times faster without having to worry about 'programmer' issues like memory management or compiling times. Also python has an awesome package manager so you can import great libraries like pandas etc to make your life easier.

so whats the advantage? sounds to me that python really only is good in this context for prototyping
i doubt its really that much faster to write than C++ if you know what your doing

>neater than c++
The idea is good, but using double underscores for everything is burdensome. Why do they have to be trailing too? Or even a 4 character identifier? Why not just steal like ~ or * for your purposes.

>Private vars
I mean, regardless of whether I want people out or in, I feel like there should be more scope control. It seems like an afterthought.

>setattr
I was talking more about declaration in the class definition. Moreso to avoid long ass init functions.

Have you ever tried to write a serious project in c++? Long compile times, poor STD library, every file needs a h file, architecture considerations etc. I would argue that it is too low level for the people who need to build things. But if you were a god-tier c++ programmer I don't see why not

Agreed except on the following point
>setattr
>I was talking more about declaration in the class definition. Moreso to avoid long ass init functions.

If you *really* want to write your python like other languages then there are hacks
def __init__(self, [whatever]...):
for k, v in locals():
self[k] = v

i've recently started what i expect to be a decently sized c++ project, thats why im asking
you dont have to and shouldnt compile everything each time, keep the object files your compiler outputs, its basically the reason for the linker
can you reduce the memory footprint of a python program to be comparable to a c++ program? how do they differ in speed when doing a large amount of calculations? how is the cuda support?