I thought python was supposed to be easy. Yea, don't laugh.

Diconica

Well-Known Member
Apr 25, 2020
1,101
1,150
In C i can write to nullptr or divide by zero, does it make C unsuitable for industrial proposes? Why not use java or rust or whatever safe thing is popular today?
Main reason to use python is speed of development, ease of maintenance and support for most common programming paradigms.
If your goals is safety or performance then python is probably not good choice for you. It's not bad language, but it's not one-size-fit-all.

As for protection, here is something funny/horrible for you :D
Code:
import sys
import ctypes

def change_value_of_int(n,new_value):
  obj=ctypes.cast(id(n),ctypes.POINTER(ctypes.c_int))
  if sys.version_info.major==2:
    obj[2]=new_value
  else:
    obj[3]=new_value

x=42
print("42:",x)
change_value_of_int(42,69)
print("42+1:",x+1)
x=40
print("40, 40+2:",x,x+2)
I wasn't saying its a bad language.
Just saying I just learned it couldn't be used for it any more. We don't use C that much any more unless there is no way to get around it. That's not that common. It's still used for OS and Driver development in a lot of instances.
There are some groups using it java and rust.
I was mainly thinking python would have been pretty good at knocking out control displays more so than the underlying code for some of the equipment. But that's generally a more vulnerable area to attack vs the actual equipment.
 

Diconica

Well-Known Member
Apr 25, 2020
1,101
1,150
I find that statement kind of odd.
In a language like C++ it's much harder to change stuff you aren't supposed to but there isn't much in the way of actual security around it.
If you know how a class is laid out in memory you can still modify whatever you want. And if you know the address of a function as well as it's header you can replace it with your own.

My understanding of access modifiers like "private" is not that it makes your code more secure, but that it creates a strong incentive for other programmers to not access it directly. If I see a "private" field in a C++ project I'm 99% sure it doesn't get modified in a weird way. But if a bad actor wanted to modify it, they can still do that.
Idk, maybe I'm misunderstanding what you meant by that.
If you have a large project and a dozen people writing different parts. One of those guys creates a class its so none of the other developers can write a function or code that modifies the variable in a way that isn't intended. The class methods are supposed to be the access point to the data. That way tom doesn't write some weird code no one knows about that screws with the stear or accelerator because he thinks it would be funny to do so or whatever stupid reason. Stupid shit like actually happens.
 

xj47

Member
Nov 4, 2017
240
399
If you have a large project and a dozen people writing different parts. One of those guys creates a class its so none of the other developers can write a function or code that modifies the variable in a way that isn't intended. The class methods are supposed to be the access point to the data. That way tom doesn't write some weird code no one knows about that screws with the stear or accelerator because he thinks it would be funny to do so or whatever stupid reason. Stupid shit like actually happens.
Fair enough.

I love using python personally but I do have my doubts about how well it scales to very large projects
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,391
15,307
If you have a large project and a dozen people writing different parts. One of those guys creates a class its so none of the other developers can write a function or code that modifies the variable in a way that isn't intended. The class methods are supposed to be the access point to the data.
And the project was developed using an oriented object language in order to let the other members of the team write code that will modifies the variable in a way that isn't initially intended, if they need to. Obviously, whatever the language they should do it by inheritance, not by directly addressing the class, but it's one of the intent and interest of using objects.
It's why private and protected methods exists, in order to limits the possibility of rewriting, keeping private (should not) or even protected (will never) the critical parts of the class. If one broke your class by inadvertently rewriting something he shouldn't, before being his fault it's yours, for not having correctly declared your methods.
And in this regard Python do a good job. It only use convention to declare private and protected methods, but enforce the obfuscating of protected ones. There's still a way to deal with them, but it's dirty and there's no way to not know that you're doing something you really shouldn't.

After, it's like everything, you are a grown man, and you take responsibility for what you do, whatever how dirty it can be. The clean way to do this is by creating a class that will inherit from function and extend it to add the method(s)/attribute(s) you'll need. But Python decided to go further and let you do it dynamically for punctual use, through the use of a set of dedicated instructions, in order to keep the code explicit.



That way tom doesn't write some weird code no one knows about that screws with the stear or accelerator because he thinks it would be funny to do so or whatever stupid reason. Stupid shit like actually happens.
There's nothing unknown in Ren'Py code, and even less funny things. The code isn't the most optimized one, but it's efficient and totally explicit. It's not because you don't understand it that it's weird or some stupid shit.



I love using python personally but I do have my doubts about how well it scales to very large projects
Well, Ren'Py is a very large and complex project, that handle three different dedicated languages. It's not as efficient and fast as Unity can be, but it's not its intent, and at its scale it do its job pretty well. There's also , a web framework, , a neural networks base, and so on.
Modern hardware, specially CPUs, make Python slowness less important nowadays, while the use of Python make the project easier to maintain. It's the advantage of a language designed around human readability, for once the code can effectively be self explanatory. It doesn't mean that choosing Python is some universal solution, but when used by (semi-)professionals, the project will be efficient enough, clean and stable.
 
Sep 4, 2020
91
47
  1. A thread worthy of a small tub of popcorn to enjoy while reading. Some serious shade being thrown back and forth! I'm starting to understand why the Romans loved their gladiatorial games so much.
  2. Kinda glad I rejected Ren'Py that uses Python (of which I know very little) to go with Twine that uses JavaScript (with which I have had extensive experience). I'm certain my Python would have been horrible.
 
  • Like
Reactions: Diconica

Diconica

Well-Known Member
Apr 25, 2020
1,101
1,150
And the project was developed using an oriented object language in order to let the other members of the team write code that will modifies the variable in a way that isn't initially intended, if they need to. Obviously, whatever the language they should do it by inheritance, not by directly addressing the class, but it's one of the intent and interest of using objects.
It's why private and protected methods exists, in order to limits the possibility of rewriting, keeping private (should not) or even protected (will never) the critical parts of the class. If one broke your class by inadvertently rewriting something he shouldn't, before being his fault it's yours, for not having correctly declared your methods.
And in this regard Python do a good job. It only use convention to declare private and protected methods, but enforce the obfuscating of protected ones. There's still a way to deal with them, but it's dirty and there's no way to not know that you're doing something you really shouldn't.
In C++ you only inherit something if you want to make it a part of another class.
In most cases they don't want that. In fact they have a hole issue were you are supposed to do one thing per class per function. Yep, we break that rule all the time but if you start inheriting everything just to get access to its variables. C++ just breaks.
It's not designed for it.
Class functions are the perfered means of accessing data in a C++ class.

Also even if you inherited a class and its data is set to private the inheriting class would not be able to access it without using the classes function.

Like I said it is pretty much the exact opposite of the way python does. JAVA, C#, are even more strict in the same way.

After, it's like everything, you are a grown man, and you take responsibility for what you do, whatever how dirty it can be. The clean way to do this is by creating a class that will inherit from function and extend it to add the method(s)/attribute(s) you'll need. But Python decided to go further and let you do it dynamically for punctual use, through the use of a set of dedicated instructions, in order to keep the code explicit.
Python wasn't always Object Orientated. They added new classes in 2.2. In other words the reason python is this way it wasn't planned it was an after thought. By the time they added in OOP they didn't want to destroy the code base and libraries they had.

I knew python wasn't always OO that because I had to give my evaluation of it to DOD in the 90's based on a data sheet they handed me.
So I just looked up when the version changed.

There's nothing unknown in Ren'Py code, and even less funny things. The code isn't the most optimized one, but it's efficient and totally explicit. It's not because you don't understand it that it's weird or some stupid shit.
Don't get me wrong I'm not putting down python. I just giving the perspective of what someone coming from another language to it sees. Frankly, I think the other guys I know who tried it gave up to soon.

Well, Ren'Py is a very large and complex project, that handle three different dedicated languages. It's not as efficient and fast as Unity can be, but it's not its intent, and at its scale it do its job pretty well. There's also , a web framework, , a neural networks base, and so on.
Modern hardware, specially CPUs, make Python slowness less important nowadays, while the use of Python make the project easier to maintain. It's the advantage of a language designed around human readability, for once the code can effectively be self explanatory. It doesn't mean that choosing Python is some universal solution, but when used by (semi-)professionals, the project will be efficient enough, clean and stable.
Renpy is fine for what it is intended for. I think a number of the current people though using it are stepping a bit beyond that point. They would probably be better served by moving to something that is more geared toward what their intended use is.
They are programming most of their games in many cases in python and using very little of the Renpy language.
So I was thinking if they were given a tool geared more that way that still made things relatively easy it might help them.