Hacker News new | ask | show | jobs
by benmmurphy 463 days ago
python does have pointers under the hood. objects are passed via pointers. i think the implementation is tagged values in order to support dynamic typing and passing non-pointer values efficiently. but if there was no object tagging the runtime would be very similar to go. both have objects passed around as pointers using some form of garbage collection to handle memory safety.

the optional static type checking in python gives you a stronger typing than what golang does because you don't have to type everything as (None | Foo) and presumably its a type error to perform Foo operations on a (None | Foo) type.

1 comments

> python does have pointers under the hood. objects are passed via pointers.

Of courses there’s pointers under the hood. It’s a runtime built in C++.

But that doesn’t mean that Python -the language not the runtime- has pointers itself.

> the optional static type checking in python gives you a stronger typing than what golang does

“Stronger” isn’t the term you’d want to use there. Python is not more strongly typed than Go just by virtue of it being more a dynamic language.

I do agree that the Go type system is pretty inflexible though.