[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 90 KB, 1080x803, IMG_6010.jpg [View same] [iqdb] [saucenao] [google]
15923416 No.15923416 [Reply] [Original]

And I am being absolutely filtered by Python. Whose idea was this shit? What an unholy mess.

>> No.15923441

>phd in physics
>using python
well, there's your problem. you should use a real language like c# instead of glorified scriptshit.

>> No.15923479

>>15923441
I have used CHADLAB for ages now and nothing compares. My job wants me to set up this new capability because they'd rather spend $20K paying me to figure out Python scripts than $1K for a CHADLAB license to do the same work.

>> No.15923491

>>15923441
Python is shit, but the support it gets and its libraries make it very useful for scientific applications

>> No.15923497

>>15923441
real physicists use C++, retard.

>> No.15923523

>>15923497
>real computer scientists use C++, retard
FTFY. Real physicists are in the lab fucking the C++ guys' girlfriends over an optics table.

>> No.15923534

>>15923491
It's also widely used in instustry. Switching to Python means a few awkward months, but a now you have the skills employers actually want.

>> No.15923546

>>15923416
Op, how the chaotic reality do you have a PhD in Physics and comes here bitch about Python of all languages? It has the least obscure syntax. Explain

>> No.15923575

>>15923546
Not OP, I'm a professional programmer and Python is what you get if cancer and AIDS had a lovechild.
>want to slightly change the logic of my program
>have to adjust the indentation to dozens of lines or else it won't work
vs
>just using brackets and fixing spacing later

>> No.15923596

>>15923523
>Real physicists are in the lab fucking the C++ guys' girlfriends over an optics table.

girls don't like broke dudes

>> No.15923607

>>15923416
don't worry, computer science is strictly for the chosen people

>> No.15923615
File: 33 KB, 610x655, 1702595469917.jpg [View same] [iqdb] [saucenao] [google]
15923615

>>15923416
In a normal society I'd say OP is trolling. Someone who has a PhD in physics must have an IQ sufficiently high to understand something as simple as python ... But unfortunately we do not live in a normal society. Acadummia is fucked up. Nowadays 90 IQ moron can get a physics PhD by writing some incoherent gibberish about diversity of transwomen in physics. OP being filtered by a beginner programming language for highschooler makes sense now. Just abolish universities already.

>> No.15923618

>>15923416
>>15923479
I'm in the same boat - learned to do comp phys on Mathematica in undergraduate mechanics and used that for years on a student license during grad school... but fuck a faculty license for that shit is a couple grand.

Had to force myself to learn Python this Summer and it's been a pain in the ass just recreating shit that I used to do in Mathematica. Getting better, but still a ways to go.

>>15923575
Yeah, the indentation thing is retarded. matplotlib is also fucking garbage. Anyone know if there's a better plotting library out there?

>> No.15923619

>>15923416
Learn a functional language, like F#.
Python isn't that bad if you develop a habit of annotating everything, but writing complex stuff is quite painful. Functional languages are concise and beautiful.

>> No.15923622

>>15923497
no, real physicists use fortran because they never learned to program and are just reusing code their doctoral advisor wrote 40 years ago

>> No.15923626

>>15923596
Why'd have to go there? That wasn't very nice

>> No.15923643
File: 8 KB, 445x303, rare_pepes.png [View same] [iqdb] [saucenao] [google]
15923643

>>15923615
True and real.

>> No.15923644

>>15923416
>Python

REAL physicist use FORTRAN !

>> No.15923648

>>15923615
Have you considered the possibility that python is just kind of a clunky, autistic language?

>> No.15923676

>>15923575
I'm amazed how you can write this without falling into a deep depression. But I understand it must be some self-deception mechanism you created. Go take a nap, friend.

Brackets are hard to read without indentation, any professional programmer would know that. So if indentation is necessary and sufficient one can get rid of brackets. A lowwit like you should either lurk or ask not-so-stupid questions, but you should not post any statement here, except perhaps something anecdotal you are sure of.

>> No.15923736

>>15923676
Just a comment then ending bracket so you know which is which

Void my_function() {
If(some bullshit) {
for(some more bullshit) {
for(even more bullshit) {

Blah blah blah

} //end of nested for loop
} //end of for loop
} //end of if
} //end of my_function

>> No.15923742

>>15923676
And zif you want to change something around for testing purposes, doing so with indentation wastes time

>> No.15923765

>>15923619
>Functional languages are concise and beautiful
choose one

>> No.15923769

>>15923676
I've worked with a lot of IDE's that'll automatically indent your code when you add brackets
I don't know how an IDE would even do this with Python
That being said I do actually like Python, took a bit to get used to though

>> No.15923779
File: 522 KB, 763x1168, image.png [View same] [iqdb] [saucenao] [google]
15923779

>>15923416
The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages.

>> No.15923782

I've never learned any programming language, I'm thinking of starting with python, what do anons think about this?

>> No.15923789

>>15923622
This is the real answer.

>> No.15923832

>>15923622
No, real physicists are importing their research advisor's code from Fortran to Python and C.

>> No.15923843

>>15923769
It's really not that complicated. If it's after a colon or inside parentheses, it autoindents.

>> No.15923904

>>15923416
Python is so shitty. It's what happens when you try to make a scripting language "super simple" but don't think ahead and fill your "super simple" language with ridiculous kludges as you tack more shit on. This is why it's such a mess of retarded gotchas.
You want one int? Here, it uses 7 ints worth of memory and might automatically be turned into a string, which will then throw a type error, because for some reason Python changes types automatically except when you stuff things into functions, where it expects you to anticipate the auto-bullshit it did to your memory.
Plus, bullshit about references and whatnot. Allegedly you can have a string, set another string to equal it, change one, and the other changes too. Because this dumbfuck language wants to hide "scary" pointers, but leaves you to deal with its shit when it decides your strings are actually just pointers to the same thing.

Get a real language, with actual pointers, like C. Or FreeBASIC. BASIC did the role Python does now, of being a newb teaching language, it's actually simple, even though, oh horror, you have to mark the end of if-statement blocks, with like, actual code. FreeBasic is just a modernised version (with static types, thank fuck). This thing won't give you any shit about pointers unless you use pointers. (Though you can look at arrays out of bounds, because there's no cowardly bounds checker or garbage collector to slow you down) It is simpler than Python, and about 1 million times faster. For learning, it has pointers, linking, compiler options, inline assembly, where python will teach endless streams of idiosyncratic wonky python-specific BS.

>> No.15923908

>can't pick up a basic programming language
just goes to show how low IQ physics phds are these days, no wonder progress in the field has come to a complete halt

>> No.15923910

>>15923546
i've been a programmer for 14 years and I struggle with python. The way packaging works is retarded too. It's a shame it's used so much in science, if it wasn't then python would have probably died long ago because there's nothing it does that any other language can't do, other than look horrendous

>> No.15923913

Python is pretty easy.

>> No.15923917

>>15923910
... I'll add that that that I think there's a difference between knowing a programming language and actually knowing a programming language enough to make real functioning software. A lot of people that say programming languages are easy are still on the initial ascent of the dunning kruger curve

>> No.15923927

>>15923904
>Get a real language, with actual pointers
I don't think this is really necessary for the majority of scientists. Unless they're writing low level libraries and stuff then they're going to have to learn a lot to be able to out-optimize the compiler of a garbage collected language when they're using standard data structures. Actual programmers should make the performant libraries for the scientists to use in some easier language. But yeah python is shit and I think there's better options. Even javascript would be better

>> No.15923933

>>15923782
Python is a very weird language so it might be slightly harder to transition to a different one but honestly there's no wrong first language. The hard part is learning how to learn a new language, and you only have to do that once. If you're interested in data science or ML you'll probably be using python anyway.

>> No.15923936

>>15923416
physics and programming are two different skillsets, it's no big deal. find a C developer and advise him on physics.

>> No.15923957
File: 1.01 MB, 1158x844, Screen Shot 2023-06-24 at 1.27.27.png [View same] [iqdb] [saucenao] [google]
15923957

Serious question: Is python easier than C? I already know how to code in C pretty well but I want to learn python. I'm an engineering student.

>> No.15923977

>>15923957
For small projects I'd say python is way easier, at least assuming you have the same amount of experience in it and c. It's when you need to have a large codebase or are doing something performance intensive that it falls apart.

>> No.15924059

>>15923676
You can do brackets and indentation though and it's very readable and very easy to modify because the indents aren't read - only the commas and brackets. It makes modifying parts of the code or inserting shit into loops much simpler.

Like >>15923736, but with indents for added clarity.

>> No.15924068

>>15923618
>matplotlib is also fucking garbage
This, holy shit this.

>> No.15924090

>>15923957
Knowing C (well) is about as good a foundation as you can have in coding. Learning Python, or any other high level language, after that should be fairly straight forward as it's more a case of learning the (base) libraries rather than how to write a program.

>> No.15924111

>>15923618
This, I had to take a unit of Python, matplotlib sucks.
As it happens, I am building a custom plotting library as a dll with FreeBasic. It's not meant to be super-advanced, but just to easily bring up a graphics window and plot arrays of doubles, for a friend's radio-occlusion model ling project. (X and Y co-ords, multiple data series allowed) Crucially will have X-axes that are overlaid, so e.g. one label axis applies to a data series, and another to a different series. That and I put a wrapper around the internal drawing functions.
Dunno if it has any appeal outside of my friend's thing.

>> No.15924120

>>15924068
I think matplotlib is great.

>> No.15924137

>>15923779
I'm more of a Haskell guy

>> No.15924151

>>15923575
I honestly cannot believe people have this indentation problem irl. It’s just another way of bracketing. Get a life.

>> No.15924153

>>15923769
Those indents typically come after a colon. Julia however…

>> No.15924176

>>15924120
plots look like crap and are a bitch to format, especially 3d plotting

>> No.15924182

>>15924151
>want to add another nest level
>bracketing - add a bracket at the start and end of the sequence
>indenting - go through and indent every goddamned fucking line

>> No.15924188

>>15924182
>move cursor to first line that needs indenting
>press 'V'
>press 'j' until the last line that needs indenting is selected
>press '>>'
Don't tell me you don't use Vim

>> No.15924330

Python 3 is in today. Its so gay and stupid tho
>>15923497
Its MATLAB and Java actually

>> No.15924335

>>15923416
Use fortran instead
OOP is a satanic evil

>> No.15924525

>>15923441
C# only run on the machine that will have monthly subscription to pay running OS on your own machine somewhere soon. I wouldn't invest a byte of code int othat language.

>> No.15924554

>>15924335
ForTRANS supports OOP

>> No.15924557

>>15923479
That's a win for you though.

>> No.15924559

>>15923648
Bro, if you can't write the easiest language in the world (behind maybe Matlab) then you can't think through what you are programming.

>> No.15924646
File: 10 KB, 457x132, IMG_20231208_004053.jpg [View same] [iqdb] [saucenao] [google]
15924646

>>15924182
>>15924188
Or you know, just highlight it all and press tab. Every text editor has an easy way to indent a block of code. Even if you have curly braces to delimit blocks, you still need to indent.

Who are these lazy morons who don't indent their code?

>> No.15925472
File: 44 KB, 628x417, 1679434295782392.jpg [View same] [iqdb] [saucenao] [google]
15925472

>>15924137
my nigga

>> No.15925485

>>15923491
Python is pretty much used in everything these days, I work as a Data Scientist for a Marketing company, every single fucking decision they take now is absolutely data driven to autistic levels I didn't even know were possible. They have even attached smart glasses on samples of people just to see what shelves they look first while shopping.

>> No.15925488

>>15924120
>matplotlib
Absolutely disgusting. I just ended up using Powerbi after seeing the abominations I created.

>> No.15925538

>>15923618
>Anyone know if there's a better plotting library out there?
Just use Sage.

>> No.15925543

>>15923497
Real physicists delegate this shit to the underperforming cs undergrad

>> No.15925581

>>15924646
>he doesn't recognize that what I described in Vim is what you do in an IDE with a mouse
>he's not a Vim user
I thought this was the smartest board

>> No.15925597

>>15925581
> hold shift
> press down arrow until entire code block is highlighted
> press tab
Actually curious does vim provide all an IDE does? Linting, jumping to usage/source and easily searching a project are a big reason why I use pycharm even if it is slow as fuck

>> No.15925637

>>15923618
seaborn, plotly, plotnine are some other plotting options. seaborn is built on matplotlib but basic stuff is easier

>> No.15925753
File: 49 KB, 500x500, 1702639098385951.jpg [View same] [iqdb] [saucenao] [google]
15925753

>>15925581
My point is that every text editor with mouse select supports group indentation and it works the same as a word processor. It doesn't matter if it's Emacs, Vim, or the built-in Ren'Py editor.

>>15925597
Emacs, and probably Vim too, can be configured to do auto complete, automatic linting, and interactive development.

>> No.15925756

>>15925488
>powerbi
https://ludic.mataroa.blog/blog/powerbi-is-a-human-rights-violation/

>> No.15925890

Python is great, it's extremely intuitive and fun to use.

>> No.15925895

>>15923779
I'm listening

>> No.15925966

>>15923927
A garbage collected language, though especially something like Python, is super-easy to beat. Implement even a fairly naive algorithm in C or something comparable, and so long as you haven't picked an algorithm that isn't total ass, and know a little tiny bit about the hardware underneath, which comes naturally using that sort of language, then you can get stuff 50x faster. Doesn't take an expert.
Compiler optimisations, as much as they help, are also in C. And there it's dedicated to speed.
High level abstractions can get ridiculous in languages like Python. Some mathsfag youtuber made a video about solving some wordle-like game in Python. His code used "sets", and took a month to run. Then some viewer with Python did it in 15 minutes. Then people whipped out C/Rust/etc and got it to under 10 ms. If you just half-ass an algorithm in C or something to begin with, even a shitty one will save you a month. Granted, this is a particularly bad example and python is pretty easy to pick on.
FreeBASIC is unironically good for this. Fast, still pretty easy.

>> No.15925981

>>15923523
CS people don't have girlfriends and 90% of them are trannies

>> No.15926069

>>15925966
>Some mathsfag youtuber made a video about solving some wordle-like game in Python
Don't tell me, he also refuses to use matplotlib and instead puts his program output into Excel

>> No.15926104

>>15924182
Highlight and press tab

>> No.15926795
File: 80 KB, 607x727, 1702630068511030.jpg [View same] [iqdb] [saucenao] [google]
15926795

>>15925966
This is stunningly backwards. High performance code relies on specialized libraries that take advantage of hardware acceleration, like SIMD or CUDA. If you slap something together in Python and use libraries like numpy or torch you get hardware acceleration. If you write shit in C, you *still* need hardware accelerstion to keep up with Python, but now you're stuck with C. Your naive nested C for loop, that probably wrecks the cache, will never out perform the intel MMX bullshit built into numpy.

>> No.15927000

I mean what's your confusion? Do you fail to understand python, or just how to program? Are you confused that programming isn't maths-like?

I agree that Python is dogshit for physics though. Not so much for reasons of performance, but because it invites you to do stupid shit that compromises the validity of your physics.

>> No.15927008

>>15923416
>Python is so hard
not gonna make it

>> No.15927025

>>15923615
this to be perfectly desu
also I would like to reiterate that matlab is terrible

>> No.15927063

I was a hardcore numerical physicist before I fucked off into finance and let me tell you, there is absolutely nothing wrong with python. I wrote a lot of python, a lot of C and C++, a fair bit of FORTRAN mathematica R and of course matlab, which fucking sucks. Python is easy. It just werks and you can use it for anything. There is nothing wrong with indentation syntax. Please do the needful and use an IDE or LSP plugins for emacs/neovim/coode. For numerics, I would rather write python than any of that other stuff, except C++ perhaps for something unusual that requires good performance. You can get great performance from python (libraries) for most numerical tasks with a fraction of the work. In fact it will probably be the best available performance for anything that matters, because with python you can get fully-cooked libraries which call hardware-optimised C or FORTRAN, built by crack teams of autists, that you could never code yourself.

>> No.15927082
File: 4 KB, 232x217, 1679447435733068.jpg [View same] [iqdb] [saucenao] [google]
15927082

>>15925966
dear lord

>> No.15927681

>>15923575
>>>have to adjust the indentation to dozens of lines or else it won't work
i hate this so much. I know only piece of shit millenials could created such evil

>> No.15928028

>>15923957
>Is python easier than C

Honestly, no. C is way more consistent and you can more easily reason about how programs written in it work. Python is genuinely only easier if you're a bad programmer.

>> No.15928030

kys niggerloving zionist tranny fuck

>> No.15928301

>>15928030
wrong thread retard faggot

>>15928028
this. C makes 10000x more sense if you have >90 IQ and are able to understand vaguely how memory works.

>> No.15928305

>>15924557
They were going to pay him $20k anyways. It's not a bonus, it's just taking him a lot longer.

>> No.15928360

>>15926069
>and instead puts his program output into Excel
output?, matt parker's notorious for using excel for calculating stuff

>> No.15928361

>>15927082
here vid
https://www.youtube.com/watch?v=c33AZBnRHks

>> No.15929703

>>15925756
>I hate powerbi
>it's basically Tableu but for windows only.
And what's the matter there? It's one of the most retard proof software I have ever seen. You can make an entire interactive dashboard in just 10 minutes with it even as a beginner.

>> No.15929731

>>15923615
op is lying and your post is just sour grapes.
All physics majors have to do a lot of programming in undergrad and almost all unis have hard minimum required gpa for entry into postgrad.
that being said, python -contrary to its mantra- does a ton of implicit shit and its libraries are even worse.

>> No.15929803
File: 230 KB, 480x480, 1702639571415227.png [View same] [iqdb] [saucenao] [google]
15929803

>>15929703
No one has ever needed an interactive dashboard.

>>15929731
>that being said, python -contrary to its mantra- does a ton of implicit shit and its libraries are even worse.
Why can't people just sit down and learn to program? Imagine someone skipping real analysis, complaining that calculus is a bunch of random implicit stuff, and then complaining everything built on calculus is shit. That's you.

>> No.15929820

>>15929803
This is why the meme about autists being smart is so wrong. Yes, a lot of them can do big thinks about things, but they get hung up on the dumbest shit. They also have more difficulty with the already difficult task of remembering what it's like to not know how to do something yet.

>>15928028
Case in point. This autist is conflating "makes more sense" with "easier to learn." Yeah, it makes more sense from a computer science perspective. But if you're just treating numpy as a black box that does your calculations for you, that is utterly irrelevant.

>> No.15929824

>>15928028
P.S. Everyone is a bad programmer when they start. FFS.

>> No.15929827

>>15929824
So don't waste time on Python, learn C.

>> No.15929855

>>15929820
>>15929824
I'm really going to have to make my views clearer.

If >>15923957 only knows C and wants to branch out to other languages out of curiosity, and specifically those that will let him get work done faster and more easily, it's perfectly reasonable to learn Python specifically if you want to work with the popular libraries Python has, which are the best reason to use it.

However, if you aren't specifically wanting to use Nympy et al. then Python is honestly kind of janky in ways that make it only worth using for relatively small scripts and playing around with rapid iteration. It's not at all like C is some kind of ideal language that's all you'd ever need if you're an uber programmer, as it's very low level and won't teach you how to work at higher levels of abstraction, but I just honestly don't consider Python to be significantly 'easier' than C overall (given C is pretty simple itself) or better designed than other dynamic languages given how idiosyncratic it is.

It's definitely a really good idea to learn some language where you can do stuff like just declare a 'map' of shit and throw stuff in there, which is overly difficulty in pure C and much easier in Python, but there are more things out there than Python if you want to get serious about programming complex things. Depends on your goals.

>> No.15930019

>>15923479
write it in Matlab and use some converter
unless you WANT to learn Python
the world is your oyster, cook it however you like, why should we care

>> No.15930035

>>15929803
>Why can't people just sit down and learn to program?
No one can rote memorize every single eccentricity in the fuck ton of functions from the fuck ton of libraries you use.
>complaining that calculus is a bunch of random implicit stuff
Nothing in calculus is implicit and it wouldn't even make a difference. nothing breaks if i don't write down every single step.
Implicit is always bad in programming, a 1d float array should stay a 1d float array until i explicitly change it. I shouldn't need to debug for hours just for the problem to be caused by some implicit conversion/behavior that's hidden somewhere in the documentation.

>> No.15930470
File: 148 KB, 1024x1024, 1702674184242460.jpg [View same] [iqdb] [saucenao] [google]
15930470

>>15929820
Based.

>>15929855
C is really easy if you're doing next to nothing. If you don't care about large integers, don't care about speed, don't care about memory leaks, don't care about unicode, don't care about development time, and don't care about security, C is easy. If you care about all that, C is really hard.

Python is, in a sense, a bigger language, but, like C, it is simple underneath.

>>15930035
>No one can rote memorize every single eccentricity in the fuck ton of functions from the fuck ton of libraries you use
Most library code uses the same interface. Complaining about multiple data structures is like complaining about there being multiple vector spaces, fields, and groups. You're not supposed to memorize everything; you're supposed to develop familiarity with general principles.

>hurfur implicit
Good thing you can always check the source code. Also, Python has some of the least retarded type coercion of any dynamicly typed language. Get good.

>> No.15930500
File: 315 KB, 523x418, 1619035002864.png [View same] [iqdb] [saucenao] [google]
15930500

>>15923416

>> No.15931258

>>15929803
>No one has ever needed an interactive dashboard.
They have no practical purpose but if you must show data to an investor or a client in the most usable and available way, it's a must.

>> No.15931278
File: 903 KB, 614x768, 1701659276526758.gif [View same] [iqdb] [saucenao] [google]
15931278

>>15923416
What is your Python problem? Probably I can help some. I don't know how Physics works, but I am good at telling computers to do things.

I think in some cases, scientists got taught programming wrong. I read some Computational Science/Scientific Computation/Computational Physics books and was kind of dumbstruck by how bad the code is.

>> No.15931283

>>15931278
>kind of dumbstruck by how bad the code is
In what ways?

>> No.15931322
File: 3.36 MB, 348x498, 1669429383756.gif [View same] [iqdb] [saucenao] [google]
15931322

>>15931283
A lot of code written in sort of a naive way, with no eye towards making the code maintainable, extendable or reusable.

No discussion of automated testing. No discussion of modern tooling. No discussion of using a debugger. Poorly organized spaghetti code which lacked documentation, and in a lot of cases vague names for variables/methods. No discussion of using a profiler to find possible bottlenecks or inefficient code and fix it. No discussion of multi-threading. No discussion of refactoring code for readability/maintainability. Etc.

One of the books dedicated two chapters to complaining about precision problems when using Double or Float and how to write a function that approximates errors caused by Double and Float. This problem was solved a long time ago and the author was using Java and could have just used BigDecimal, which is part of core Java and can do the computations he wanted, with the precision he wanted, faster and with less lines of code and no need for the error approximating function. Instead of looking at what was available in the core libraries he chose to reinvent the wheel, poorly.

It was basically hobbyist code written by someone who has never even looked at basic concepts of Software Engineering.