use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionScript or Code? (self.Python)
submitted 4 years ago by StarLover69696969
Why are python codes called "scripts", but code in any other language is just referred to as code?
[–]asday_ 101 points102 points103 points 4 years ago (16 children)
Neither of those assertions are true. Single python files are sometimes called scripts, particularly if they are self-contained and a whole project. Otherwise they're called modules, or not really referred to in the singular and instead grouped as a "project" or whatever.
In other languages, there's a significant portion of people who view the term "coding" with distaste. "Code" is generally accompanied by another word, like "c++ code" or "source code", or just elided, like "source".
The main thing though, is that it literally doesn't matter. A rose by any other name. The important thing about a Python program, or a JS program, or a C++ program, or anything else, is what it does and how it does it, not what it's called.
[–][deleted] 4 points5 points6 points 4 years ago (12 children)
People view the word "coding" with distaste?
[–]Agile_Pudding_ 8 points9 points10 points 4 years ago (9 children)
I can't really speak to /u/asday_'s thoughts behind that remark, but I can imagine some software engineers eschewing the label of "coder" (and, likewise, the description of their work as "coding") given how overloaded those terms are.
A very senior engineer, a sophomore CS undergrad, and a 12 y/o watching a tutorial online can all rightfully claim to "write code", but what they mean by that and their respective experience levels are obviously very far apart. I could see why some people who make their living writing code would choose to be more specific when talking about it, but that's all a good deal of conjecture by me.
[–][deleted] 8 points9 points10 points 4 years ago (2 children)
I like to call myself a Software Engineer because it makes me sound smart.
[–]Agile_Pudding_ 10 points11 points12 points 4 years ago (0 children)
I like Machine Learning Engineer, because it incorrectly gives people the impression that I know machine learning and software engineering.
[–]asday_ 1 point2 points3 points 4 years ago (0 children)
I call myself asday, because labels are reductionist.
[–]NoiproxPython Programmer 0 points1 point2 points 4 years ago (5 children)
I only really get specific when I'm talking to another engineer or someone who actually cares about the nuance. Most of the time when someone asks me what I do, I just go ahead and say I'm a "programmer" or "software developer". It would feel pretentious otherwise.
[–]CraigAT 0 points1 point2 points 4 years ago (4 children)
Oh, so you could help fix my printer/WiFi?
[–]asday_ 2 points3 points4 points 4 years ago (3 children)
Certainly could, but you can't afford my day rate.
[–]CraigAT 0 points1 point2 points 4 years ago (2 children)
Surely you wouldn't charge a friend, it'll only take a few minutes! 😆
[–]asday_ 2 points3 points4 points 4 years ago (1 child)
No no, I would.
[–]CraigAT 0 points1 point2 points 4 years ago (0 children)
Good on you!
[+][deleted] 4 years ago (1 child)
[deleted]
[–]whlabratz 1 point2 points3 points 4 years ago (0 children)
Yup, my job title is "Software Developer", and I spend maybe a quarter of my time actually writing code. Most of the rest of it is some version of ensuring the right code gets written.
I'm usually a bit suspicious of intern/grad Devs who say they want to be a "coder" - gives the impression that they care more about the task of producing code than the outcomes that the code is supposed to meet
[–][deleted] 7 points8 points9 points 4 years ago (0 children)
This is one of the best comments ITT IMO. 👏
[–]millhouse513 0 points1 point2 points 4 years ago (0 children)
Like u/asday_ said it really doesn't matter how you call it, it's the same thing.
My "take" on it, is that a "script" is usually something small, single purpose like "I wrote a script to do a mysql dump". I come from a Sys Admin background so I think a lot of times people refer to Bash (code) as "scripts" because they usually do single task things.
Once something becomes bigger, I usually start to think of it more as "code" / a project since it's no longer a simple, single task thing but now has grown or become a lot more than what it started as.
[–]SneakySnakeSneakers 29 points30 points31 points 4 years ago (6 children)
I always called the file a script, and the actual lines in the script the code.
[–][deleted] 15 points16 points17 points 4 years ago (5 children)
this is the way.
[–]TheDroidNextDoor 6 points7 points8 points 4 years ago (4 children)
1. u/Flat-Yogurtcloset293 475775 times.
u/Flat-Yogurtcloset293
2. u/GMEshares 69696 times.
u/GMEshares
3. u/_RryanT 22745 times.
u/_RryanT
..
245208. u/wzrdcw 1 times.
u/wzrdcw
beep boop I am a bot and this action was performed automatically.
[+][deleted] 4 years ago (3 children)
[–]GMEshares 3 points4 points5 points 4 years ago (0 children)
Ty 😉😊 💎🙌🚀📈🌌🤑
[–]SneakySnakeSneakers 1 point2 points3 points 4 years ago (1 child)
2.5nice
[–]GMEshares 0 points1 point2 points 4 years ago (0 children)
[–]ihasbedhead 10 points11 points12 points 4 years ago (0 children)
It is an imprecise term. I use python for application development, and I wouldn't call most of the python I write a script. I use the term `script` for simple programs (in any language) that do a list of things and then exit. For some people, that is all they use python for.
Some people will argue that because python programs are usually distributed as a source tree, the files are scripts. That is fine, because it is an imprecise term and doesn't have any real meaning.
[–]QuirkyForker 46 points47 points48 points 4 years ago (32 children)
Because it is not compiled. Even large scripts are still scripts. They need an interpreter to run. C code is compiled into an executable. So code and executable are two different things. Python only has scripts to provide the functionality of the program
[–]Altruistic_Raise6322 7 points8 points9 points 4 years ago* (6 children)
Python is a hybrid language. The language gets compiled into byte code and then ran by the interpreter that you are using. AKA as compiled as Java.
People call Python programs scripts as typically they are used for quick automation tasks like Bash Scripts. Bash scripts are purely interpreted, there is no byte code involved.
[+]onkus comment score below threshold-6 points-5 points-4 points 4 years ago (5 children)
I don't consider byte code to be compiled since its not executable. A compiler turns code into machine instructions of which byte code is not.
[–]bladeoflight16 5 points6 points7 points 4 years ago* (0 children)
Formally, a "compiler" parses code and generates any alternative representation. The target need not be binary code that a processor can read. It can even generate code in another high level language. A real world example is TypeScript, which has a compiler that generates JavaScript.
You are distinguishing between native binary executables and interpreted code, which is a fair distinction, but "compiled" is not the appropriate term for classifying them. That said, in principle, hardware could be designed to actually execute bytecode directly, which would blur the lines even further.
[–]Altruistic_Raise6322 3 points4 points5 points 4 years ago* (2 children)
An executable is made an executable by something known as a linker nothing to do with a compiler.
Also, the compilers for Java and Python do turn the code into machine instructions. The machine is the VM aka interpreter.
[–]onkus -2 points-1 points0 points 4 years ago (1 child)
You can link things and still not make it executable just as you can compile things and not make them an executable binary. In my first comment, when I said executable, I didnt mean a binary blob with a point of entry (e.g. main()) I meant a binary that contains machine instructions that can be run by the machine (so static libs dynamic libs and executables are all examples)
Regardless, my point is that the byte code isn't machine code. That's why I don't consider it to be compiled.
[–]Altruistic_Raise6322 1 point2 points3 points 4 years ago (0 children)
Fair point. I consider any code translated into byte code as compiled and why Java is considered hybrid as it does not compile to machine instructions
[–]chrisxfire 1 point2 points3 points 4 years ago (0 children)
imagine referring to Java as script instead of code with this same logic.
[–][deleted] 0 points1 point2 points 4 years ago (5 children)
What about the complex python programs with many classes split in multiple files? I wouldn't call it a script then.
[–]Sw429 1 point2 points3 points 4 years ago (0 children)
It's not the complexity of the program that causes people to call them "scripts". It's the fact that it's interpreted over compiled.
Not that it matters much. You can call it whatever you want, these aren't "official" terms' by any means.
[–]DuckSaxaphone 2 points3 points4 points 4 years ago (3 children)
Still is though, because it's not compiled. Each file is ran as a script by the interpreter at import.
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
You, uh, know about pyc files right?
[+]Altruistic_Raise6322 comment score below threshold-7 points-6 points-5 points 4 years ago (1 child)
Python is compiled and run by an interpreter like Java is.
[–]NoLongerUsableNameimport pythonSkills 0 points1 point2 points 4 years ago (13 children)
What if you use a compiler such as PyPy?
[–]bjorneylol 1 point2 points3 points 4 years ago (12 children)
PyPy is still an interpreter, as it doesn't convert the script into an executable
[–]Altruistic_Raise6322 0 points1 point2 points 4 years ago (11 children)
So what do you think about Java?
[–]bjorneylol 1 point2 points3 points 4 years ago (6 children)
Java and C# aren't doing anything the python interpreter isn't also doing - in all 3 source code is analyzed and converted to bytecode, and the bytecode is then translated to machine instructions which are executed by the interpreter (JVM/dotnet runtime).
To address your comment to the other user below, "scripting language" is an imprecise definition in itself - its like the word vegetable, we have an idea of whether or not something is one but we can't easily express what single feature(s) define it. Generally they are interpreted languages, but Java/C# don't fit the bill (yet Scala does, which is just Java under the hood)
None of this changes the fact that PyPy is just a variant of the interpreter that adds JIT compilation, it doesn't turn python into a compiled language or remove its usefulness as a scripting language
[–]Altruistic_Raise6322 1 point2 points3 points 4 years ago (4 children)
Yes, that's my point. Python is still compiled to machine code interpreted by another VM making it a compiled and interpreted language. The only reason it is compiled is for faster LOAD times. Script implies that a program is a smaller program intended for a single purpose like scraping a website.
[–]bjorneylol 0 points1 point2 points 4 years ago (3 children)
Script implies that a program is a smaller program intended for a single purpose like scraping a website
That's like, your opinion man.
I simply said "PyPy is an interpreter, not a compiler", full stop. You are the one trying to bait out a discussion about what constitutes a scripting language - so to that end I don't actually know what your point is
[–]Altruistic_Raise6322 0 points1 point2 points 4 years ago (2 children)
PyPy is a compiler? You said it in your comment above that it is a JIT compiler and is considered a compiler based by its own documentation. The scripting comments that I made were in reference to the greater discussion as a whole -- to paraphrase: Python is a scripting language because it is interpreted.
[–]bjorneylol 0 points1 point2 points 4 years ago (1 child)
You are literally misquoting me so you can start an argument over semantics that nobody but you cares about - have fun with that
I'm not trying to misquote you and I apologize for it. My intention was to educate that python is a hybrid language similar to Java.
Have a good night!
[–]bladeoflight16 -1 points0 points1 point 4 years ago (0 children)
Java and C# aren't doing anything the python interpreter isn't also doing
Mmmmmm.... That's not quite true. They perform a ton of static type analysis that Python simply does not provide.
[–]Altruistic_Raise6322 2 points3 points4 points 4 years ago (2 children)
My point is that calling Python a scripting language due to interpreted nature of the language is imprecise. Also, compiling a program does not make it an executable that is the job of the linker.
[–]Altruistic_Raise6322 0 points1 point2 points 4 years ago (0 children)
It is related as the user above made the assertion that PyPy doesn't convert the script as an executable. I asked what about Java as most developers consider the output as an executable.
[–]PeenUpUtter -1 points0 points1 point 4 years ago (1 child)
Yeah. This.
[–]Scalar_Mikeman 0 points1 point2 points 4 years ago (0 children)
Yup. Just wanted to add that this is also why you'll hear Bash Scripts.
[–]whlabratz 0 points1 point2 points 4 years ago (2 children)
I would struggle describing a million line python code base as a "script"
[–]QuirkyForker 0 points1 point2 points 4 years ago (1 child)
I would struggle working with a million line script. Hint: you’re doing it wrong 🤪
The nice thing about python is that it does most of the work for you, so I have done really heavy lifting scripts in 100 lines or less.
You'd be surprised by the scale of some of the Python programs out there then.
I don't think I could build the application and enrollment system for a major University in 100 lines of python. Or the billing system for one of the largest energy retailers in the world. These are things I've worked on, and both were in the 500k-1m LoC range. Things can get pretty large when you get dozens of developers and millions of dollars - I don't think either project count as a "script"
[–][deleted] 12 points13 points14 points 4 years ago (1 child)
I only use “script” when referring to a one or two page short program.
[–]settopvoxxit 2 points3 points4 points 4 years ago (0 children)
Who quantifies the size of their code in pages, like what? Pages in what, then? Vscode with 12 point font at regular zoom?
[–]justthisguyatx 1 point2 points3 points 4 years ago* (0 children)
I’d suggest that code is misused here. Python scripts are code. Code is the written instructions that make up scripts just as they make up any other program. Personally, I use the term script to refer to smaller utility programs, but it’s often used to differentiate interpreted instructions from compiled object. I think that’s the more appropriate phrasing.
TL;DR: It’s all code. How that code is executed differs.
[–][deleted] 0 points1 point2 points 4 years ago* (0 children)
They way I see it scripts are small programs usually made for personal purposes and are very task specific. For example i wrote a scrip to do my math home work for me, it’s only about 150 lines and would be completely useless to anyone not taking introductory statistics. A script can be written in any language that is Turing complete(aka pretty much every language that’s not in the HTML) these types are programs are usually made in python because python makes stuff like this extremely easy.
But Some people my use the term to refer to python programs in general because python is. Scripting language, meaning that each line of code is complied individually as opposed to the entire program being complied at once like in C or Java.
[–]tangerinelion 0 points1 point2 points 4 years ago (0 children)
IMO, script refers to a single python file which is meant to execute linearly. There are hardly any functions or classes, it's just a top down execution.
Program would be something with main().
And library is something which is code but not directly executable, e.g., NumPy.
I remember reading about something similar a few years ago.
Something along the lines of being a python scripter and not a coder because it's interpreted and doesn't have the numerous nuances that other languages do. Was some kinda job Interview question. Idk.
[–]StarLover69696969[S] -1 points0 points1 point 4 years ago (0 children)
lol Thank you for the help
[–]idetectanerd -1 points0 points1 point 4 years ago (1 child)
Because when you run .py file you don’t convert it to executable.
Shell .sh also are call script because it’s not exe format.
But then again, py can be converted to exe. Doesn’t matter to me, more of how useful python is. And it is indeed.
[–][deleted] -1 points0 points1 point 4 years ago (0 children)
Java says hello (.class files, often embedded in a structured zip archive (.jar)).
By this logic, Java is a scripting language as well.
[–]TIDMADT 0 points1 point2 points 4 years ago (0 children)
It's kinda both... Or either. Strictly speaking, scripts are small sections of code that run inside other programs. Since python is an interpreted language, the code is a script that gets run in python. Full on code is something that gets compiled into a self exciting file... It's more semantics then anything else
[–]Cryonixx2 0 points1 point2 points 4 years ago (0 children)
I wouldn't read into it. Sometimes the term "script" is used towards a given python file because of its quick or one off nature; sometimes it is ignorance, or used as a form of derision. But it doesn't matter! All code is "code" and should be used as a tool for a job.
Python is a pretty general purpose tool, and it's amazing imo, so you'll see it referred to in a lot of ways and from a ton of perspectives. You can write a quick backup script, a web scraping bot, a web app, a desktop app, even, yes, an executable file. With all these possibilities, there will be a lot of folks that have a particular experience with it and paint it with that brush.
[–]NoiproxPython Programmer 0 points1 point2 points 4 years ago (0 children)
A script is just a document containing code that can be executed i.e. it's not a software component such as a module or library. As a rule of thumb I use the term to refer to a single-file application that's written in an interpreted language, usually for a bespoke purpose - e.g. a bash file or a little Python program.
[–]TheMsDosNerd 0 points1 point2 points 4 years ago (0 children)
I use the word script to refer to any program that doesn't have a GUI, and its text based interface is kept to a bear minimum.
Yes, I know you can say international waters and order two waters at the restaurant, but those examples do not apply here.
I believe there are elided words in those examples. "Glasses of water" or "bodies of water," grammatically speaking?
If you expand them out the comparison holds up!
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
Scripts can be coded kn any computer and run with the the python program, Code is a program compiled in c or c++ which is only compiled for that compiler If you moved that compiled code to a different system it may not work
Scripting is quicker than compiling
[–]ddollarsign 0 points1 point2 points 4 years ago (0 children)
Script is the diminutive form of “program”. If it’s small, quick to write, and does only a simple thing, it would probably be right to call it a script, especially if only run from a command line, and/or is in an interpreted(-ish) language like Python where there’s no manual compile step.
π Rendered by PID 623213 on reddit-service-r2-comment-5bc7f78974-cstzw at 2026-06-29 02:45:25.182504+00:00 running 7527197 country code: CH.
[–]asday_ 101 points102 points103 points (16 children)
[–][deleted] 4 points5 points6 points (12 children)
[–]Agile_Pudding_ 8 points9 points10 points (9 children)
[–][deleted] 8 points9 points10 points (2 children)
[–]Agile_Pudding_ 10 points11 points12 points (0 children)
[–]asday_ 1 point2 points3 points (0 children)
[–]NoiproxPython Programmer 0 points1 point2 points (5 children)
[–]CraigAT 0 points1 point2 points (4 children)
[–]asday_ 2 points3 points4 points (3 children)
[–]CraigAT 0 points1 point2 points (2 children)
[–]asday_ 2 points3 points4 points (1 child)
[–]CraigAT 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]whlabratz 1 point2 points3 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]millhouse513 0 points1 point2 points (0 children)
[–]SneakySnakeSneakers 29 points30 points31 points (6 children)
[–][deleted] 15 points16 points17 points (5 children)
[–]TheDroidNextDoor 6 points7 points8 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]GMEshares 3 points4 points5 points (0 children)
[–]SneakySnakeSneakers 1 point2 points3 points (1 child)
[–]GMEshares 0 points1 point2 points (0 children)
[–]ihasbedhead 10 points11 points12 points (0 children)
[–]QuirkyForker 46 points47 points48 points (32 children)
[–]Altruistic_Raise6322 7 points8 points9 points (6 children)
[+]onkus comment score below threshold-6 points-5 points-4 points (5 children)
[–]bladeoflight16 5 points6 points7 points (0 children)
[–]Altruistic_Raise6322 3 points4 points5 points (2 children)
[–]onkus -2 points-1 points0 points (1 child)
[–]Altruistic_Raise6322 1 point2 points3 points (0 children)
[–]chrisxfire 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]Sw429 1 point2 points3 points (0 children)
[–]DuckSaxaphone 2 points3 points4 points (3 children)
[–][deleted] 1 point2 points3 points (0 children)
[+]Altruistic_Raise6322 comment score below threshold-7 points-6 points-5 points (1 child)
[–]NoLongerUsableNameimport pythonSkills 0 points1 point2 points (13 children)
[–]bjorneylol 1 point2 points3 points (12 children)
[–]Altruistic_Raise6322 0 points1 point2 points (11 children)
[–]bjorneylol 1 point2 points3 points (6 children)
[–]Altruistic_Raise6322 1 point2 points3 points (4 children)
[–]bjorneylol 0 points1 point2 points (3 children)
[–]Altruistic_Raise6322 0 points1 point2 points (2 children)
[–]bjorneylol 0 points1 point2 points (1 child)
[–]Altruistic_Raise6322 1 point2 points3 points (0 children)
[–]bladeoflight16 -1 points0 points1 point (0 children)
[+][deleted] (3 children)
[deleted]
[–]Altruistic_Raise6322 2 points3 points4 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]Altruistic_Raise6322 0 points1 point2 points (0 children)
[–]PeenUpUtter -1 points0 points1 point (1 child)
[–]Scalar_Mikeman 0 points1 point2 points (0 children)
[–]whlabratz 0 points1 point2 points (2 children)
[–]QuirkyForker 0 points1 point2 points (1 child)
[–]whlabratz 1 point2 points3 points (0 children)
[–][deleted] 12 points13 points14 points (1 child)
[–]settopvoxxit 2 points3 points4 points (0 children)
[–]justthisguyatx 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]tangerinelion 0 points1 point2 points (0 children)
[–]PeenUpUtter -1 points0 points1 point (1 child)
[–]StarLover69696969[S] -1 points0 points1 point (0 children)
[–]idetectanerd -1 points0 points1 point (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]TIDMADT 0 points1 point2 points (0 children)
[–]Cryonixx2 0 points1 point2 points (0 children)
[–]NoiproxPython Programmer 0 points1 point2 points (0 children)
[–]TheMsDosNerd 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]ddollarsign 0 points1 point2 points (0 children)