News for hackers. Stuff that matters.
Re:Interfaces and Protocols in Python by padobson on Friday March 19, 2021 @03:12PM (#26517213)
This is what I was thinking about reading this post. Why add things to Python to make it strongly typed? Why not just use Java or C#?
Re:Interfaces and Protocols in Python by nerdponx on Friday March 19, 2021 @03:40PM (#26517454)
1. Because people like Python.

2. The type system is both gradual and not enforced by default. This means you benefit from the rapid prototyping and general freedom of dynamically-typed code, but you have the option to layer on the additional safety of static type checking as the project grows. There aren't many other gradually-typed languages out there anyway; Julia, Typed Racket, and Common Lisp aren't exactly in widespread industry use for general-purpose server dev.

Re:Interfaces and Protocols in Python by smallnamespace on Friday March 19, 2021 @04:13PM (#26517743)
Don't forget JavaScript/TypeScript.

You can either start with JS and add types later on (you can mix them on a per-module/file basis), or just start with TypeScript, with a loose configuration.

Re:Interfaces and Protocols in Python by dragonwriter on Friday March 19, 2021 @04:02PM (#26517631)
> Why add things to Python to make it strongly typed?

Python is strongly typed. The support for external tools is to enable static type checking, not strong typing.

> Why not just use Java or C#?

Why add “dynamic” to C#, why not just use Python?

Re:Interfaces and Protocols in Python by 6gvONxR4sf7o on Friday March 19, 2021 @05:37PM (#26518363)
The libraries that make my job easier are in python. A language ecosystem is often more important than the language itself.
Re:Interfaces and Protocols in Python by ralmidani on Friday March 19, 2021 @03:28PM (#26517355)
Not an exhaustive list of possible reasons:

- (number_of_people_who_enjoy_coding_with_python_more_than_coding_with_c_sharp_or_java > 0) == True

- Some people have large existing codebases, and would rather add types gradually than have to port all their logic to another language.

- In terms of being free and open source, Python > C# > Java (meta: can you even do a comparison like that in C# and/or Java?)

Re:Interfaces and Protocols in Python by nerdponx on Friday March 19, 2021 @03:33PM (#26517400)
I thought Java being not-open-source in 2021 was a myth, no? What about OpenJDK (GPL licensed)?
Re:Interfaces and Protocols in Python by ralmidani on Friday March 19, 2021 @03:57PM (#26517598)
GPL2 has no explicit patent grant, and Oracle's behavior does not signal good intentions.
Re:Interfaces and Protocols in Python by Gibbon1 on Friday March 19, 2021 @03:19PM (#26517279)
Because Java and especially C# aren't 'cool'