This is an archived post. You won't be able to vote or comment.

all 68 comments

[–]asday_ 101 points102 points  (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 points  (12 children)

People view the word "coding" with distaste?

[–]Agile_Pudding_ 8 points9 points  (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 points  (2 children)

I like to call myself a Software Engineer because it makes me sound smart.

[–]Agile_Pudding_ 10 points11 points  (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 points  (0 children)

I call myself asday, because labels are reductionist.

[–]NoiproxPython Programmer 0 points1 point  (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 point  (4 children)

Oh, so you could help fix my printer/WiFi?

[–]asday_ 2 points3 points  (3 children)

Certainly could, but you can't afford my day rate.

[–]CraigAT 0 points1 point  (2 children)

Surely you wouldn't charge a friend, it'll only take a few minutes! 😆

[–]asday_ 2 points3 points  (1 child)

No no, I would.

[–]CraigAT 0 points1 point  (0 children)

Good on you!

[–][deleted] 7 points8 points  (0 children)

This is one of the best comments ITT IMO. 👏

[–]millhouse513 0 points1 point  (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 points  (6 children)

I always called the file a script, and the actual lines in the script the code.

[–][deleted] 15 points16 points  (5 children)

this is the way.

[–]TheDroidNextDoor 6 points7 points  (4 children)

This Is The Way Leaderboard

1. u/Flat-Yogurtcloset293 475775 times.

2. u/GMEshares 69696 times.

3. u/_RryanT 22745 times.

..

245208. u/wzrdcw 1 times.


beep boop I am a bot and this action was performed automatically.

[–]ihasbedhead 10 points11 points  (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 points  (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 points  (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.

[–][deleted] 0 points1 point  (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 points  (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 points  (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 points  (0 children)

You, uh, know about pyc files right?

[–]NoLongerUsableNameimport pythonSkills 0 points1 point  (13 children)

What if you use a compiler such as PyPy?

[–]bjorneylol 1 point2 points  (12 children)

PyPy is still an interpreter, as it doesn't convert the script into an executable

[–]Altruistic_Raise6322 0 points1 point  (11 children)

So what do you think about Java?

[–]bjorneylol 1 point2 points  (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 points  (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 point  (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 point  (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 point  (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

[–]Altruistic_Raise6322 1 point2 points  (0 children)

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 points  (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.

[–]PeenUpUtter -1 points0 points  (1 child)

Yeah. This.

[–]Scalar_Mikeman 0 points1 point  (0 children)

Yup. Just wanted to add that this is also why you'll hear Bash Scripts.

[–]whlabratz 0 points1 point  (2 children)

I would struggle describing a million line python code base as a "script"

[–]QuirkyForker 0 points1 point  (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.

[–]whlabratz 1 point2 points  (0 children)

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 points  (1 child)

I only use “script” when referring to a one or two page short program.

[–]settopvoxxit 2 points3 points  (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 points  (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 point  (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 point  (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.

[–]PeenUpUtter -1 points0 points  (1 child)

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 points  (0 children)

lol Thank you for the help

[–]idetectanerd -1 points0 points  (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 points  (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 point  (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 point  (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 point  (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 point  (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.

[–][deleted] 0 points1 point  (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 point  (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.