Return to “Scripting & Modding”

Post

Re: If you want to learn how to program in Python...

#17
I recently tried to write a rougelike in java. All my friends were like "WHY ARE YOU DOING THAT." I couldn't get the messaging system working the way I wanted, and no one would touch the source, so I'll come back to it when I have more supportive friends.

I like python a lot. Used it to make graphs, save data, and act as a receiver for serial communication for my research project. It worked way better than my buggy C microcontroller code for sure. :thumbup:
Libertas per Technica
Post

Re: If you want to learn how to program in Python...

#18
Silverware wrote: Work fine, does not mean work fast :D
I can do the same numerical work in C or C++ much faster. :P
(or in JS at about the same speed, only with more work involved due to Py having the nice SciPy libs)

Python is great for the general use-case of calculating random shit. But it is not a speed demon, and is best used for one-off calculations, rather than trying to get thousands of calculations per second. :P

Yes, and I believe OpenStack is also compiled Python :P
C(++) might be faster at runtime, but Python is faster when you're writing it, especially since it has such a generous standard library. In terms of data mining or computational linguistics processing, Python is actually a preferred language since string manipulation is so easy, and many array/string operations that would require an explicit for-loop or function call in C-like languages can be done with a simple slice operation in Python. Underlyingly the procedure is the same, but it's at a higher level of abstraction for the programmer.

Python's standard library for mathematical operations is also generous, which makes it useful for statistical calculations. Application programming is not its strong suit, but can be a far more powerful parsing engine than C++ could ever hope to be with its standard library.

Slower runtime speed is the nature of most interpreted languages, but Python can be compiled to runnable bytecode for some performance gains. If I recall correctly, its memory management scheme actually beats Java's in some respects. Of course, there are variants of Python that are designed to be compiled rather than interpreted, or interpreted using a different implementation language as the foundation for the interpreter.

Python is also starting to encroach upon JavaScript and PHP's territory as web programming languages, serving as part of the back-end structures of Google, Facebook, and Youtube.

It's often used as a glue language between services written in other languages, particularly C, since there's a library that allows Python to call C functions (or something to that effect).

EDIT: It does not surprise me that Yahoo has a JavaScript frontend and a JavaScript & PHP backend. This is obviously one of the contributing factors to Google being so kickass, and Yahoo being so lame.
Shameless Self-Promotion 0/ magenta 0/ Forum Rules & Game FAQ
Post

Re: If you want to learn how to program in Python...

#20
Grumblesaur wrote: Python is also starting to encroach upon JavaScript and PHP's territory as web programming languages, serving as part of the back-end structures of Google, Facebook, and Youtube.

It's often used as a glue language between services written in other languages, particularly C, since there's a library that allows Python to call C functions (or something to that effect).

EDIT: It does not surprise me that Yahoo has a JavaScript frontend and a JavaScript & PHP backend. This is obviously one of the contributing factors to Google being so kickass, and Yahoo being so lame.
Google uses a JS frontend, and I have no idea what they use at the back, but my money is on a custom C++ compiled application, designed to work in tandem with their database engine. In modern terms there are plenty of backends you can use to replace PHP, and even replacing Apache/Tomcat is possible. Node.js is one possibility, and Python can do the same things that Node.js can.

Plus, anyone still using PHP for anything is prolly old school. :V (PHP should be a dead language until PHP7 hits)

In fact, the ONLY (worthwhile) front end you can get on the web is Javascript based, Python might eventually move into this terrain, but with Google's heavy investment in V8 (their JS runtime) I don't think Python will replace JS anytime soon, if only because JS can have smaller filesizes than python thanks to it's non-reliance upon whitespaces. (not much of a saving, but Google's programing standards are all geared for minimum file size, they dont even allow a space after the colon in CSS :V)
°˖◝(ಠ‸ಠ)◜˖°
WebGL Spaceships and Trails
<Cuisinart8> apparently without the demon driving him around Silver has the intelligence of a botched lobotomy patient ~ Mar 04 2020
console.log(`What's all ${this} ${Date.now()}`);
Post

Re: If you want to learn how to program in Python...

#21
ARISE THREAD AND REVEL IN YOUR NEW-FOUND USEFULNESS :ghost:

By Corn:
http://learnpythonthehardway.org/book/

Python for programmers:
https://wiki.python.org/moin/BeginnersGuide/Programmers

And the Python docs:
https://docs.python.org/2/

Other than that, myself and several other people who regularly hang out on the Limit Theory IRC are Python programmers and are more than willing to help you if you have a problem, so feel free to drop by. ;)
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image
Post

Re: If you want to learn how to program in Python...

#22
And there's the question of the IDE...
Some of us (glances at Sly and Josh) probably use vim or emacs or whatever, but for the rest of us a nice IDE is handy, and the one that comes with the default Python install isn't the best...

For a long time I've used Spyder, which is not a bad IDE, having a built-in python console and debugging and so on, but is lacking in code collapsing (there is none) and auto-complete (it only completes functions you've already used in that file - I expect auto-complete to at least fill in stuff from the standard library too).

But today I found Pycharm (the community edition, which is free), which does have code folding, and does have auto-complete for all your installed python packages, support both 2.7 and 3.* at the same time (spyder has 2 separate versions), built-in version control (I tested github and it just works™, cloning, commiting and pushing), extensive code inspecting (errors and warnings), autoformatting, built-in console and debugger and so on.
Have only played with it for a little bit but I like it a lot so far.
Screenshot:
Image
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image
Post

Re: If you want to learn how to program in Python...

#24
Silverware wrote: Who even uses something that saves you a lot of time?
Just code in something that doesn't have auto-complete or syntax checking, and debug in something that doesn't give any info beyond where your program crashed!
Because making things unnecessarily harder for yourself is good for some reason!
FTFY
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image
Post

Re: If you want to learn how to program in Python...

#25
Dinosawer wrote:
Silverware wrote: Who even uses something that saves you a lot of time?
Just code in something that doesn't have auto-complete or syntax checking, and debug in something that doesn't give any info beyond where your program crashed!
Because making things unnecessarily harder for yourself is good for some reason!
FTFY
Yes :D
This way you get to practice debugging by reading code, instead of debugging by running the application. :P
Which is a good habit.
°˖◝(ಠ‸ಠ)◜˖°
WebGL Spaceships and Trails
<Cuisinart8> apparently without the demon driving him around Silver has the intelligence of a botched lobotomy patient ~ Mar 04 2020
console.log(`What's all ${this} ${Date.now()}`);
Post

Re: If you want to learn how to program in Python...

#26
silverware wrote: This way, you can waste hours re-reading your entire code file instead of knowing what part didn't work in what exact circumstances, because the 90 percent of that time where you're not even able to work on your code makes you a better programmer, somehow
FTFY
Warning: do not ask about physics unless you really want to know about physics.
The LT IRC / Alternate link || The REKT Wiki || PUDDING
Image

Online Now

Users browsing this forum: No registered users and 8 guests

cron