[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]

Why isn't Python used instead of C in literally everything?

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: 81
Thread images: 12

File: py.png (8KB, 200x200px) Image search: [Google]
py.png
8KB, 200x200px
Why isn't Python used instead of C in literally everything? I get that it's 10 times slower in running some tasks but isn't it 10 times easier and quicker to write? Give me one program that can be written in C but not in Python.
>>
>>57235130
>I get that it's 10 times slower

Well there you go.
>>
>>57235130
When your program is time/resource critical 10 times worse is unacceptable
>>
>>57235130
Sometimes making things 10 times faster is worth having to spend ten times as much time. Everything CAN be written in Python or Node.JS or whatever, it's just that they shouldn't be. It also introduces at least one additional layer of abstraction that can break your shit. You don't want to write drivers or kernels or production servers in Python, fucking trust me on that.
>>
File: 1463889469553.png (426KB, 635x640px) Image search: [Google]
1463889469553.png
426KB, 635x640px
>>57235130
but c is used for speed and where size matters, anon
>>
>>57235130
10 times is pretty fucking optimistic. Often it's more like 100 times, especially when you have to write actual algorithms and can't rely on precompiled python frameworks (which are mostly written in C, by the way). So just imagine any program where performance matters. You want to use something more low level in those cases.
>>
>>57235130
Half of python's libraries are implemented in C and interfaced with with ctypes.
>>
Name ONE single feature Python has that Racket lacks.... I honestly would be curious if there's a single one
>>
>>57235130
>writing a kernel/os in Python
i want to see someone do this
>>
>>57235130
The python interpreter. There's your example.
>>57235223
Infix notation.
>>
>>57235223
Name ONE single feature Racket has that Python lacks.... I honestly would be curious if there's a single one
>>
>>57235310
Built-in carpal tunnel syndrome.
>>
Pythons strength is that yes, it is easy to write.
That is the sole strength. It's great for data scientists who don't care about speed or flexibility, they just want to write a script and leave it alone to crunch a shitload of data.

For everything else there's always a better choice
>>
>>57235234
Give it 10 years and you'll have both in JavaScript.
>>
>>57235212
The problem is that the very philosophy behind the language makes it slow. You don't want to deal with memory? Fine, everything is managed for you. What, that makes everything 100 times slower? Well, that's the price you pay.

I once had a script that caused about one hour 10 minutes of runtime just because the memory management behind the language was so goddamn retarded. Then I changed a tiny little bit according to what I knew about the interna, and suddenly we were at 5 minutes runtime.
>>
File: img000014.png (689KB, 1046x1500px) Image search: [Google]
img000014.png
689KB, 1046x1500px
>>57235197
>small, fast
>whoever writes c code is surely a microdick premature ejaculator
>>
>>57235416
Humbly requesting sauce.
>>
>>57235330

R is easier for Data Science desu

but any ML I've seen in production has been in Java
>>
File: tsugumi butt on.gif (774KB, 500x281px) Image search: [Google]
tsugumi butt on.gif
774KB, 500x281px
>>57235433
S.E. (Software Engineer)
>>
>>57235351
>runs slow on a 10ghz processor
>c equivalent would run fine on 3ghz
>b-but we saved like 300$ since it took less time to make!
>>
>>57235351
We already have something like that in JS:
>http://bellard.org/jslinux/

This guy has too much free time.
>>
dumb thread
>>
>>57235310
TCO and threading. (to be fair, python the spec has little problem with either. python as implemented does)
>>
>>57235351
my nigga wait 100 years and you will have html doing <kernel> <kernel>
>>
Can someone explain to me why people use django for backends?
Never used it but since python is so slow shouldn't it drastically kill performance? Or the c modules save the day?
>>
>>57235310
>homoiconicity
>number tower
>proper macros
>tail call optimization required by the spec so you can actually use recursion
>no GIL :^)
>>
>>57235531
Cheap, easy to prototype and deploy, relatively scalable if not huge, and requires nothing more than basic jr. devs. Everyone knows or can learn sufficient python for that, have an intern work on it.
>>
>>57235310
Threading & channels
Pattern matching
Parameters (dynamic bindings)
Interned symbols
Lambdas & closures that arent shit
Built in fractional type
Regexp literal syntax
Most importantly:
Macros & continuations

>>57235306
Racket has infix notation
>>
>>57235130
> 10 times slower

It's much closer to 100 times slower and 100 times more inefficient in terms of power use. If everything was written in Python your laptop and phone wouldn't get more than 5 minutes of battery life.

Also nobody writes anything important in dynamically typed languages lmao
>>
>>57235310
Decent abstractions and good metaprogramming.
>>
>>57235531
99.9% of websites will never have the traffic where performance ever becomes an issue. Your shitty little websites with 100 concurrent users could be written in bash and still run on a single server with minimal load.
>>
>>57235310
Good OO.
>>
>>57235130
I write simulations in C++ that can sometimes take weeks to run. No way am I doing that in Python, they'd take a year.

I've been using Julia for some recent stuff, fast and matrix friendly (friendlier than Python, even with numpy).

Also I just don't like Python. Sorry.
>>
>>57235351
>Zuckerberg and Gates are investing millions into Africa and India just so we can potentially get a JavaScript/php operating system some day
>>
>10 times slower
more like 30.
And that's your answer.
>>
>>57235758
>Julia
My nigga
>>
>>57235746
Yeah i know that, i was wondering if there are companies where they have actualy load using django and thinking that the added cost is a good trade for for a faster development.
>>
>>57235531
You wouldn't use django to build a Twitter or Facebook scale app, but an internal app for 10,000 people in some random company, fuck yeah django or rails.
>>
>>57235806
sorry for the fucking pajeet tier english but i am very tired
>>
>>57235223
Turtle!
>>
>>57235758
>>57235788
Talking about julia, are there any jobs looking for it? And what kind of jobs?
>>
>>57235839
http://docs.racket-lang.org/turtles/index.html
>>
>>57235130
Because compared to C it's slow as fuck. Optimization is more important than anything when it comes to system and OS programming. Sure you can make shitware and gayms in python but it will only be good until a competent programmer writes the same shit in C or another better language, for example C++ is used for cross platform applications and performs better than python. Python is useless for anything other than teaching how to code.
>>
>>57235871
I don't know. Probably not while it's still pre-1.0. But I'm a postdoc, and can use whatever tools I want as long as I get the job done.
>>
>>57235130
if you have even a modest amount of experience then Python is often slower to develop in because developing without static types is just fucking awful

a better question is why Python users don't prefer Cython for literally everything
>>
>>57235806
Lots of very popular websites are written in slow frameworks like Django or Rails. Instagram is a Django app for instance.
>>
> Supported Python for some time in my job.

> Python starts showing limitations handling big data

> Slow as fuck, unless spend a significant amount of time doing fancy to decorate the code.

> Never again.
>>
>>57235130
It's more like 50x - 500x slower. Even PyPy admitted they are only ~7x faster than CPython on average. That might fly with some webshit, where the real work is done in a software written in C++ and supported by a bilion dollar JIT compiler for a less dynamic language.

>Give me one program that can be written in C but not in Python.
A mediocre 2D game with even a modest number of particle effects.
Anything regarding visuals or sound or a big number of elements of anything.

> 10 times easier and quicker to write?
Not necessary. Python isn't even so great language wise, but it's a nice layer of tools & automation over C, like garbage collection, proper strings and data structs and all kinds of libraries.

As it comes to things like manipulating raw memory or game development where the libraries are sorely lacking it becomes a pain in the ass. Without Qt, it would even be a pain in the ass for GUIs.
>>
>>57235130
A kernel that's not a joke.
>>
>>57235450
The problem with R is that it is really slow and memory-consuming. Sometimes is worth to write code in C to do some tasks.
>>
>>57236080
This is literally why Julia was invented: fast technical coding, without dipping into C.
>>
File: 1477369192669.gif (844KB, 200x150px) Image search: [Google]
1477369192669.gif
844KB, 200x150px
>>57235954
>he doesn't know about Hardoop
>>
>>57235758
>simulations that take weeks to run
>on c plus plus

ur lying , i write neural networks tht process millions of data and they only take 48 hours max on python , ur full of shit or ur somekind of data scientist or some shit , what kind of simulations?
>>
>>57237129
>he thinks neural networks is the most demanding branch
>>
File: 1477279749053.jpg (15KB, 324x291px) Image search: [Google]
1477279749053.jpg
15KB, 324x291px
>there are devs in 2016 too stupid to leverage Cython for the ultimate combination of speed, functionality, and modularity
>>
>>57237129
I'm a mathematical epidemiologist. I was modelling disease spread and persistence times of different diseases (including Paratuburculosis, E. coli O157, and Bovine Viral Diarrhoea Virus) in a metapopulation of cattle herds. Among other things.

And paratuberculosis takes a *very* long time to die out.
>>
You know you can literally call C functions in python right ?
>>
File: 1475530032845.jpg (326KB, 2000x1859px) Image search: [Google]
1475530032845.jpg
326KB, 2000x1859px
>i'm a mathematical epidemiologist
>>
>>57236433
>hardoop
The fuck , idiot. did you mean hadoop?
>>
>>57237256
Also, when doing stochastic modelling you want to repeat the simulations many times to explore the likelihood of different events, so it's not just one single iteration, more like thousands.
>>
>>57237277
Wow it's like basically every other language with an FFI only it's shittier because Python is an objectively bad language!
>>
File: 1477424992885.png (176KB, 500x557px) Image search: [Google]
1477424992885.png
176KB, 500x557px
>>57237318
>Python is an objectively bad language
>>
File: topologizemyspace.jpg (92KB, 712x279px) Image search: [Google]
topologizemyspace.jpg
92KB, 712x279px
>>57237337
>t. brainlet
>>
>>57235596
>using the smiley with a carat nose
>>
File: 1477362433131.gif (456KB, 160x159px) Image search: [Google]
1477362433131.gif
456KB, 160x159px
>>57237350
>brain
>animu
>>
>>57236433
>Hadoop

The maybe-it's-a-java-thing-maybe-it's-a-data-thing-why-don't-these-projects-ever-work-like-they-were-marketed-thing that's literally dying before our eyes because it was a shit idea to begin with, because when everybody decided to get on board, Google had already determined that it was shit, and now everybody is scrambling to figure out what the fuck to do with their expensive-as-fuck Hadoop clusters, so they're turning them into giant data junk-drawers to store data nobody has a use for yet and calling it a "data lake", which is a neat idea, but holy fuck that's a lot of money for the HDFS because it's not just the hardware, Hadoop is really just for Hadoop people who pretty much have to come from a java background and it just seems kind of weird to stick java people into a data-ish dev-ops-ish role, maybe java people should have learned from EJB 1.0 that they can't stick so much fucking shit into a single technology for people to use and expect it to work out, Hadoop? That Hadoop?
>>
Because slow. Only reason you need. Also, when you need to do something low level.
>>
>>57235401
>You don't want to deal with memory? Fine, everything is managed for you
I'd totally be okay with managing memory if I could use the syntax and libraries of Python though.
>>
File: 1477438956023.jpg (15KB, 300x300px) Image search: [Google]
1477438956023.jpg
15KB, 300x300px
>>57238835
>when you need to do something low level
fuck that
>>
Because I want end tags, and GvR won't give them.

It's right there in the Python koan, "be explicit, not implicit". Give me my god damned end tags!!
>>
RACKET SHILLS FUCK OFF REEEEEEEEEEEEEEEEEEEEEEE

Nobody uses or wants to use it in industry because its a fucking meme language put together by Lisp autists who have no interest in making it business orientated.

The only place it will ever be used is in computer labs at schools and universities, and in your smelly basements.

Now either kill yourselves or fuck off.
>>
>>57235130
Python is a frontend language, it's made to be used to wrap stuff up and quickly and reliably compose a software. Performance critical stuff should be implemented in some lower level language like (but not limited to) C/C++, where you can manage whatever you need to optimize. What I don't get is why everybody wants to do all in one language. Learn different languages which have different purposes and use them together when it makes sense. Writing higher level stuff like desktop apps in C/C++ is a fucking nightmare compared to Python. The small binding overhead is negligible over the modularity you get for making the application useful on all necessary platforms.

tl;dr it's not good for everything, but it's pretty darn good at what it is for
>>
>>57239112
>What I don't get is why everybody wants to do all in one language.
They think that if they do that, they'll save their own time and energy by not having to learn two languages.
They are idiots and wrong, but it's how they think.
>>
>>57238855

You want to write drivers, JIT language interpreters, or anything that interfaces with the OS? You don't have a choice.
>>
>>57239205
I used C++ for all my modeling, and used Octave to call the C++ code with the right parameters, plot the data, and a few other matrixy bits that were far easier in a language with proper multidimensional arrays and plenty of linear algebra built in.

Now though I'm just using Julia from start to finish. Except for LaTeX to write about it ;)
>>
>>57235130

Is this a troll? You know that your standard library is fully compiled C?
>>
File: 1477352444780.jpg (20KB, 306x306px) Image search: [Google]
1477352444780.jpg
20KB, 306x306px
>>57239436
>implying I want to do any of those things
>>
>>57235130
Sometimes you need predictability. In certain situations, if GC is triggered it __could be__ the end of the world, i.e. autopilot systems, pacemakers.

Plus, it's debatable whether or not it's even _the best_ high level language.

>>57235190
Not true if it costs less to develop and maintain. Agreed that Python is generally not great at building highly reliable software though.

>>57235310
Metaprogramming, call/cc, TCO, an expressive lambda, and contracts.

You walked right into that one m8.

>>57235890
No. In today's world, developer time is worth more than machine time (in general.) Unless you _need_ to conserve resources, maximizing productivity and minimizing maintenance cost makes more sense for your organization.
>>
>>57240607
To be fair, Python has metaprogramming to a certain extent, there's no sensible use case for call/cc that I can think of anyways and enforced contracts are used in very critical cases (as opposed to implied contracts through docstrings). Lack of TCO is one of those things I dislike with Python. I think there's a branch in PyPy with people trying to fix this.
>>
>>57239112
Look at the current generation of developers. JS for frontend, JS for backend, >>57235508 , >>57235471
>>
>>57241100
It saddens my heart, but then again I can't guess if it's just ironic or genuine.
Thread posts: 81
Thread images: 12


[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.