[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Python hate thread? Python hate thread.
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 68
Thread images: 6
File: pythonsucks.jpg (71 KB, 400x400) Image search: [Google]
pythonsucks.jpg
71 KB, 400x400
Python hate thread? Python hate thread.
>>
I like Python
>>
>>53672381
bump. Learning it now, and if I can be properly dissuaded I'll go for something else. I'm looking at SQL and C++.

My background is I'm coming from R and want to get into a language that does things other than statistics. Also I'm working on writing a text-based adventure game as an R function, for laughs and to build control flow skills. But I want to learn a language that can be used to build totally new things rather than just interpret data.

I think I should to learn a high level language before getting into deeper stuff.
>>
python is disgusting
>>
>>53672381

I enjoy python. First language to make video games with. Why else would I need more?
>>
>>53672632
Because it's retardedly slow? For most small things it doesn't matter but if you're doing anything mildly intensive Python will make it eat your computer alive. Or, one core of it anyway. Python's still retarded enough to have the GIL. Just give up and learn rust already.
>>
eh, it's not terrible. I just intensely dislike whitespace. It's such a pain in the ass to handle in the IDE and when working with multiple people.
>>
>>53672381
I kinda like Python.
Python lambdas are horrible, of course, but these problems don't come up that often.
Also, using frameworks for larger projects sucks due to dynamic and interpreted nature of the language - I would really love to catch those bugs at compile time.

But python is near ideal for trying out algorithms, small scripting, even some machine learning programs. The hate on python is irrational. It's not that bad of a language in general. It's syntax and semantics are quite pleasant, especially python 3.
>>
>>53673450
Oh, and I never understood why people have problem with whitespace? Could someone try to explain? I've always found it to be more convenient than braces.
>>
>>53672528
SQL is not a programming language.
C++ is painful to use, but useful if you use R since they can be integrated. Python is a fine choice (but I personally don't like it).
I would also suggest looking into OCaml, Haskell or Clojure. Learning a function language can be very useful even if you never needed. It might also boost your R skills, since R is pretty good for writing in a functional style.
>>
>>53673468
It's pretty fucking stupid if you want to quickly type a function in the repl. Also I prefer some kind of delimiter at the end of block.
>>
It can be so ambigious + its scoping rules lel
>>
>>53673591
What about it's scoping rules? I'm genuinely interested because I don't know python.
>>
>>53673559
Can't you keep track of your indents when typing in repl? If you have so many indents to track, shouldn't you be typing in a notepad instead?
>>
>>53673609
No, but it's much easier to use braces and semicolons and write things in a single line.
>>
>>53673559
Huh, I've never thought about that, but I guess you are right, whitespace really does suck for repl.
>>
>>53673602
i = 10

def shitty_meme_lang():
i = 5

print(i)
shitty_meme_lang()
print(i)
>>
>>53673991
>hurr durr I don't understand lexical scoping
>>
>>53673999
Of course I fucking understand lexical scoping. It's just that the assignment syntax is literally exactly the same as the declaration syntax. Any sensible language would assign 10 to the global 'i'.
>>
>>53673468
my main issue is that nobody can agree on tabs vs spaces.

and by "agree" I mean use tabs because they're better
>>
>>53674052
Yeah tabs are superior.

Config your editor to interpret tabs for whatever number of spaces you want and boom.

Enforcing spaces is stupidly retarded.
>>
>>53673991
>>53674044
I would expect this to print ‘10’ followed by ‘5’.

If python actually prints 10 twice, then I just lost all shred of respect I didn't even know I had for the language.
>>
>>53674067
>>
File: super_smug.png (22 KB, 217x225) Image search: [Google]
super_smug.png
22 KB, 217x225
>>53674067
>>53674082
>expecting people to care that you did some dumb shit that nobody would do in a real life situation and it didn't do what you expect

At least have good bait
>>
>use a hammer where a screwdriver is needed
>I hate hammers, they're useless
>>
>>53674067
Variables are only defined within their scopes. In C, this would be the equivalent of
int foo =10;
void bar() {
int foo = 5;
}

Now it should be clear why 10, 10 is the expected output.
>>
>>53674104
>expected outcome
It sure as hell isn't clear from the syntax from somebody unfamiliar with python.

In literally every other shitty meme dynamic scripting “language” I know, symbols are inherited from global scope by default unless you explicitly redeclare or limit them (e.g. with ‘local’ or ‘var’).
>>
>>53674104
As I said before, the assignment syntax and declaration syntax is the same, which is incredibly fucking stupid. I don't even fathom how you can defend that.

a = 10

def stupid_shit(b):
b = 5 # Assigns a variable
i = 5 # Declares a variable

print(b)
print(i)

stupid_shit(1)


>>53674099
>Assignment
>>shit that nobody would do
>>
>>53674131
That's fucking retarded.
>forget to put var
>now the global scope is polluted
One of the main reasons I hate Lua and Memescript.
>>
File: 1412590630345.jpg (11 KB, 200x200) Image search: [Google]
1412590630345.jpg
11 KB, 200x200
>>53674145
nobody fucking uses global vars any more okay, because it's not 1950 and nobody is writing programs in a declarative style without classes.
>>
>>53674131
>it defies the expectations of someone who doesn't know anything about the language, therefore the language is shit
>all dynamic scripting languages are memes

opinion discarded
>>
>>53674162
>le python is for writing quick'n'dirty scripts
>No, you're supposed to write complex programs with it
Fucking memers are so inconsistent.
>>
>>53674175
That wouldn't be "complex" you mouth breather.
>>
I'd recommend using python ONLY if it's completely acceptable for literally all errors to occur during runtime.

Examples: If you're replacing a shell script or some other interactive utility that YOU (as the author) will be interacting with whenever it runs, go for it.

If you're writing code that others will run, or code that will run when you're not looking, AND you care about that code not crashing, then avoid python and use something with strong static guarantees.
>>
>>53674067
It prints 10 twice because within the shitty_meme_lang() function, i is not a global variable.
This prints 10 followed by 5:
i = 10

def shitty_meme_lang():
global i
i = 5

print(i)
shitty_meme_lang()
print(i)
>>
>>53674162

if you used a real language you would know that you have multiple scopes, and that an outer scope isnt necessarily a global one.

Have fun with your classes though, almost like java :^)
>>
>>53672381
Javascript is obviously better
>>
>>53674145
>>53674268
>pythonfags desperately defending their meme lang
Look, everybody here understand that there are two possible scope interpretations of bare variable assignment and how they would produce different results.

Isn't it clear from the context that the only thing left unclear is whether python uses local or global scope by default?

The only argument here was that local-by-default is inconsistent and nonsensical. Variable _declaration_ should never be implicit, especially when what's implicit is variable scope.

That's just buttfuck retarded in every possible way.

Explaining basic language theory to me isn't going to make python better.
>>
>>53674458

This is the stupidest fucking thing I've read on this board today.
>>
>>53674484
>Python is shit and here's why [...]
>omg ur stupid stop bulli pls
As expected from a “scripter”.

Go learn C or Haskell or something.
>>
>>53674145
What is the output? 5 5 ?
>>
>>53674052
Read PIP-8. It clearly states that indentation should be 4 spaces. Every respectable project fallows PIP-8. You may not like the choice, but the agreement is there. I also think that tabs are better, but going against the official language guidelines is just shitposting of programming. Try to avoid it in places that matter.

It's just wonderful hope golang prevented this kind of bullshit with gofmt. That feature alone is reason enough to love this otherwise not so impressive language.
>>
>>53674145
Implicit declarations are fucking stupid in general. So are type errors being thrown at __runtime__.

(Unrelated: I like how pythonfags usually tend to call python “beautiful”. Personally I always have to vomit whenever I see __this__.)
>>
>>53674458
>the only thing left unclear is whether python uses local or global scope by default?
It's not unclear, though.
Is your variable inside a function or class ? Then it's local by default unless you specify otherwise.
>>
File: no.gif (60 KB, 220x118) Image search: [Google]
no.gif
60 KB, 220x118
>>53672381
>Python sucks
>>
>>53674850
>It's not unclear, though.
It's unclear a priori (that is, to somebody with no prior knowledge of python, e.g. >>53674067)
>>
>>53674917
Well, no as good as your sister, but it does.
>>
>>53674145
What I find even more stupid is this

a = 10

def stupid_shit():
print(a) // 'a' references global var
a = 0
print(a) // 'a' references local var

stupid_shit()


It would make sense if python was at least consistent, but no - global variables override local ones except when the local ones haven't been written to yet.

It's just buttfuck ass-backwards.
>>
>>53674968
>haven't been written to yet.
have been written to*
>>
File: image_3.png (825 KB, 1024x725) Image search: [Google]
image_3.png
825 KB, 1024x725
Python honestly doesn't suck though. It's a good language for fast shit that you don't want to have to bother with backend stuff to do. >>53674970
>>
>>53673991

why is this bad scoping? makes implementing closures very easy. also you can change the behavior to your wishes...

i = 10

def shitty_meme_lang():
global i
i = 5

print(i)
f()
print(i)


just because you don't know how to use it means it is broken, you know?
>>
>>53672381
>Python hate thread? Python hate thread.
Ruby devs please go and stay go.
>>
>>53675182
>just because you don't know how to use it means it is broken, you know?
Funny, that's the same thing PHP fags keep telling me whenever somebody points out how retarded PHP's == operator is.

“Y-You should be using === everywhere. Just because you can't use it doesn't make it bad!”
>>
>>53672381
hello world
>>
>>53674145
why the fuck would you give
stupid_shit(1)
a fucking parameter, when you change that value the milisecond the function is called?
>>
>>53675264

you obvoisly have no idea that python prevents you from overwriting variables from a different scop but still lets you access them...

In [11]: a = 1

In [12]: def j():
....: b = 2
....: def k():
....: c = 3
....: print c
....: print b
....: print a
....: k()
....:

In [13]: j()
3
2
1


also you didn't exactly tell why this is bad scoping. The point that you dislike it just for the sake of disliking says more about you than the language
>>
>>53673095
If any specific part of your code is bringing the performance down (as it is most times), you can always write that part in cython or a pure C extension and get godly performance without losing any of the many benefits of Python on the rest of your code.
>>
No one actually codes the way the examples in this thread are being presented.
>>
>>53674099
>implying this is not a legit example
Nigger are u srs?
>>
>>53675341

this, streaming several gigs of raw data from a c programm to python... it's a breeze thans to numpy.
Gee, if i had to do all the array indexing grunt work myself... so much time _not_ wasted on boilerplate
>>
>>53674415
Don't
>>
>>53673450
I find that writing good docstrings helps me avoid those problems at "coding time" and functional testing makes super easy and fast to detect whenever you made a mistake.

But of course everyone here is doing that, right?
>>
>>53674608
They only call it beautiful because they want other people to think they are associated with people who do actual smart things for great good. They expect to achieve this by copy pasta stack overflow into sublime text, then sit back and tell others that it's beautiful, instead of making something actually beautiful like idk, a solution for one of the np hard problems
>>
>>53675338
>>53674968
Like I said, it's inconsistent, unclear and backwards from a language design PoV.

Then again, that basically sums up python.
>>
>>53675358
it's not. in real code everything would be in a class and the "global" i would be known as self.i within the method
>>
>>53675407
I wish. Just started a new job, I will have to overtake development of one python project. Thousands of lines, no comments at all. Yup, even top level classes are absolutely bare.
>>
>>53675449

wow much opinionated, such reason

Like I said, it consisten in it's definitions, very clear about scoping (as in well defined) and fitted to the needs of (some) modern programming tasks (Prototyping, Creating/Analyse Data, Gluelanguage)
>>
>>53672528
Learn C# or Java, they're great technologies for creating modern powerful apps.

>>53673545
Although SQL is not a programming language, its vital to know as a SW dev as its what you use to save data to databases.
Thread replies: 68
Thread images: 6

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.