Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This sounds like the pedantry FP folks are infamous for. By definition, Rust is also OO.

But I’d rather write Python, Node, Go, or Rust in a bastardized, data-oriented, faux-OO way than deal with GoF-style OO in Java, Kotlin, or C#. Sure, you can write code in a non-OO way in C#, but no one does. Whereas in Python, these days, people default to a data-oriented style.

This is just how I like to program. Plenty of folks enjoy OO thinking, and I have nothing against that. But when choosing a workplace, I’m fortunate enough to be able to ask if the codebase is OO-heavy—and politely decline if it is.



Indeed, I have ported Weekend Raytracing Project from C++ OOP into Rust OOP, just fine and is available as contributions to mankind on Github.

Are you aware Python basic types like numbers and functions are objects with methods and inheritance?

    num=23
    print(num)
    print(type(num)) 
    print(dir(num))
 
    23

    <class 'int'>

    ['__abs__', '__add__', 
     '__and__', '__bool__', 
     '__ceil__', '__class__', 
     '__delattr__', '__dir__', 
     '__divmod__', '__doc__', 
     '__eq__', '__float__', 
     '__floor__', 
     '__floordiv__', 
     '__format__', '__ge__', 
     '__getattribute__', 
     '__getnewargs__', 
     '__getstate__', '__gt__', 
     '__hash__', '__index__', 
     '__init__', 
     '__init_subclass__', 
     '__int__', '__invert__', 
     '__le__', '__lshift__', 
     '__lt__', '__mod__', 
     '__mul__', '__ne__', 
     '__neg__', '__new__', 
     '__or__', '__pos__', 
     '__pow__', '__radd__', 
     '__rand__', '__rdivmod__', 
     '__reduce__', 
     '__reduce_ex__', 
     '__repr__', 
     '__rfloordiv__', 
     '__rlshift__', '__rmod__', 
     '__rmul__', '__ror__', 
     '__round__', '__rpow__', 
     '__rrshift__', 
     '__rshift__', '__rsub__', 
     '__rtruediv__', '__rxor__', 
     '__setattr__', 
     '__sizeof__', '__str__', 
     '__sub__', 
     '__subclasshook__', 
     '__truediv__', '__trunc__', 
     '__xor__', 
     'as_integer_ratio', 
     'bit_count', 'bit_length', 
     'conjugate', 'denominator', 
     'from_bytes', 'imag', 
     'is_integer', 'numerator', 
     'real', 'to_bytes']

How do use them in Python without OOP?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: