[ 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: 835 KB, 3000x2116, os guide.png [View same] [iqdb] [saucenao] [google]
4527611 No.4527611 [Reply] [Original]

What can you make with python? Can you make complex programs or what?

>> No.4527627

It's a program. You make programs.
And with python you make extra ugly programs

>> No.4527636

You can make any program you want, but it will run about 100x slower than in C.

Probably a conservative estimate. Once I wrote, compiled and ran a C program to do the same task in the time it took my python code to finish executing.

>> No.4527655

>>4527611
python is turing complete, which means YOU CAN MAKE ANYTHING! It's also easy to use, so making anything doesn't take forever.

Got a friend who programmed a little temperature sensor in python.

>> No.4527711

what about python vs java

>> No.4527719

>>4527711

Java is considerably faster, but it's a horrible horrible language and if you value your sanity you will never ever touch it.

>> No.4527721

>>4527611
>What can you make with python?
Programs
>Can you make complex programs or what?
Yes, it can.

>>4527711
Depends what you are planning on making/why you are learning it.

>> No.4527723

>>4527627
>python
>ugly

Sure is perl fanboy in here.

>> No.4527756

>>4527636
>Once I wrote, compiled and ran a C program to do the same task in the time it took my python code to finish executing.
Wtf does that prove? If you write a simulation that would take a day to run in C and 4 weeks to run in Python, then of course you could do that, but then you would be fucking pants-on-head retarded if you're writing numerically insentive shit in high-level Python instead of creating bindings or using Cython and other variants. Use the right tool for the job instead of bitching that your screwdriver is a shitty hammer, faggot.

>> No.4527766

Can Python be used to communicate with pnuematic actuators connected to control surfaces on a very fast vehicle? Can Python be used on conjunction with Arduino?

>> No.4527768

>>4527756

It proves that python is fucking slow? Which is an undeniable fact?

It's not like python is faster for some tasks, and slower for others. It's slower around the table. The only time you would use python if you're writing some scripts so simple that they'll finish quickly no matter how shitty the language is. Which can be clearly inferred from my post if you're not pants on head retarded, as you seem to be.

The OP asked, what can python do?
I said, everything, but it's slow. Conversational implicature => it can do things that don't require a lot of computation time.

Get those assburgers checked out.

>> No.4527773

>>4527766

Terrible idea. For embedded systems you want either C or assembly. Everything else is going to be too slow.

>> No.4527781

>>4527773
Okay thanks.

>> No.4527791

>>4527611
Alot of CERN uses python. You can make any fucking thing you want.

>> No.4527807

>>4527791
what do they use it for?

>> No.4527809

>>4527768
Fuck you must be a one-tool fanboi.

There are fucktons of modules for Python written in C, C++ and other low-level, fast languages. Writing control logic in Python and using those modules for numerically intensive tasks is usually nearly as fast as pure C because passing data around only accounts for a very small fraction of runtime.

Writing the logic in Python usually takes considerably less time than writing it in C because you don't need to deal with memory management, boilerplate code, etc.

Sure, it takes a few hundred extra milliseconds each time you run it, but you save much more than that when you write, change and maintain the code.

inb4
>I can wite C so fast that it doesn't matter
>C is the best language for everything
>herp derp C is all I know so it must be the best
>other ignorant comments from someone with no first-hand experience

>> No.4527813

>>4527791
You're supposed to be choosing examples that make Python look good.

>> No.4527814

>>4527809
How can I use compiled C modules in python?

>> No.4527816

>>4527814
import

>> No.4527819

>>4527814
http://docs.python.org/py3k/c-api/index.html
https://secure.wikimedia.org/wikipedia/en/wiki/SWIG

there are other automatic wrappers
google them

>> No.4527822

>>4527819
Cool, thanks.

>> No.4527824
File: 28 KB, 358x310, 126877739536bbbb8.jpg [View same] [iqdb] [saucenao] [google]
4527824

>>4527813
>implying that doesn't make python look good

>> No.4527836

>>4527824
Clearly you've never actually used said software.

>> No.4527854

>hurr I rewrite a seven line python script in C because I REALLY NEEDED THOSE 0.31 nanoseconds

>> No.4527875

>>4527854
>HURRRR I only use python because XKCD tells me it's the best XDDDDD
>I also enjoy being forced to use another person's code formatting preferences due to lack of braces.

>> No.4527890

>>4527875
The indentation thing is probably the silliest objection anyone has to Python. Indentation has meaning to humans and ought to have the same meaning to an interpreter or compiler. The braces approach disguises bugs because the programmer sees one meaning while the compiler sees another.

>> No.4527896

>>4527890
>The braces approach disguises bugs because the programmer sees one meaning while the compiler sees another.
Surely you jest. You've got it completely backwards.
Braces have significantly more clarity, there is no room for confusion, and you can format your code in whatever way shape or form you see fit.
In python if you put a tab out of place or even auto-format your code it can completely change the meaning of your program

>> No.4527900

>>4527809

>Writing control logic in Python and using those modules for numerically intensive tasks is usually nearly as fast as pure C

So it's still slower? Which is what I said.

In other words, if you take python, which is fuck slow, and use some modules written in C, which is fast, you get something in between fuck slow and fast. Who would have thought.

>> No.4527902

>>4527896
>Braces have significantly more clarity
Combined with proper indentation, braces give you a little more clarity. However, the proper comparison is between indentation alone and braces alone. Indentation wins hands-down.

>> No.4527909

>>4527900
And it's a very good idea to do so, because in a typical program most of the CPU time is spent in a small part of the code. Thus you write that part of the code in a language that runs fast, and the other parts in a language that can be written fast.

>> No.4527911

is python a good language to learn for a beginner?

>> No.4527916

>>4527900
No, it's faster, because it saves hours of development time, which is way more expensive.

>> No.4527921

>>4527909
>save coding time by writing code in python
>save processing time by importing c modules
How one cannot see the advantage of using both is beyond me.

>> No.4527923

>>4527900
Also, what the fuck, man, it's not just somewhere between slow and fast, it's only slightly slower than fast.

>> No.4529666

Should I learn python before going on to other languages?

>> No.4530562
File: 124 KB, 650x835, t4_PythonBraces1.jpg [View same] [iqdb] [saucenao] [google]
4530562

>>4527911
>>4529666
Python is a general purpose multi paradigm rapid prototyping scripting language.So it's a good point to start.