Just for the sake of curiosity I started a Python tutorial.
And I just found out it uses identation and a way to identify what is inside a for loop or if condition.
Is this serious?
I wonder how the discussion TAB vs SPACE for identation would go for Python users.
PEP8 -> Indentation
>Use 4 spaces per indentation level.
/thread
No switch statement
>>62236360
did you just /thread your own post?
>>62236360
>4 spaces
>not 8
In to the trash it goes.
why would i ever use while instead of for
>>62236385
4 is better than 8, Linus is wrong.
>>62236387
Using the standard for loop in python always creates an iterator -even if not needed-. Quite inperformant
>>62236385
you can fit more code on the screen
>>62236438
If you are really optimizing at this level, you should be vectorizing your operations, not using for
>>62236336
welcome to 20 years ago and fuck off back to /r/programming with your underage internet discoveries
>>62236385
>>62236360
>4 or 8 spaces
>not 2
do you hate writing code
Because having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen?
If you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
>>62236503
Spotted the Ruby faggot. 2 space indentation is for absolute retards.
>>62236385
>using 10% of your line width for each tab
retard
>>62236654
you're contradicting yourself
>>62236336
Yeah, so? If this is the 1st time you are seeing Python code it means you are just some random noob anyway and your opinion doesn't matter as you can't judge anything.
And all this crap just to avoid a pair of curly brackets. Python is an unholy language and y'all keep proving it by arguing over how many spaces to use.
this debate is really high level
>>62236683
How many levels of indentation do you need, fa?m Behond 3 or 4 it's about time to rethink your plan.
wow my friend. i am euphoric by this discovery. i would tip my hat to you if i wasn't naked in front of my computer screen
>>62236336
Indentation, like the way it does comments, makes sense if you realize that its an line interpreter and thus you want to keep syntactic things as local as possible.
>not using tab
Oh man you make me laugh
>>62236850
If you use 8 spaces even 2 tabs is too much
>>62236879
who's the artist?
>>62236336
>C programmer
>puts code in brackets
>stills tabs the inner code
TOP LOL
I like this as it keeps code looking nice and clean, sick of spaghetti coders who send me their unindented code.
>>62236438
>[in]performant
This word needs to die
>>62236503
2 spaces hides bad code full of nested blocks.
>>62236336
I hate languages that use whitespace too, makes it difficult to auto generate things.
>>62236336
>Is this serious?
Yes, it's a well-known fact that Python is a retarded language.
>>62236336
Stop cargo culting C-style brackets OP. They were born as a shorter notation thanBEGIN
...
END
Using indentation to mark blocks enforces good indentation practices, avoids a good bunch of code style debates and makes the missing curly brace a non-issue.
>>62236759
this
I almost always newline and tab when using brackets so eliminating brackets is convenient.
>>62238008
go away, BEGIN X/END X is great
>>62238008
Why use whitespace, which is invisible without an IDE? Why not just use dash, plus, or whatever? Python is literally communism.
>>62238094
Not so to Thompson and Ritchie, who left everyone dealing with {} for eternity.
In retrospective back then it was great for a teletype, where wasted characters made everything take longer but who the fuck still uses a teletype?
Same deal with every other shorthand BCPL/B/C brought.
>>62238128
>which is invisible without an IDE
wut?def foo:
bar
Looks pretty visible to me
I thought Python was dumb as fuck at first but I've been using it a lot for data processing and analysis and its been using really well
Its good for computer vision too
>>62236336
It's awful. Sometimes opening a py file in a different text edititor fucks everything up. When your writing in python you have to pretty much just pick one edititor and stick with it. i use gedit.
It really is retarded though, You can tell python is a really hacked together language held together with spit and duct tape.
>>62238223
>>62238223
>Sometimes opening a py file in a different text edititor fucks everything up
>Not using EditorConfig
>>62238223
not really, only if the editor actually inserts tabs instead of spaces when you press tab.
tabs is a farily archaic practice with remnants only in stuff like makefiles or borderline autistic programmers
>>62238223
>Sometimes opening a py file in a different text edititor fucks everything up. When your writing in python you have to pretty much just pick one edititor and stick with it.
>edititor
>when your writing
I think this is bait but then again /g/ can be really stupid sometimes so I'm not sure.
>>62238211
> data processing and analysis
>Its good for computer vision too
No, i am gonna tell you why you are using it for it because you are not smart enough to implement your own algorithms and instead you are using recipes with kits like scikit learn and shit like that.
Python without numpy (which is practically matlab syntax) is slow as fuck and not good for data sciences.
http://opencv.org/
http://www.mlpack.org/
http://www.cs.waikato.ac.nz/ml/weka/
>>62238295
numpy/scipy allow you to use the python runtime environment as a wrapper for LAPACK/BLAS/MKL without having to write your code in fucking C.
The better alternative is running FORTRAN but it's not pretty.
>>62238373
Forgot to say, MATLAB is a pretty good alternative but everyone knows it costs a bunch for every feature you use.
>>62238373
>as a wrapper for
Thats the fucking python problem, its a bunch of wrappers cuz the official python implementation its so fucking slow to do things by itself, even pure javascript its much more suitable by itself todo that tasks emscripten compiled code has better performance than pyshit.
>>62238454
Maybe because Google has invested a shitton of money on making V8?
PyPy doesn't have nearly as many resources and it's a good improvement anyway. CPython was always meant as a C wrapper of sorts.
>>62238373
Python merit is being a fucking glue with whitespace issues.
>>62238481
>Maybe because Google has invested a shitton of money on making V8?
dude, what about spidermonkey and chakra , even fucking embeded JS engines like ducktape and jerryscript has good performance.
Lot of python projects are a bunch of dependencies to other projects because they creators have no fucking idea of how to do it by itself.
Things like this : http://simplecv.org/
a fucking high level api to the cv api for python and that cv api for python is a fucking wrapper to the cv library for C++. disgusting af.
you can do image processing on JS in a fucking browser without anything else python is a joke.
>>62238454
this is bad why exactly? You write the things that need to be fast in a fast language and you write everything else in a slow but readable language. doesn't that just make sense?
>>62238295
>you are not smart enough to implement your own algorithms
Clearly, wasting your time reimplementing stuff other people already made is the more intelligent approach.
Use Rust instead of Python.
>>62238295
after you've implemented a few serious algorithms, you realise that you don't have time to implement every algorithm you need properly and efficiently... in fact you don't have time to do 5% of them if you want to get anything done
>python without numpy is slow!
so what? why would anyone be using python without numpy?
>>62238576
>tfw to intelagent to use a game engine
>>62238554
Spidermonkey has also had heavy Google support and then the V8 competition, Chakra was made by fucking MS. The deal with Python is how slow are implementations because they obviously have less resources than JS, which is a pity given how ugly is JS, even with ES6.
>Things like this : http://simplecv.org/
I could give you an endless list of dumb npm modules, anyone can do high-high-high-level APIs.
>>62238633
>tfw this kind of retarded NIH autism is what doomed Natural Selection 2 to irrelevancy
three-space master race
>>62236336
>>62236682
Lisp looks like shit with more than 2 spaces though. Some languages are better with 2 spaces, some with 4 and that's okay.
>>62239037
>Lisp looks like shit with more than 2 spaces
no, lisp looks like shit no matter how you type it, its a ridiculous useless language.
>>62236375
dem good old days when I used switch() with include() in vanilla PHP for my websites
>>62238128
>whitespace invisible without IDE
what the fuck am i reading
>>62238128
>>62238172
>>62239575
You need an ide to write python programs because of significant whitespace.
It's a well known issue. Guido doesn't want to fix it because it keeps normalfags away.
>>62239815
that only happens with notepad since it doesn't recognize "\n" as a line break.
>>62239815
notepad is not a normal text editor
>>62239815
>>62239864
wait nevermind i don't know why it isn't showing spaces either
>>62236383
/post
>>62237847
>Implying people actually use that word
>>62239815
do yourself a favour upgrade that sheet to notepad++
>>62236336
Literally the point of the language retard.
It was meant to be a quick and dirty way to program.
>>62240180
>not notepad+=2
>>62236375
Switch statements are bad and you should feel bad for using them.
>>62238554
python has always had a cv/ml following
>>62236956
PEP8 says you should be using 4, so no
Also a reminder that the Python developers tried to REMOVE lambda functions, map, etc. from Python 3.
It is literally GNOME 3: the programming language.
>>62238373
I hope Julia overtakes Python desu
>I just found out it uses identation
whats it like living in 2002
>>62237491
If a mistake is made with indentation then the code ends up in a different scope than intended.
Then again there is a higher chance of missing colons in C.