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

Python

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 304
Thread images: 16

File: python-logo.png (82KB, 601x203px) Image search: [Google]
python-logo.png
82KB, 601x203px
Why is it so hated?
>>
Because it's shit made for retards.
>>
Because it triggers the uncomfortable realization that one need not spend 14 gorillion hours memorizing the idiosyncrasies of dogshit languages (e.g. C++ and PHP) in order to write code that works well. Basically, people can't deal with the fact that they got memed on, so they cope by hating the obviously superior thing.
>>
>>58830476
That's not an argument. Is it slow? Limited?
>>
>>58830510
Talking as a experienced programmer?
>>
>>58830440
Because people try to compare it with languages the don't fit the same use case.

Python is good at what it does, which is allow you to write quick scripts and simple tasks. The larger a project gets it may be more difficult to manage in python, but at that point you shouldnt be using python at all.
>>
>>58830538
So it's just a good learning language?
>>
>>58830526
Not this guy, but I am talking as an "experienced programmer", who has also been programming Python.

The problem is not Python, C++ or any other language -- the problem is the environment in which yo gain this bias, namely /g/. This is a cesspool of people who want to feel intellectually superior to others, and the best way to do so is to belittle people who they perceive to be below them in their choice of programming language.

Accessible languages, such as Python for example, become the languages perceived by those people as the "easier" language, while all it really is -- is more accessible.
>>
>>58830564
No because it is also useful for getting things done. It might not be as fast as C++, but it often just werks. If that is what you need, then it is good for that
>>
>>58830564
No you can write proper, big software in Python. For example Calibre. There's also now typehinting integrated into the language (optional), which opens the doors for static type checkers etc. Whatever problem there is currently because of a lack of static typing will soon be gone, if that's the actual bottleneck to writing "big software".

>>58830538
What this guy said might be true to an extent, however I haven't really seen any evidence for it to be as bad as most people claim.
>>
>>58830440
Semantic whitespace
>>
>>58830564
Sort of. It has a fair amount of idiosyncrasies and magic that doesn't translate well into other languages, but it's a decent starting point for learning if you want to just do light shit like >>58830538.
>>
>>58830526
Ah yes, see here:

>>58830569
>>58830606
>>
File: 1464574243066.jpg (12KB, 424x394px) Image search: [Google]
1464574243066.jpg
12KB, 424x394px
>major in computer engineering
>work hard, focus on working with c and assembly
>work on tons of projects
>spend years searching for an embedded sw dev job
>finally find embedded c/c++ dev job
>$50k
>friend has no interest in technology, majors in cs
>no projects
>applies to first python job listing he finds
>gets it
>$110k
>>
File: CWE-F_xUEAAkDF1.png (51KB, 599x338px) Image search: [Google]
CWE-F_xUEAAkDF1.png
51KB, 599x338px
>>58830654
>the easiest language is the one that hasn't been colonized by Pajeets
really depolarizes one's axons
>>
>>58830654
you forgot the part where he lives in mexico 2.0 where 50% of his salary goes to taxes, and 40% to his housing.
>>
I use Python at work every day. I don't hate it so much as find it a bit dull. It de-emphasizes functional programming and some of the libraries (I'm looking at you, sqlalchemy) feel a bit overengineered and hard to reason about.

It's a great business decision though. Python has loads of mature libraries maintained by Other People.
>>
>>58830700
Is it fast?
>>
>>58830440

Just don't like it. Don't like Java either. But then again I have thousands of hours on C++ and Perl. I find it not practical to learn another language when I already know two and a variety of other scripting like bash, powershell, etc.

It's like learning Pascal....why? Because that is what the recruiters have a hard on for this month? It'll change next month.
>>
>>58830714
It's fast enough for 99% of things you could want to do. If you are doing something in the 1% use Cython or use C to write the C-bindings yourself.
>>
>>58830510
I've found myself guilty of this. I'm reformed though and have been a mildly enthusiastic python developer for a few years since. My background in C/C++ biased me heavily against crass scripting languages, python in particular, but when a tool works and it's efficient, there's nothing to complain about.
>>
Slow.

Use Go as an alternative. Node if you're a noobie.
>>
>>58830714
Languages aren't fast or slow. CPython is slow, PyPy is middle of the road. There are some experimentalish things like Nuitka (a Python to C++ compiler) and RPython (a restricted dialect of Python with a compiler) that are fast, but I've never used them. Python also has a decent C FFI. When the speed of your Python runtime is the bottleneck, you have options.
>>
Anyone with Python web dev experience? How is it compared to PHP?
>>
>slow
>python 2 vs python 3
>>
>>58830440
It's relatively simple, which triggers the shit out of everyone who learned a more difficult language.
Especially since for a lot of applications the slower speed isn't too bad if you don't go for full retardo programming but instead use numpy & co
>>
>>58830440
because this is /g/
>>
>>58830791
>python 2 vs python 3
?
>>
>>58830672
I always find this really fucking weird.

>work in academia so everything is full of Pajeets
>when they have to do some light calculation they start writing Fortran programs for it
>none of them knows Python

How? It is so fucking easy, it would take an afternoon to look up the stuff.
>>
>>58830897
College or high school?
>>
>>58830440
mediocre

slower than javascript
>>
>>58830654

what the fuck made you think anyone cares about firmware fags?

there is a reason firmware is literally garbage ware.
>>
>>58830983
What the fuck are you talking about?
>>
>>58831026
are you dumb enough to think anyone cares about actually writing quality embedded shitware?
>>
>>58831063
Yes.
>>
>>58831081
i'm so sorry.
>>
>>58831081
>>58831107
Don't listen to this retard acting like he is some kind of job market analyst.
>>
>>58831206
Kids.
>>
>>58830869
print vs print()
>>
I'm fine with python but it's fucking ridiculous how horrible the stdlib is, even in 3
>>
>>58831395
Print is a function. So?
>>
>>58830440
Because it's a very poorly designed language that has dozens of poorly thought out features instead of small powerful core. 99% of new features to Python require modification to the parser whereas in better language the same features could be simple libraries. In terms of dynamically typed languages, Smalltalk, Ruby, Scheme, Common Lisp, Clojure, Lua and Julia are all much better.

Then they broke compatibility without fixing any of the glaring problems and are now adding an extremely poorly thought out coroutine and async system that almost nobody understands and has hundreds of bugs. It's so poorly thought out that you have to pass around the event loop or rely on error prone hacks like attaching the event loop to the current thread. It's just a huge mess.
>>
> Because it's a very poorly designed language that has dozens of poorly thought out features instead of small powerful core. 99% of new features to Python require modification to the parser whereas in better language the same features could be simple libraries. In terms of dynamically typed languages, Smalltalk, Ruby, Scheme, Common Lisp, Clojure, Lua and Julia are all much better.

Absolute bullshit.
>>
>>58831437
>>58831457
However, I do agree with the async bullshit.
>>
>>58831457
100% truth. Most "features" in Python would be trivial libraries in better languages like Smalltalk.
>>
>>58831481
Na. What are you even talking about when you say "modifications to the parser"? The only thing that comes to mind is the async-thing, which you again mentioned a paragraph below.
>>
>>58831206
I never said I was a job market analysis.

I'm just telling you the cold hard facts that most fucking embedded development is done by copy pasta chinks who can't program for shit.
>>
>>58831537
Where do you get that information from?
>>
>>58831548
He is a a job market analysis.
>>
>>58831437
b-but they gotta compete against javascript somehow
>>
>>58831488

Most features that have been added to Python over the last 10 years require changes to CPython at the parser level because Python is a poorly thought out language. A ton of Python features (such as list/dict/set comprehensions, decorators, context managers and the ever expanding set of string prefixes) could be implemented as libraries in better languages. Half of these "features" are just hacks around the fact that Python has crippled lambdas and far too many statements.
>>
>>58831619
You mean syntactic sugar? Retard.
>>
>>58831629
If your language requires syntactic sugar for most of those things it's fucking garbage.
>>
>>58831640
It doesn't, that's why I called you a retard. All the features you listed can easily be used with the core language.
>>
File: ....gif (755KB, 420x314px) Image search: [Google]
....gif
755KB, 420x314px
>>58831619
>>58831629
>>
>>58830440
Well, I like it
>>
>>58831426
xrange vs range
>>
>>58831649
If you want to write hundreds of one off "named" functions and have them clutter your namespaces or function definitions. They were added because Python is shit and doing so is painful.
>>
>>58831669
Use Python 3 ffs.
>>
>>58831675
If I ever migrate off 2 it will be to a different language.
>>
>>58831672
Still not sure what this has to do with the features you listed in your earlier post, that were clearly just syntactic sugar. Nice meme though bro. Good night, done wasting my time with you.

>>58831685
Bye retard.
>>
>>58831675
Not until bdfl recognizes his fuckup
>>
>>58830440
nice to learn,nice to model,nice to play.
But fucking hell on deploy.
implementation is shit, Ruby even gets better.
>>
>>58831691
enjoy your security vulnerabilities, you memeworthy luddite
>>
>>58831690
>that were clearly just syntactic sugar

That required changes at the parser level and were implemented because the core Python language was so fucking bad that very simple abstractions were extremely painful to write. By Python 3.7 it's going to be more complicated than C++.
>>
>>58831713
Redhat, Dropbox, Google and a ton of other companies will provide support for Python 2.7 for decades after 2020. Not one of them has even considering a serious migration to Python 3.
>>
>>58831739
Source?
>>
>>58831739
>Dropbox, Google
both are already porting their Python 2 code to Go
but sure, keep waiting for those security patches that will never materialize
>>
this is why python is shit

https://docs.python.org/3.7/reference/grammar.html
>>
>>58831754
>both are already porting their Python 2 code to Go

Very specific projects that are performance critical are being ported to Go. Both companies have millions of lines of Python 2 code that will never, ever be migrated.
>>
File: 70e.jpg (28KB, 567x565px) Image search: [Google]
70e.jpg
28KB, 567x565px
>>58830476
>>58830606
>>58830791
>>58831421
>>58831640
>>58831761
>>
>>58831780
if you think a language laden with a fucking statement for everything is good, then you might be crazy.
>>
>>58831754
Next version of RHEL ships with Python 2.7 and Redhat guarantees security patches for all core components for a minimum of 10 years.
>>
Forced indentation of snek
>>
>>58831761
Even Perl 6 isn't this bad.
>>
i have a really stupid question about python. how are you supposed to know if your program works or not without running it? like c++ has strong typing, so if you do 5 + "hi" it will tell you that's wrong. but python doesn't do shit until you run it. are you supposed to rigorously test every code path in python? or is there a linter or something that i'm missing
>>
>>58831868
> are you supposed to rigorously test every code path in python

Basically.

> or is there a linter or something that i'm missing

There are linters but they can't give you even a small fraction of the guarantees a good static type system can.
>>
>>58830440
No += and ?:, code style is forced by compiler.
Enough for calling it shit.
>>
>>58831933
Interpreted language.
>>
Shitty type system, shitty speed, shitty management (2.7 vs 3.0)
>>
I like python but i have spent the last 2 days trying to find what path is wrong and crashes opencv.
Maybe i am a retard but man this is hard.
>>
>No Semicolons and curly brackets
>Weird typing system
>Forced code style
>Fucked up operators such as assignment
>>
>>58830440
I know this is a typical noob question. But this is an honest question. What things do you need to know how to do with a programming language in order to get an entry level job?
>>
Python is so awesome it needs two forks running at the same time!!!!!
>>
>>58832130
You need to be able to translate basic English into that programming language. See basic stuff like Fizzbuzz.
>>
no monads
>>
>>58832169
Oh! Thanks anon I'm just lurking to see what programming is all about. I know a little bit of JavaScript but I never really dove in too deep.
>>
File: chicken-police.gif (2MB, 323x215px) Image search: [Google]
chicken-police.gif
2MB, 323x215px
>>58830440

because people actually use it
>>
>>58831619
nice b8
>>
>>58830440
whitespace and the 3.0 split.

Other than those two things it's fine.
>>
>>58832431
Nice shitpost. Retard.
>>
>>58830512
It's kinda slow
>>
>>58831619

Template Python here we come.
>>
>>58831933
python definitely has +=, in addition to a ton of augmenting assignment operators, though it doesn't have a ternary operator. It's clear you're speaking from ignorance.
>>
File: 1481110946541.png (7KB, 534x167px) Image search: [Google]
1481110946541.png
7KB, 534x167px
>>58832433
3.0 hasn't been an issue for a while. This isn't 2010 anymore.
You'll indent your code anyway so whitespace isn't really an issue either.

Here are some actual issues with Python:
- unreliable code analysis/completion tools (pic related)
- complicated package publishing process compared to e.g. Ruby, Node and Go
- lack of a "?." operator
- bad lambda syntax
- convoluted standard async library
>>
>>58830512
Yes, it is pretty slow and the multithreading support is terrible/nonexistent
>>
>>58833793
>multithreading support is terrible/nonexistent
Python can create native threads just fine, the interface is easy to use too.
You can also very easily create a process pool and submit long running cpu intensive tasks to it if you need multiple cores.

>>58833793
Pypy is quite fast.
>>
>>58830440
import task
data = open(data.txt, r)
for piece in data:
task(piece)


The above code can accomplish basically any data processing task with slight modifications

In short, it's too easy so it invites casuals but doesn't prompt them to form any deeper understanding of what's going on. Meanwhile people who learned on C have to manually allocate memory and manually deal with pointers and other low level drudgery and these people are angery that others don't have to suffer in that way before being able to accomplish meaningful tasks
>>
>>58830781
PHP is like starting to write a book by cutting down trees to make paper as your first step and Python/Django is like having your book already written for you.

>>58831640
>If your language requires syntactic sugar for most of those things it's fucking garbage.
Lol. This is the kind of statement made by someone who has been fucked in the ass by pointer errors their entire life and can't cope with the fact that finishing a program on time is often more important than having it run 1% faster.

>>58831994
There is no such thing as an "interpreted language". Nice meme.
>>
>>58830440
Programming in any other language than C++ is like programming in C++ but being forced to use specific libraries with poorly defined cumbersome functions,

Once you have learned the syntax of c++ you will realise how easy it actually is, you can define your own functions to avoid repeating code, by far superior to other languages
>>
>>58833793
Bullshit.
>>
>>58830440
pseudocode
>>
>>58831437

Basically this.

Python is not bad, I like the short syntax and even the white space indention. Programmign in Python is fun.

But for example in Ruby you can rebuild a lof of the basic features just with blocks and the each/map iterators. Because they chose the right abstraction.

Python seems more "patchy" and "quirky" to me. They __basic__.__syntax__() is kinda ugly and the syntactic sugar is often kinda wierd, i.e. ";".split() or the fanatical use of parentheses everywhere.
I can live with that, it's not terrible, but I founf Ruby's methods more beatuful and consistent:

[1, 2, 3].split
[1, 2, 3].join

..and so on.
>>
>>58833100
>>58833793
it will be slow once you have to have an import for your shitty script every second line since you just copy/paste from stackoverflow you useless turd.
>>
>>58830440
It's neither really good for scripting nor for rapid application programming for several technical reasons.

If you can't see that you aren't experienced enough as a programmer.
Nuff said, so /thread
>>
>>58835000
Wouldn't ask if experienced. What's the problem?
>>
>>58830538
Disqus, reddit, YouTube. All very small projects and not at all complex
>>
>>58830606
Human visual cortex
>>
>>58830654
You're clearly not very bright if you don't understand why you are stupid here
>>
It's unbearably slow and constantly used for things it absolutely shouldnt be thanks to its easy syntax.
>>
>>58835032
Youtube is replacing all of its Python with Golang because they realized they've turned the website into a barely usable mess.
>>
>>58834971
>implying i copy anything from there
Literal idiot, but your bs doesn't make any sense of course.
>>
>>58835084
keep telling yourself that while you whine about memory issues in firefox for your 700 Stackoverflow Tabs
>>
>>58830714
You literally have access to infinite servers for the cost of nothing today relative to 10 years ago or twenty. People that speak about speed are idiots. It shouldn't even be a consideration.

C is faster and more efficient. If you're coding for satellite systems, which I have, where you have limited processing power then sure.

Otherwise i can spin up 1000 aws instances and do any calc for anything like lightning.
>>
>>58835000

1. Python has de facto replaced bash for scripting

2. There are enough "mid-scale" applications in python to proove you wrong. Of course for real big stuff you would rather use soemthing like java.

3. Bring up solid point, not that "if you can't see that you aren't experienced enough" crap..


>>58835066

YouTube/Google use dozens of languages at the same time. If you read: "YouTube uses Go" it does not mean that every single load balancer or library is written in Golang. It rather means: "Somewhere in the giant machinery of our website we chose to rebuild one tiny part with Go.

Also we must not forget that Go and Youtube are both by Google, so of course they try to shill for Go by claiming "Look, Go lifts YouTube!"

Compare that to Ruby, of course you can say "Look, GitHub and GitLab are made with Rails", and that's not wrong. But underneath they replaced some critical parts with other languages.


Langauges are just tools, you don't build a complete house with a hammer alone, and neither with a screwdriver alone. But you want to use both where they are appropriate.
>>
>>58835031
- slow startup times (the same reason why not everybody jumped immediately on PowerShell on Windows)
- poor host API
- no sandboxing facility
- poor standard semantics thanks to CPython being the reference; PyPy and Cython allow you to break it to improve performance here and there
- poor concurrency story; multiprocessing doesn't sound so bad, but remember #1
- the 2/3 jump wouldn't be bad, however, they barely improved anything

TL;DR: They should either made it a proper interpreter or a proper, fast compiled language.
>>
>>58835031
>What's the problem?
He's an autistic asshat who assumes every thread on /g/ is a bait attempt instead of people legitimately asking questions.
>>
>>58835173

Don't take it personally, Guido.
We all know how great Python is and so on..

Now go home, you're drunk.
>>
>>58835163

> 1. Python has de facto replaced bash for scripting

lol no

Bash/Perl >>>>>>>>>>>>>>>>>>>>> Python maymay
>>
>>58835163
>1. Python has de facto replaced bash for scripting
Not. Which is on one hand unfortunate, because bash is even worse, but on the other hand lucky because your system would boot 1 minute instead of 20 seconds.
>2. There are enough "mid-scale" applications in python to proove you wrong. Of course for real big stuff you would rather use soemthing like java.
There aren't. Remember, slow web front backends like leddit and shell tools like youtube-dl are a shit. Hard and cold desktop applications with custom widgets drawn in the language natively like fullscale CAD applications is what counts.
>>
>>58831437
This must be a joke. You literally have written nothing of substance while stating your subjective opinions as though they were fact. This type of wannabe intellectualism is pathetic.
>>
>>58835201

I didn't say Python is better than Bash, I just told the facts.

Personally I like Perl, Ruby or even Bash more than Python, but if you apply for a SysAdmin position today, people will assume you know at least some Python basics so can read other people's scripts.
>>
>>58835169
Oh, and I forgot:
- not actually good pseudo-code, because pseudocode is painful to write with indentations
>>
>>58830538
lol, what's IPython, what's eve Online, what is dropbox
>>
>>58834943
I've never understood people's issues with the 'STR'.join(SEQUENCE) syntax. It may not be intuitive at first if you come from another language, but if you think about it it makes a lot of sense. Why define a join method for each and every possible sequence type that only takes str as an argument if you can instead define a single one for str that can take anything?

I can understand that the underscore thing is ugly but there's a philosophy behind it and I can't think of a less ugly way to implement it.
>>
>>58830749
>Node
js is useful, but god is it horrendous to write/read
>>
>>58835127
>People that speak about speed are idiots. It shouldn't even be a consideration.
It's foolish to take it that far. Of course developer time is by far the biggest 'cost', but performance still matters in many cases.
>>
>>58830440
Python is like a fifth leg to a cow, tries to be everywhere and fails.
C - kernel mode
C++ - AAA games
PHP - webdev
powershell - windows scripts
bash - loonix scripts
C#\Java - corporate clusterfuck entertainment

Python - ??? useless.
>>
>>58835273
This, ORMs are actually slow and you can feel that on the client.
>>
>>58831640
As if it really matters. I hate it when insecure high school kids learn a new language. Look how smart and close minded I am.

If you don't have the ability to flip through languages with ease then you're an idiot. If you whine about syntactic sugar you're a fool.

Sometimes you need a library in Java. Sometimes you'll need 10 written in Python. Sometimes you need a lot of parallel calcs in c. Sometimes you can only get things done in JavaScript. On a single project. If you can't write in all of them, fast and well, then you're not going to get paid.
>>
>>58835287
> useless
Python is used in Youtube, Instagram, Pinterest servers and Facebook AI
>>
>>58835210

> 1.
Of course stuff like Bash or Awk always comes in handy. But it's easier to find a Job when you have good Python skills and no experience in Bash than the other way around.

>2.
What? Didn'T read the part about "differnt tools for differnt purposes"? With languages like Python you can make an application in the fraction of the time than you would use in C or C++. Also it's way harder to find good C++ or C developers, because those languages makes it easier to shoot yourself in the foot. So you need aditional code reviews which take even more time and so on. Bascially it just costs more. Developer time = expensive, computing power = cheap.

Yes, IF (and that's a big if here) you write a "hard cold" programm where design your hyper-complex graphical algorithms or want things as real tiem as possible.. yes, then scripting languages might not be your first choice, sherlock.
>>
>>58831754
Yea they're going to port billions of lines of code to go just because. You are a fucking idiot. Google is pushing go and still no one is using it dumb dumb.
>>
>>58835287
come on, it's fine to don't like python but it definitely have its uses:
https://en.wikipedia.org/wiki/Python_(programming_language)#Uses
tldr: used by (non-computer) scientist and for web applications
>>
>>58832130
Go and lookup Python jobs in your area. See what they're looking for. Go learn that.
>>
File: 20170207_135732.png (361KB, 1686x892px) Image search: [Google]
20170207_135732.png
361KB, 1686x892px
while we are at it, can someone explain why spyder3 is spamming my router with dns queries? like a hundred of queries per second
>>
>>58833599
This
>>
>>58835169
>- slow startup times
Interprocess communication is a thing. There's a reason why we are no longer using classic CGI.

>- poor standard semantics thanks to CPython being the reference; PyPy and Cython allow you to break it to improve performance here and there
What exactly makes them poor? Pypy doesn't "break" anything, it's a simple tracing profiler. Cython is a superset of Python that compiles to C.

>- poor concurrency story; multiprocessing doesn't sound so bad, but remember #1
If you need to take advantage of multiple cores then you have some kind of a long running task and the time required to start the interpreter is negligible.
You should be using a process pool anyway.

>- the 2/3 jump wouldn't be bad, however, they barely improved anything
Proper unicode support alone is a good enough reason to switch.

TL;DR; You tried using Python where Python wasn't the right tool
>>
>>58835066
You're fucking retarded. Google is trying to make Go a thing. And no one except Google is buying it. Typical retarded google.
>>
>>58835306
Write sql then. Jesus what are you people retarded?
>>
>>58833793
I was actually surprised how quick it is for a scripting language. The multi threading support is horrid though
>>
>>58830440
I don't have problem with people who write python servers, but it shouldn't be used for desktop software imo, because I don't want to have to use slow as dogshit software on my machine. I actually wanted to use it when I tried webshit, but I couldn't find a good python 3 book, so I went with something else.
>>
>>58835313

You are right, but that only makes his point more important:
When you have to use 5 different langauges, shitty syntax takes up additional "memory" in your brain, because you have to remember the quirks.


>>58835306

>This, ORMs are actually slow and you can feel that on the client.

Adn that's why nobody uses Hibernate, right? LMAO.
Of course abstraction comes at a cost. But they also give you a couple of great benefits.


>>58835253

> 'STR'.join(SEQUENCE)

Nah, it's neither logical nor readable. And it doesn't make sense.

logical:
"join" is the inverse operation of "split". Yet it's str.split(",") but ",".join(str).

readable:
You have no "default way" of operrators, so it makes it harder to read.

Let's make an (slightly artifical) example for illustrational purpose:

-change delimiter from "," to "."
-cast string to float
-make it "iterable"
-map it fromx to x^2

print(list(map(lambda x: x**2, [float(".".join("1,23".split(",")))])))


Now the same thing in Ruby is:
print ["1,23".split(",").join(".").to_f].map{|x| x**2}



Of course this is not how you would do it, but my point is to show how often you have to break your "flow of reading" in python. The ruby version goes pretty much from left to right.

>Why define a join method for each and every possible sequence

And here is an example of python's bad abstaction. Instead of letting the iterator handle the types (like it should be), the join method handles it, which is why you call it at the string you want to join..
>>
>>58835599
Are you 17? I genuinely don't think you have a clue what you're on about.
>>
>>58833869
>There is no such thing as an "interpreted language". Nice meme.
If that's true then where is my bash compiler? Also, why is there a wiki article titled "interpreted language"?
>>
>>58835411
>Interprocess communication is a thing. There's a reason why we are no longer using classic CGI.
>implying everything is a web server
That makes it shit for a bash replacement and for embedded scripting.
>What exactly makes them poor? Pypy doesn't "break" anything, it's a simple tracing profiler. Cython is a superset of Python that compiles to C.
In order to create somewhat fast, non-trivial programs you effectively have to write code that isn't compatible with CPython

>If you need to take advantage of multiple cores then you have some kind of a long running task and the time required to start the interpreter is negligible.
That's what webfags believe

>Proper unicode support alone is a good enough reason to switch.
no, proper unicode support alone is not good enough reason to switch, it's a reason to not use the first version from the start

TL;DR: Webfaggots thinking they are the measure for language/tool/anything quality when in fact my ass can fart out their webshit.
>>
>>58833869
>There is no such thing as an "interpreted language". Nice meme.
There are language that can be compiled ahead of time to binaries gracefully or interpreted/JIT-compiled gracefully. Python is neither.

I wonder how good it could be if Guido and the CPython faggots weren't in charge.
>>
>>58830510
>slow as shit
>indents are part of syntax
>"obviously superior thing"
>>
>>58830440
Because programming babbies that never bother to learn in the slightest how computers or memory work try to bully everyone into using python for everything, and everyone into learning python, furthering the false narrative that you need a PHD before you can even read a "hello world" in any other language.

Also the retarded Python 2/3 split, trying to keep python 2 on life so support as long as fucking possible.
With python 4 they will probably still cling onto python 2 and try to circumvent everything just to stay on it.
>>
>>58835615

I responded to 3 differnt people, could you be more precise?


>>58835860

Go ahead then and make some "webshit" then. You would be surprised, how deep the rabbit hole goes.
>>
>>58830440
Because by the time you learn it, you realize that the supposed gain from it being abstract and having "good syntax" is non-existent, due to you having to rely on C libraries anyway because its speed for serious tasks (like AI-related stuff, image processing, loops in general) is absolutely fucking terrible. It's not just some 10 or 20% slower, it's seriously FUCKING BAD.

And then you can just do *exactly* that and have abstract representation of C++ libs in C++ by putting them inside classes and summarizing the entire functionality inside the class with a single function (much like what Python is doing with its libraries). So what exactly is the benefit of Python?

I don't actually know.
>>
>>58835860
>That makes it shit for a bash replacement and for embedded scripting.
>embedded scripting requires constantly spawning new processes

>In order to create somewhat fast, non-trivial programs you effectively have to write code that isn't compatible with CPython
pypy is very compatible with cpython.
cython supports both annotations and separate files with type information so you can still run them with regular cpython if required.

>That's what webfags believe
Give me an example of a program you'd want to write in Python but it's unfeasible because process startup time / interprocess communication overhead is too large.

>it's a reason to not use the first version from the start
Thanks for confirming my point.

>Webfaggots thinking they are the measure for language/tool/anything quality
I don't do web development, sorry. Mostly embeded and data processing.
>>
>>58835032
YouTube only used Python for template rendering and even that has been migrated off Python.
>>
>>58830569
I'd also argue that Python is "easier". I like the language. I use it to do all of the GUI and quick scripting for personal projects. Any system-level library is gonna be in C++ though.

I do agree that people on this board shit on it because it's easier, therefore "cool" to shit on. I also believe many of the people on this board are not well adjusted individuals for normal society
>>
>>58836094

>So what exactly is the benefit of Python?

it = input("Say what?")
reps = int(input("How often?"))
print(it * reps)



#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* readinput()
{
#define CHUNK 100
char* input = NULL;
char tempbuf[CHUNK];
size_t inputlen = 0, templen = 0;
do {
fgets(tempbuf, CHUNK, stdin);
templen = strlen(tempbuf);
inputlen += templen;
input = realloc(input, inputlen+1);
strcat(input, tempbuf);
} while (templen==CHUNK-1 && tempbuf[CHUNK-2]!='\n');
return input;
}

int main()
{
char* it;
int howOften;
int i;

puts("Say what?");
it = readinput();
puts("How often?");
scanf("%d", &howOften);
for (i = 0; i < howOften; i++)
{
printf("%s", it);
}

free(it);
return 0;
}
>>
>>58830440
Today, after a years long break, I had to work with python again.
What immediately annoyed me was len(list) instead of list.length. Being used to putting it on the end from pretty much any other language, this made me move the caret quite a lot. I know there's __len__ but that shit is even uglier.
>>
I see kids rewriting basic things in python meanwhile basic *nix utils can do the same with a little piping and regex.
>>
>>58836442
It's to free up the class namespace as much as possible. Why store it in a plain attribute when a user may want to ascribe a different meaning to the word "length"?

It might take some adjusting to, but the logic behind it is sound.
>>
>>58836489

God, you are the person from >>58835253
Aren't you?

It's always the same:
>people complain about stupid python syntax
>"No, no, it's not python that's wrong, YOU are wrong!"
>"At first I also thought it's shit, but after a while it really makes sense"

If Pythonistas love puttign everything into functions "pascal style", why it's not called join(array, ";") or split(string, ",") ?

Stop defending this unlogical shit.
>>
>>58836489
I have to write in 8 languages and Python is the only one that does it. I didn't say it was stupid or pointless, it's just annoying
>>
>>58836489
>>58836592
>>58836602
I think the point is actually to have a universal way of finding the length of a collection.
When combined with other "protocol" methods like __getitem__, __iter__, etc. you can use custom collections with standard library tools.

Then again Queue has it's own method for some reason.
>>
>>58836489

>Why store it in a plain attribute when a user may want to ascribe a different meaning to the word "length"?


Totally!
Yesterday I wrote a function "array.length()" that does not return the length of the array (as in every programming language known to mankind) but the first element of that array.

It totally makes sense to not "pollute" the namespace, because who knows what Array.length could mean? Could be the length of the array, could be anything..

¯\_(ツ)_/¯
>>
>>58836592
Yep I am. I didn't claim anybody was wrong, I'm just pointing out that there is justification for Python's syntax. I didn't think it was shit at first, it was perfectly logical to me, but I'm able to recognise that different people have different thought processes leading to different preferences in language style, so others might not find it as intuitive as I.

>why it's not called join(array, ";") or split(string, ",") ?
Because that would further clutter the builtin namespace? Split and join always operate on strings, so it makes sense for them to be string methods.

I'm not sure why you have an issue with somebody defending something that they agree with, it makes it seem like you're simply intolerant of divergent opinions.
>>
>>58836702
>Split and join always operate on strings
To be fair split and join could easily be defined for any kind of sequence.
>>
>>58836668
But not all objects are arrays. For example I might have an instance of a voxel for which I want the "length" attribute stores one of the dimensions in metres (whereas __len__ = 1).
>>
>>58836749
True, but I can't imagine many situations where you'd want to use join with two sequence types.

Being able to split a list would be useful, I've had to implement my own function to do this (although that's because I was avoiding numpy).
>>
>>58836602
It is stupid and annoying.
>>
>>58836759

I think you don't get the point..

Methods overwritten by default:

len("test")   # 4
len(["test"]) # 1


And you course you can do this:

def len(a):
print(a)

len("test")



So it's not about "namespaces", it's about the way they structure syntax. You can overwrite the "native" methods:

class test_it:
def __len__(self):
return "hey"

a = test_it()
b = "test"

print(a.__len__())
print(b.__len__())



So there is just no point in having this syntax..
>>
>>58836113
ansible i suppose.

the lag as you deploy a runbook across 100's of machines is ridiculous
>>
>>58836968
That lag has nothing to do with Python and is mostly waiting on network resources.
>>
>>58830440

strings are iterable

also, a character is just a special kind of string.
>>
One of my beefs has to do with the way binding works
fs = []
for i in range(10):
def f(n): return i+n
fs.append(f)

This creates an array of functions that I'd expect to be characterized like so: fs[i] is a function which takes one arg and adds it to i.
Because of the way binding works in python though, i doesn't get evaulated until the function is run and each of those functions has the same i which is 9 after the iterator is done
so something like
[f(4) for f in fs]
results in
[13, 13, 13, 13, 13, 13, 13, 13, 13, 13]


To me, this looks a lot like the functions having access to a variable that's outside their scope and it feels like closures are just plain broken. Although I know it's mostly just a different design then I'm used to.

This is more than a little annoying in the admittedly rare case when it comes up. I've stumbled across it twice in actual usage in python (and, interestingly enough, once in actionscript which suffers from the same weirdness).
This is remedied by forcing the i to be evaluated at the time the function is created instead of when the function is run:
fs = []
for i in range(10):
def f(n, i=i): return i+n
fs.append(f)

(the same issue in actionscript was not as easy to remedy)
>>
Python is cool until you want to use multiple threads or multiple processes for anything. Don't even bother with the shit GIL.
Big data is also situational. For a machine with 64GB of RAM, Pandas struggles with data over 100M rows. Haven't checked with hdf5 since mid-2016.
Python objects make sense but the imports are fucking stupid. Shit like import module, and from module import somethingelse.

It's not optimized but hell its easy and it just worksâ„¢.
Oh, and python3 > python2
>>
>>58836962
>Methods overwritten by default:
Sorry, I don't see what you're getting at with this example. The length of the string "test" is 4, and the length of a one-element list is... 1. In which way is any method "overwritten by default"?

>You can overwrite the "native" methods... So there is just no point in having this syntax..

If I'm understanding you correctly, you're saying that the lack of protected names means it's useless to have the awkward __len__ convention?

That misses the point of __len__, and all the other so-called special methods: they all have one expected outcome by *convention* rather than it being enforced by the language. You can of course make __len__ return nonsense, but there's a social contract amongst python programmers that you won't violate the expected behaviour. This makes it easier to "guess" how to interact with any given object, while leaving the objects (un-underscored) namespace completely free for whatever you want.

It's all part of Python's principle of explicit over implicit. If I call __len__() (via len()) I know exactly what to expect from a sane object, whereas the result of length() is more ambiguous for the reasons I highlighted in >>58836759
>>
>>58830440
Neutered functional programming. List comprehensions can quickly become a jumbled mess. Disgusting metaprogramming.
>>
>>58837241

Also, people writing decorators that are way too complicated. Some of them can be called with or without arguments and can annotate functions or classes. It's hard to know in advance what a decorator is going to do.
>>
>>58833856
There is virtually no point in multithreading that cannot share state, aside from some web-memes with their beloved (((functional))) approach. CPython's GIlock sucks flaccid cock, and it's too influential on the standard, so reference cannot just proclaim variables thread-safe in next python version.
>>
Python is way fucking easy. But that's how programming languages SHOULD be. We need more languages like Python and Ruby, where even an idiot who doesn't know how to code can quickly learn them and start writing programs. Ideally, you'd want the language to automatically handle all the difficult shit, the only thing the programmer needs to do is say THIS IS WHAT I WANT IT TO DO, and it will do it. We're not quite there yet, but languages like Python and Ruby are a step in the right direction.
>>
>>58837241
>Neutered functional programming.
This is fully intentional on Guido's part, as he doesn't believe that a functional paradigm "suits" Python and results in ugly code that he'd rather not support. I don't know whether he's right or not, but clearly many people want certain functional features and so this is undeniably a weakness and a fair reason to hate Python.

>List comprehensions can quickly become a jumbled mess.
List (and set, dict etc) comprehensions are very useful, but everything they do can easily be done with a for loop. I think some people (such as myself) overcomplicate them because they're very used to them, so they find them easier to read and quickly understand their meaning than the average person does. Generally it's considered dirty to write multiline comprehensions.

I don't think it ranks up there with reasons people hate Python.
>>
>>58837379
>where even an idiot who doesn't know how to code can quickly learn them and start writing programs
>idiots should be writing programs

What's wrong with computer science: the post.
>>
>>58837408
the design of such a language is wonderful computer science. the people using the language don't need to be computer scientists to use it. Or are you the kind of person who lamented the move from punch cards because any idiot could now program without having to rewrite a bunch of shit when they make a mistake that can't be patched?
>>
>>58837379
You're quickly approaching NLP levels of complexity there.

https://en.wikipedia.org/wiki/AI-complete
>>
>>58837324
>multithreading that cannot share state
But they can. You can use all of Python's synchronization mechanisms including queues. Anything that can be pickled can be shared with queues.
You can also create a shared memory map if queues are not enough for you.

>so reference cannot just proclaim variables thread-safe in next python version
What does that even mean? I am not aware of any language that has thread-safe variables.
>>
>>58837408
I'm a jobless autist whose sense of self-worth is derived entirely from writing fizzbuzz in convoluted languages: the post
>>
>>58837408
You're against the transfer of creative power from a small highly educated elite to the wider masses?

Do you also think the proliferation of FL Studio has brought about the death of music?
>>
>>58837324
http://www.laurentluce.com/posts/python-threads-synchronization-locks-rlocks-semaphores-conditions-events-and-queues/
>>
what is the best new language and why is it HACKlang?
>>
>>58837555
best new language is saturn
>>
>>58837379
A programming language doesn't teach you shit like algorithms, optimization, sorting methods, trees, etc.
>>
>>58837468
>>Anything that can be pickled can be shared with queues. You can also create a shared memory map if queues are not enough for you.
And I don't like it, since i don't want it to be pickled, or synchronized without my direct order. Shared memory map is restricted to basic types, or wraps with a lock, am I right?

>>What does that even mean? I am not aware of any language that has thread-safe variables.
Almost all compiled languages make no restrictions in this case. I can fork ten times and shit in single array\class\do whatever I like, malloc is thread safe, and everything else is up to me - wich is good, in my opinion of course.

>>58837523
you do realise threading are not threads, right? And, yes, I'm aware of python reference, thank you.
>>
>>58837587
And those are necessary for a lot of programming. However there's also a lot that can be done by someone who doesn't care about all that and just wants to hammer on things until they work. I'll go as far as saying that it's an inferior kind of programming but it's still legitimate for many people and situations.
>>
>>58830440
The classes work like dogshit and it uses a programming paradigm that went out of style the second C++ became a thing. Incremental coding is ridiculous to maintain at any large scale. I'll admit that Python is a decent language for small-scale work, like a small script, but for large application programming in a team setting you're better off using a program designed with actual Object-Oriented design in mind.
>>
>>58837555
>>58837563
best old language is lisp
>>
>>58837631
I don't think lisp has it in it to dethrone latin
>>
>>58837627
>The classes work like dogshit
How so?
>it uses a programming paradigm that went out of style the second C++ became a thing.
What?
>you're better off using a program designed with actual Object-Oriented design in mind.
In which way is Python not designed with OOP in mind?
>>
>>58837193

This would work:

fs = []
for i in range(10):
def f(n): return i+n
fs.append(f)

for i, func in enumerate(fs):
print(fs[i](4))


But yes, Ruby is simpler here:

(1..10).each do |i|
define_method("add_#{i}") {|j| i+j}
end

puts add_3(4)



>>58837213

> You can of course make __len__ return nonsense, but there's a social contract amongst python programmers that you won't violate the expected behaviour.

This doesn't make any sense.

So basically the resaoning is as follows:

-we need a method for the length of things, let's call it "len()"
-but wait, if we just call it "Array.len()" you can overwrite it!
-so we need an ugly method called "__len__()" that's not intended for usage (threfore the ugly name), so nobody overwrites it
-we also invent a syntactic sugar version (which should be used) called len(Array)
-it's OK to overwrite len(Array) and break existing code (because nobody uses "Array.__len__()"), because at least there is still a pure function "Array.__len__()" somewhere hidden in the langauge.. :^)

Wait, what?!?
>>
>>58837599
>And I don't like it, since i don't want it to be pickled, or synchronized without my direct order.
It's pickled when you put it in the queue. That seems like a direct order to me.

>Shared memory map is restricted to basic types, or wraps with a lock, am I right?
Memory maps are restricted to primitive types, correct. It does not wrap with a lock, you can access and write to it from as many processes as you want at the same time.
If you want to share complex arbitrary objects there's a concept called Manager which handles that for you.

>Almost all compiled languages make no restrictions in this case. I can fork ten times and shit in single array\class\do whatever I like, malloc is thread safe, and everything else is up to me - wich is good, in my opinion of course.
I am still not sure what you're trying to say. The only restriction there is that only one thread can execute Python opcodes at a time. You can fork a Python process and it will have the same copy-on-write semantics as any other process. Everything you do in the forked process is "safe". You need to explicitly declare an object or a piece of memory as shared if you want to share it between processes.
>>
python is shit, but the huge amount of libraries make up for it.
>>
>>58836436

Underrated. Most peoe here it seems like dont have to deal with managers aaking why that shit wasnt done a week ago.
>>
>>58837682
>
for i, func in enumerate(fs):
print(fs[i](4))

Upon further investigation of this, I'm left horrified. I had thought that after years of usage I understood how scope works in python but now I'm questioning that.
>>> fs = []
>>> for i in range(5):
... def f(n): return i+n
... fs.append(f)
...
>>> i
4
>>> fs[0](3)
7
>>> i = 999
>>> fs[0](3)
1002

Why is the i even accessible outside the iterator? Why is the i accessible outside the iterator the i that those functions see? Am I doing something wrong that is breaking scoping rules or are there just not any?
>>
>>58837682
No, I don't quite think you get it. Your first four points are ok*, but then your reasoning goes wrong.

It's _not_ okay to overwrite the builtin function len(). You can, but should never, fuck with it, and nobody ever does.

*If you're writing you're own class then you have to implement the __len__() method yourself (unless you inherit it) so I don't know what you mean by "not intended for usage".

I think part of the issue is that you're confusing functions with instance methods.
>>
>>58837754
>>It's pickled when you put it in the queue. That seems like a direct order to me.
It is, but I don't like the fact that Python reference makes me to pickle stuff in order to share it in the first place.

>>there's a concept called Manager which handles that for you.
Is it part of the reference or just a common pattern?

>>You need to explicitly declare an object or a piece of memory as shared if you want to share it between processes.
And as you said earlier, such declaration comes with restrictions. And those restrictions are what I complaint about. I'm used to not having them. This makes python unfeasible for me when I want multiple workers one data flow, which I've previously encountered multiple times. The better question would be, why the fuck i'm expecting shared memory that is used for performance in scripting language.
>>
>>58837784
And I just keep getting more and more confused
>>> i = "hello?"
>>> for i in range(5):
... pass
...
>>> i
4


I would expect the iterator to not touch global scope. Does python not have scope?
>>
>>58830440
Because it's a scripting language people have pushed into service for things far beyond its originally intended use. Similar to the hatred for javascript.
>>
>>58837784
I think you found a bug in the compiler. :^)
>>
Im working in the R&D Department of my company. Python is being used heavily. People with actual stuff to do don't Care about /g/s autist Arguments.
>>
>>58837909
Numpy is not Python.
>>
>>58837784
here's some lisp for fun:
CL-USER> (defvar *fs* (loop for i upto 4 collecting (lambda (n) (+ i n))))
*FS*
CL-USER> *fs*
(#<CLOSURE (LAMBDA (N)) {1005D3B77B}> #<CLOSURE (LAMBDA (N)) {1005D3B7AB}>
#<CLOSURE (LAMBDA (N)) {1005D3B7DB}> #<CLOSURE (LAMBDA (N)) {1005D3B80B}>
#<CLOSURE (LAMBDA (N)) {1005D3B83B}>)
CL-USER> (loop for f in *fs* collecting (funcall f 3))
(8 8 8 8 8)
>>
>>58837784
>Why is the i even accessible outside the iterator?
Because it's sometimes useful to be able to retrieve the last "i" after you break out of a loop.

>Why is the i accessible outside the iterator the i that those functions see?
You created a function that uses the "i", you later changed that "i".
You can create a factory function that returns a function and pass the "i" as an argument to the factory.

>>58837859
>Does python not have scope?
Python has module and function scope

>>58837840
>It is, but I don't like the fact that Python reference makes me to pickle stuff in order to share it in the first place.
It's really not much different than using pipes to send any kind of data between C programs.

>Is it part of the reference or just a common pattern?
https://docs.python.org/3.6/library/multiprocessing.html#sharing-state-between-processes

>And as you said earlier, such declaration comes with restrictions.
There are no restrictions in terms of what you can share compared to a C program.

>multiple workers one data flow
Sounds like you want a queue.
>>
>>58837929
I would have said numpy then
>>
>>58837784

That's what I'm saying.
Python is simple on the surface but nasty in the details..

It's like "Bizarro C".
>>
>>58830440
>Why is it so hated?

Significant white space.

They discovered back in the 1950s that significant whitespace is a bad idea.

Notice that all the languages designed by the truly "wise elders" of programming never used significant whitespace. Kernighan/Ritche, Niklaus Wirth, John McCarthy, etc.

We get significant whitespace in languages whenever someone who is not familiar with language design issues ends up creating a language (on his own -- always on his own), and then through accident that language ends up getting popular. JavaScript, Python, etc.
>>
>>58837946
>>It's really not much different than using pipes to send any kind of data between C programs.
You don't need to communicate between C threads. In some cases you don't need synchronization primitives at all, it's fine lockless\atomic.

>>https://docs.python.org/3.6/library/multiprocessing.html#sharing-state-between-processes
well, yeah.
https://stackoverflow.com/questions/13121790/using-multiprocessing-manager-list-instead-of-a-real-list-makes-the-calculation
>>Something that might speed things up a bit is accessing more than one element at a time(e.g. getting slices instead of single elements)...
Literally cannot manipulate one array from multiple threads simultaniously =(

>>There are no restrictions in terms of what you can share compared to a C program.
There are restrictions in the way I share.

>>Sounds like you want a queue.
I don't. I need no queue, no mutex, no lock, no monitor, nothing. I have big ass array of objects, I have 10 threads, I want to process it there, in place, without copying, pushing, pickling, serializing... simultaniously by 10 threads. In python. currently, I can't.
>>
My only beef with Python is the white space and mass of incompetent programmers running around "learning Python"

The language itself gets the job done. That's all that matters
>>
>>58837446
>the design of such a language is wonderful computer science
Python isn't all that and a bag of chips. It's got some good points, some really bad points, and isn't any more productive than other high level languages. (With the caveat that ANY language is super productive if it has the exact libraries you need because nothing is easier than someImportedLibrary.solveMyProblemForMe() )

There are some problems that map to very concise and clean Python code, and some that look like shit in Python. Overall I don't think Python deserves nearly the recognition or focus that it receives. It's kind of the modern VB6 but without the compact IDE and GUI builder. It's babby's first language so babby promotes it.

> Or are you the kind of person who lamented the move from punch cards
>>58837469
>I'm a jobless autist whose sense of self-worth is derived entirely from writing fizzbuzz in convoluted languages: the post
>>58837488
>You're against the transfer of creative power from a small highly educated elite to the wider masses?

Creating software is engineering. The problem is that the field is not held to the same standards as other forms of engineering because generally human life is not on the line when a program fails.

I'm not against CAD software for architects because architects STILL have to understand the basics.

I'm not against high level languages. But I am sick of every fan of every high level language telling normies "hurr durr it's so easy anyone can do it!" The field is flooded with insecure buggy shit code thanks to this.

I just had to edit a PHP form written by someone else that exhibits this exact principle. It was fucking spaghetti code with code duplicated every where. The programmer (Pajeet?) had no clue about OOP, no clue about how to factor functions into smaller units, no clue about anything. But PHP and web dev "is just so easy!"

THAT was my point. Software engineering should involve actual fucking engineers.
>>
>>58837946
>>58838057
also,
https://stackoverflow.com/a/9436866
>>
>>58837942
neat. I guess I have unrealistic expectations because I'd usually program this functionally in such a way that I'd get different i's for free.
#lang racket
(require control)

(define fs
(let ([i 0] [max 4] [fns '()])
(until (> i max)
(set! fns (cons (lambda (n) (+ i n)) fns))
(set! i (add1 i)))
fns))


> (map (lambda (f) (f 5)) fs)
'(10 10 10 10 10)


(4chan is going to fuck up this syntax highlighting so badly)
>>
>>58837784

fn = []
for i in range(2):
def f():
return fn
def g():
return 42
fn.append(f)
fn.append(g)

print(fn[0]()[2]()[1]())



Am I pythonic, senpai?
>>
>>58838057
>>58838090
>You don't need to communicate between C threads. In some cases you don't need synchronization primitives at all, it's fine lockless\atomic.
Sorry I kind of got carried away with the entire interprocess communication business.

If you can work without any kind of synchronization then you can run worker processes in parallel directly on their own chunks of data.
>>
>>58838041
>They discovered back in the 1950s
Back in 1950s there was Lisp, Fortran, Cobol...
It's not like there was a chance for significant whitespace language before Algol.
>>
>>58837859
You're outside of a function scope, therefore you're in the global scope
>>
>>58838221
Yes, but that chunk must be copied\created to the worker, and then returned back and merged when the work is over, and this fact is forced on me by python. Anyways, I think we understand each other, so I'll go.
>>
>>58838082
> Creating software is engineering.

This is incorrect. Programming is actually a form of sorcery whereby we conjure the spirits of the computer with our spells.
>>
>>58837784
>>58837859
I'm not sure how you've used Python for years yet fail to grasp the scoping rules. Have a read of various resources online because you should really have them down by now.
>>
>>58838116
Yeah, let over lambda would work.
CL-USER> (defvar *fs* (loop for i upto 4 collect 
(let ((i i))
(lambda (n) (+ i n)))))
*FS*
CL-USER> (loop for f in *fs* collect (funcall f 3))
(3 4 5 6 7)
>>
>>58837682
>>58837784
>>58837859
Is this what you want?
fs = [lambda x, i=i: i + x for i in range(5)]


The key bit being i=i, you can of course do it in a loop using explicitly named functions if you want.
>>
>>58838502
Aw, it fucked up my indenting!
>>
>>58837784
>>58837859
there's a class (including its methods) scope, a function scope, and a global scope.

you're using the interpreter and you are not inside a class or function, therefore you're in the global scope.

this is really, really easy stuff dude. day 1 stuff.
>>
>>58837398
>List (and set, dict etc) comprehensions are very useful

Only in languages that have crippled anonymous functions. Simon Peyton Jones has even said that monad comprehensions were a mistake in Haskell and barely anyone uses them over chaining combinators like map, filter etc.
>>
>>58838514
i.e. (with x changed to n):
fs = []
for i in range(5):
def f(n, i=i): return n + i
fs.append(f)

n = 10
fs[0](n) # 10
fs[4](n) # 14



Again it's the i=i that's key
>>
>>58838514
>using lambda functions in Python
>current year

please don't.
>>
>>58838589
What's wrong with lambda functions in 2017, especially in the simple use case there? Compare the brevity and readability of >>58838514 and >>58838577
>>
File: ackchyually.png (19KB, 200x200px) Image search: [Google]
ackchyually.png
19KB, 200x200px
>>58838623
I've read quite a bit of stuff from the core developers (Guido, Raymond, etc) telling people to avoid lambdas because they are harder to understand and read.

Example:
lambda x, i=i: i + x


No offense but this code is ugly as fuck. Sure it works, but again, it's ugly. It goes against one of Python's key goals (readability). This code looks closer to C than Python.

*gets off soapbox*
>>
>>58838623
Admittedly to compare them properly you'd write:
fs = []
for i in range(5):
fs.append(lambda n, i=i: i + n)
>>
>>58838672
> anonymous functions are hard to read
> map/filter/reduce are too confusing

I really hate Guido.
>>
I am waiting for Pypy for Python 3.5 so I can Django faster, it's slow as fuck in templates that involve many loops
>>
>>58838672
>>58838705
You're both misunderstanding the criticism of lambdas, but from opposite sides. Anonymous functions certainly have their place, and the examples in this thread are good ones. However anything much more complicated than that will need multiple lines which is not possible in Python. Instead, named functions can be used.

Similiarly, map/filter/reduce can all be replaced by comprehensions in *most* cases with a gain in readability (though obviously this is debatable). However, since list comprehensions are not lazy, map has it's place.
>>
>>58838894
map/filter/reduce are clearer and composable (list comprehensions are not). Composable functional abstractions should be preferred over syntactic abstractions.
>>
>>58838990
Clearer to *you*, not to everybody. If composition is not needed then comprehensions are preferred by most.
>>
File: 1484244824644.png (1MB, 960x1080px) Image search: [Google]
1484244824644.png
1MB, 960x1080px
>>58830440
I love it, Most comfortable language for actually getting shit done.
>>
>>58839099
>If composition is not needed then comprehensions are preferred by most.

Show me some data that supports this assertion. Haskell has comprehensions and on Hackage usages of map/filter outnumber comprehension usage over 10,000 to 1.
>>
>>58839211
I meant in Python, obviously.

Haskell programmers prefer different things to Python programmers. Neither is necessarily wrong, though I'd wager that the Python approach is less right.
>>
>>58830440

It's not hated, what is this meme?

I program almost exclusively in C++ and Python. Work is mostly C++ tho.
>>
File: dark_wizard_by_mlappas-d9adl69.jpg (97KB, 762x1048px) Image search: [Google]
dark_wizard_by_mlappas-d9adl69.jpg
97KB, 762x1048px
>>58838376
If some magic spells actually work, does that mean the universe is a sim?
>>
>>58837379
I don't see how someone on /g/ could express interest in such a programming language. I mean, I have nothing against making a language that is easy to use for normos, but that would probably mean the language isn't that good at more advanced tasks, because simplicity would be achieved at the cost of losing advanced features. And simplicity would have to be achieved through losing features, after all, most programming languages are just repackaging the same concepts, and it's not the language that's hard to learn, but the concepts themselves.
>>
>hate python
>best friend's mom is on the board of developers for python
>need connections to industry
>have to pretend to love python
Help me /g/
>>
>>58835287
Python is the new perl.
Ifnperl was readable, there's no need for ython.
>>
>>58839564
Fake it.
>>
sometimes it seems like python is an interpreter and not a language standard
>>
>>58830440
I use it for small hobby projects, pretty good better than VB IMO
>>
>>58830510
Kinda this

Its miles easier working with third party frameworks with python than with other languages.
>>
>>58830440
>Why is it so hated?
It's mostly OK for hacking something together quickly that lets a user get shit done without needing an expert programmer. But the problem comes next.

Python's shit for supporting long-term projects (more than a couple of weeks). Everything gets annoying and difficult. So users turn to an expert, hand over the stinking pile that they vomited out in a hurry without thought of any software engineering principle ever, and say "this works, keep it working now forever more and for peanuts". There are other problems too, but the dissonance between the ease of hacking and the difficulty of maintenance is the really big problem.
>>
>>58840593
Also, if another retard decides that passing around undocumented kwargs is good API design, I'm going to punch that motherfucker in his smug face so hard that he'll be able to combine dental appointments with trips to the proctologist.
>>
>>58839564

Try to take the opportunity and let the hate be your fuel.

Pretend you really love python and get into work. Then turn them around, one by one. Start slowly, maybe mention that Scheme is really easy to understand if you are a Pythonista. Or say thatyou find it remakable how much better your python got once you programmed in Go. Just make them curious. Then you slowly introduce other languages in your python programs. Maybe an innocent little piece of C code within a FFI from Python? Let them get the taste of it. Then have a beer with some coworker and tell him that you were better of with [language he likes]. Tell him that you would like to tell your boss but you are afraid he won't listen to you alone..

Maybe they will notice evnetually, but the damage will be done, once the had the sweet taste of a good programming language, they will start to like it. Destroy Python from the inside, like a snek.
>>
File: maniac.jpg (33KB, 703x602px) Image search: [Google]
maniac.jpg
33KB, 703x602px
>>58839189
WHAT A FUCKING CUTIE!!!!!
SOURCE?
>>
>>58835066
>they've turned the website into a barely usable mess

I don't think we're using the same Youtube.
>>
>>58830440
Python is a shitty language that happened to have its coming-of-age at the perfect time. It is by no means well-designed, but it reads very simply and has a relatively straightforward mapping from pseudo-code to actual implementations.

Here are some of Python's problems:

Method names are unintuitive, the core library doesn't really establish when behavior should be a method or a function, but rather uses both almost interchangeably.

The Python 2/3 split is ridiculous. This shouldn't be an issue. This is more of an insult against the Python community than against the language.

Python has hacky support for multiple dispatch (if you are opened minded enough to se what multiple dispatch looks like when done correctly, look at Clojure's multimethods, CLOS, and Common Lisp's generic functions.)

Python has a crippled lambda, making it very difficult to do anything functional-esque, even if that paradigm happens to solve your particular problem well.

Indentation being significant is a bad idea. It does not effectively communicate where blocks of code belong, and does make it harder to read. This isn't that major of a deal, but it is a preference that I have.

Most of Python's implementations are slow, black-boxes, that make them useless for any interesting problems. The GIL is a joke, granted it is necessary because it is 2017 and Python has very little support for concurrency primitives that are actually useful. Contrast this with Clojure, Go, and even Common Lisp. Much more high-quality implementations, much more useful concurrency primitives.

Python's type problems are very deep. Other dynamically typed languages (Common Lisp via
check-type
and
(declare (type type-specifier symbol-name))
, Clojure with its new spec system, and Racket with contracts) have enabled you to do essentially the same thing that most type systems do (aside from some powerful ones, like Haskell's) while retaining runtime type
>>
>>58835363
No I was saying what kind of things do you have to be able to do. Not what languages and Frameworks do I need with it.
>>
>>58835922

>>indents are part of syntax
literally nothing wrong with this
>>
>>58841625
>except 3rd party tools processing python source now have to keep track of indentation level, rather than just pushing/popping a brace from a stack

Code monkey Python users, who have never written anything of sufficient complexity before in their lives, everyone.
>>
>>58833793
This is simply untrue.

You are lying or you did not code long enough in python.

Its truue that there is a loc on C implementation but threads problem was solved long time ago
>>
>>58833100
just use pypy you faggot
>>
>>58841707
what threads?

Most implementations have a GIL, so only one thread is actually executing at a time.

Plus, threading support is more than just 'do we have threads and locks?' Channels, monitors, STM, etc. are all fantastic tools and Python lacks proper support for that.
>>
>>58841688

>20 extra lines have to be written in a python interpreter, therefore python is bad
>>
>>58841775
Those 20 extra lines are not as innocent as you would think, when you consider the fact that you have to handle spaces and tabs. Suddenly, you can get into ambiguous situations where something is __displayed__ by your editor in the correct indentation, but is in fact not.

Nice try.
>>
>>58841815

>Ever using tab characters

>Being so retarded as to use tabs and spaces simultaneously

>Having a shitty editor that doesn't display tabs and spaces differently

>Thinking this happens nearly as often as omitted curly braces

You have to be trying really fucking hard to goto fail in Python.
>>
>>58830440
bc too many people on /g/ dont have jobs :^]
>>
>>58830440

It's better than perl
>>
the easiest language is the one that hasn't been colonized by Pajeets
>>
>>58841885
I don't do this. But people do. If you deny this, you are a retard. Are you a retard anon?
>>
>>58831844
Perl 6 is art
https://github.com/andydude/p6-c-parser/blob/master/lib/C/Parser/Grammar.pm6
>>
>>58841428
>Here are some of Python's problems:
You didn't mention just how big a mess the module system is. Or the many ways of doing docstrings. Or the contortions needed for decorators.

Lots to hate, so little time...
>>
File: art.jpg (19KB, 350x232px) Image search: [Google]
art.jpg
19KB, 350x232px
>>58843125
>Perl 6 is art
"art"
>>
>>58841625
you're fucking retarded mate
>>
File: 1111.jpg (10KB, 203x248px) Image search: [Google]
1111.jpg
10KB, 203x248px
>>58843125
>>
>>58843125
The Perl5 grammar module is even better
https://metacpan.org/pod/Regexp::Grammars#SYNOPSIS
>>
>>58830866
>though
when I saw it
i didn't look @ the 'simple'
i saw the 'powerful'
>>
>>58837198
post from someone who has used it for about 5 minutes (typical here)
>>
>>58843285
>not an argument

Nah, you're a cunt. Kill yourself.
>>
>>58830569
This.

End thread
>>
>>58830927
Are you dumb
>>
>>58830440

Only autists who don't know what it's for hate it.

It's an interpreted scripting language, it's not meant for fuck-huge 1M+ LoC type of projects. It's meant for quick, easy scripting, readability, and prototyping proof of concept kind of stuff. I was talking to some guy who worked in the industry awhile ago, and he mentioned that the place he works at they literally code everything in Python first, as a prototype, and then if and only if performance is a big issue, they will re-do it in C. The libraries are plentiful, and there's one out there for just about everything you can imagine. And the built-ins are amazing on their own.

I think the big problem is, is that because it's a language that's often touted as being 'beginner friendly' so a lot of people who are beginners start off with it, and write dog-shit code with it. There's still a hell of a lot to learn, even with a 'simple' language like Python, that requires a deeper knowledge of what's going on under-the-hood if you want to avoid writing Pajeet-tier code.

>>58831426

Print was actually an operator in Python2, much like del still exists in Python3. When you think about it, changing it to a function call actually makes a hell of a lot more sense, and fits in with the theme of the language a lot more. Brainlets who don't understand cohesiveness will complain, but who gives a fuck about what brainlets think?

>>58831933
Python does have += you fucking idiot.
>>
>not even the python language is written in python

Kek, even the developers know its a shit
>>
>>58844857
PyPy seems to be written in python. Even if it is only 2.7
>>
>>58844857
Moron.
>>
>>58844912
no, PyPy has supported Python 3 for quite a while now
>>
>>58830440
Because this is 4chan and you are cool on 4chan if you dislike things that are popular. There is this "redpill" zeitgeist on this website that the masses are always wrong and there is superiority in "thinking for yourself". Except there is no thinking for yourself you just trade which camp you blindly follow. If you leave the internet you might find that no one hates python. Its just one of those fake internet problems that seem like a big deal if you never leave your house.
>>
>>58830654
how are you only making $50k as a software engineer?! I got a sw job with a physics degree and I started at 72
>>
>>58830440
what about boa
>>
>>58833856
did you start this thread just to cheerlead your favorite programming language? and by that i mean the only one you know?
>>
>>58848151
Does it make you feel better to know you're an insecure douche?
>>
>>58833856
>You can also very easily create a process pool and submit long running cpu intensive tasks to it if you need multiple cores.
How do I do this?

Say I have access to a cluster of machines that can ssh into one another, each with two spare cores. Which module is best to run processes on them all?
>>
>>58848151
python seems pretty cool though, now that version 3 is popular its probably worth using
>>
>>58830440
people who don't know it
>muh indentation
>muh performance
people who do use it
difficult to distribute
cpython
not well thought out type system
not fit to do job X but it's being used to do job X because it has the library and user base for it
>>
>>58830440
Because sneks are scary
>>
>>58849233
and cute
>>
>>58849227
>not well thought out type system
What are criticisms of the type system?
>>
>>58830440
So Python-bashing is a thing now.
>>
I used to hate Python too prior to starting work in the GIS field. Now I code in Python everyday cause that is what QGIS and other GIS software use. At the end of the day, you code with what you like at home and you code with what your boss tells you to at work.
>>
>>58849252
Mostly that it's a dynamic language, but it encourages you to program in such a way as though it were statically typed. It doesn't support multiple value dispatch well.
>>
>>58830440
the only problem I have with it are indents, otherwise it is cool
>>
>>58850993
>it encourages you to program in such a way as though it were statically typed.
What?
>>
>>58830749

The only reason to use node is because you did so much client side programming that js rotted your brain and it's now the only way you can get anything done.

Obviously there are a lot of these pitiful creatures and they do actually create some useful things in node, but lets not increase their numbers. No one deserves that.
>>
>>58851206
The object model is rigid and doesn't support missing data well.

Contrast it to CLOS, CL's defgeneric, Racket's contract system, Clojure's multimethods, Clojure's spec system. If you don't know these systems, you won't see the problem.

The whole **point** of dynamic typing is to leverage types at runtime. Python does not encourage this style, and so it may as well be statically typed. Its dynamic typing buys you nothing.
Thread posts: 304
Thread images: 16


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.