News for hackers. Stuff that matters.
Re:Pydis: Redis clone in Python 3 to make points about perfo... by liveoneggs on Saturday March 02, 2019 @07:57PM (#19292092)
clearly you are suffering from

> Unfortunately many programmers, due to their lack of experience, of some knowledge of computer architecture(s), or of an in-depth understanding of the task they are given

Where you fail to see that C libs being linked into python code is the same as python code performance

Re:Pydis: Redis clone in Python 3 to make points about perfo... by jchw on Saturday March 02, 2019 @08:38PM (#19292199)
I think the most bizarre part of that paragraph is the note about dropping type safety for performance. I mean... Python is very much not type safe. Memory safe perhaps, though that argument is out the window if you are willing to accept arbitrary C extensions. All in all... It seems either I'm missing the point, or the author is.
Re:Pydis: Redis clone in Python 3 to make points about perfo... by boramalper on Sunday March 03, 2019 @04:30AM (#19293600)
> Python is very much not type safe

It's strongly typed and mypy adds static typing support too (so you end up with a strong gradually typed language). Would you consider it insufficient?

Re:Pydis: Redis clone in Python 3 to make points about perfo... by jchw on Sunday March 03, 2019 @04:20PM (#19296975)
>It's strongly typed

Sure, it's strongly typed, but I think that's irrelevant, at least if my understanding of the term 'type safe' is correct. From Wikipedia:

>In computer science, type safety is the extent to which a programming language discourages or prevents type errors.

The thing is, a Python program that causes a type error is valid, even if it crashes. TypeError is strictly a runtime error. To me, that is the epitome of not having type safety.

Of course pretty much everything is runtime in Python, by virtue of it being a script language. So you really would need a type checking stage, like TypeScript. But...

>mypy adds static typing support too

In my opinion, MyPy is not sufficient to represent common usages of Python's type system. Even with the recent addition of structural typing, many Python programs just do things that are not easily typed. An example would be, in Django, many things in the core directly patch the Request object, and there's really not a terribly sane way to represent this in a reasonable type system. I feel Python encourages all kinds of type craziness, with metaclasses, 'file-like' objects, etc.

Opinions aside... Since MyPy is not part of Python itself (yet?) it is unfair to call the Python language 'type safe' simply by virtue of a type checker existing, for the same reason one wouldn't call JavaScript type safe (I do acknowledge that both of them definitely have a chance of becoming 'official', but neither have yet, and that's the important part.)

Not strictly related, but there are also other type checkers, too: At Google, we've got pytype (https://github.com/google/pytype) and Facebook has pyre-check (https://github.com/facebook/pyre-check). I've tried neither myself.