Actually, what python does is treating argument list exactly like a tuple. This is how built-in python functions look like:
Code: Select all
Py_Object* someBuiltInFunction(Py_Object* self, Py_Tuple* args){
some code to unpack the tuple
whatever other code
}
as for this:
Infinite Chalupas wrote:Another thought I had is that attributes should be placed to the right of objects in some way instead of the left, like:
what I do with my language is use () to declare private attributes and methods for both classes and modules, so it ends up looking like this:
the name of the variable being enclosed in () gives the programmer an overall feel of encapsulation, which is exactly what's happening, so the programmer receives much more info without reading that much, that way you avoid what I already talked about (private static final long int x = 0, f*ck that).
Attributes with no brackets aren't necessarily public, they are in fact properties, my language generates default setters and getters unless you override them.
Code: Select all
class XYLocation:
int x
int y
void __init__(int x, int y):
self.x = x
self.y = y
@setter x
int setX(int x):
return
@setter y
int setY(int y):
return
in the above class, x and y appear to be public and accessible from the outside, but when trying to modify them, nothing happens, thus giving you encapsulation without looking like it.
Properties are very important as they allow you to change parts of the class without clients having to change their code.