@monorail I don't get it
@The_T the British talk weird
@onfy that's true
@wallhackio (I know, the joke was that I didn't get it so I immediately go to @monorail to explain it)
@wallhackio @The_T @monorail is it similar to main()?
@wallhackio @The_T @monorail ah you see despite knowing how to program to a limited extent, I do not, in spite of this, know what anything is called
@wallhackio @The_T @monorail I can't even find my git repo
@wallhackio @The_T @monorail C, AGS, AGI
@onfy @wallhackio @monorail what does that spell! Cagsagi!
@The_T @wallhackio @monorail Gaga Sic
@wallhackio @The_T @monorail I almost forgot about C# actually. it was the first one I learned haha (in high school) though in part because of linux I haven't really used it since
but AGS heavily resembles C# which helped a lot when I made a (terrible) game
@wallhackio @The_T @monorail AGI otoh is really old and more resembles a very limited mix of C and basic
⚠️ i've been writing python for most of my time on earth ⚠️
@wallhackio @The_T extremely loud incorrect buzzer
most languages don't have anything exactly equivalent to __init__
, but they have something equivalent to python's __new__
. in python we just prefer to create bare objects and initialize them rather than do it in the constructor for some reason
re: ⚠️ i've been writing python for most of my time on earth ⚠️
@monorail @wallhackio @The_T I'm an absolute noob at Python and mostly use it for non-object-oriented scripting, can you tell me about the difference between __new__
and __init__
?
re: ⚠️ i've been writing python for most of my time on earth ⚠️
@vaporeon_ @monorail @The_T normally in OOP, object instantiation logic is contained within a constructor, but Python decided to split the process into two steps:
1) __new__
is a function which returns the instantiated object,
2) __init__
is a function that receives the instantiated object and and initializes its state
It is very rare that a Python programmer ever use __new__
. In 99% of cases, what you would put in a constructor in some other language is put in the __init__
method when you use Python.
You can override __new__
, however, so that it returns anything you want. You typically do this when you subclass immutable types. Because, if you try to manipulate a subclassed immutable object in the __init__
function, well you can't. Because its immutable. So you have to override the creation of the object itself, typically by calling the superclass's constructor, in the __new__
method.
@wallhackio @monorail yes