4 ms·
In python, I find it pretty intuitive. It's very convenient to have "do these two objects have the same contents" vs "are these two the same object at the same
by foobarbecue 4y ago
In python, I find it pretty intuitive. It's very convenient to have "do these two objects have the same contents" vs "are these two the same object at the same memory address."
Other language design options are to use pointers / references, be strongly typed or be functional. Seems like you're saying all weakly-typed object-oriented languages are failures?
- roflyear 4y agoI don't think "===" in PHP is the same as "is" in Python, though? Identity is important (why would you want to check for 0, None, "", etc.. in separate cases, unless you want to?) but I don't think that is what "===" in PHP.
- flir 4y agoPHP exists in a place where everything's a string (HTTPland). Type coercion makes more sense there.
- foobarbecue 4y agoOh you're right. I actually was thinking python "is" was written "===" because I got confused with javascript, yikes. And I don't speak PHP. Anyway yeah being able to compare identity and equivalence separately seems important.