Live data from Hacker News

Instagram Makes a Smooth Move to Python 3

thenewstack.io

41–50 of 62 posts

Re: Instagram Makes a Smooth Move to Python 3

#41
post #17
post #14

Earlier quoted context omitted.

And at that scale you can make additional microservices for the critical path where it matters.

Not really. You'll notice a pattern in most tech bigcos where they move from dynamic lang X to a statically typed language that can multithread properly. A few examples: Ruby on rails to java (twitter). Java & c++ (google). Java (linked in). Python/Node -> Java/Go (uber). Or they start doing silly things like make a new VM (facebook).

Google uses plenty of Python, no?

I don't think threading is a relevant factor for many of those decisions. Perf and static typing, sure.

Re: Instagram Makes a Smooth Move to Python 3

#42

Earlier quoted context omitted.

The information from annotations is exposed to the runtime, but nothing in the runtime treats them as types or performs any type checking. The feature was introduced as a generic way to annotate functions, without being constrained to a single use case (type checking), and all the tools which actually do type-checking based on annotations are third-party.

C++ also does do any type checking at runtime. Compile time checking is all that really matters.

The CPython implementation does have a "compile" step (to produce bytecode, which is what actually gets executed, by a simple stack-based virtual machine), and does not do any type checking in that step no matter how many annotations you give it.

Re: Instagram Makes a Smooth Move to Python 3

#43
post #7

types in python 3.5?! I had no idea -- that's exciting.

Anybody have experience of using this? More info: https://docs.python.org/3/library/typing.html I've been using TypeScript a lot recently and it has had a big impact on reducing bugs and making refactoring easier so something similar for Python looks great.

See https://youtu.be/7ZbwZgrXnwY for a talk from the mypy team.

Description: https://us.pycon.org/2017/schedule/presentation/678/

Re: Instagram Makes a Smooth Move to Python 3

#44
post #15
post #7

types in python 3.5?! I had no idea -- that's exciting.

The language itself supports annotations, without any actual typechecking. You use http://mypy-lang.org/ to get the static checking.

There is also Google's pytype: https://github.com/google/pytype

Re: Instagram Makes a Smooth Move to Python 3

#45
post #30
post #16

Earlier quoted context omitted.

Note they are type annotations . They are for tooling/development only; the runtime doesn't care about the types at all.

which language's run time cares about types?

Type information is used in JS engines to compile into native code. If type information is too vague or change you can have deoptimization[0]

[0]http://jayconrod.com/posts/54/a-tour-of-v8-crankshaft-the-op...

Re: Instagram Makes a Smooth Move to Python 3

#46
post #16
post #7

types in python 3.5?! I had no idea -- that's exciting.

Note they are type annotations . They are for tooling/development only; the runtime doesn't care about the types at all.

You say that like it's a bad thing, but that's what a static language is - types are checked at compile time and, hopefully, forgotten about at runtime.

Re: Instagram Makes a Smooth Move to Python 3

#47
post #30
post #16

Earlier quoted context omitted.

Note they are type annotations . They are for tooling/development only; the runtime doesn't care about the types at all.

which language's run time cares about types?

Any dynamic language - by definition, they check types at runtime.

Or, unfortunately, a lot of static languages. Any static language that allows type casting, for instance - that's the only way they can check whether a cast from a type to one of its descendants is valid (eg, in Java, casting an Object to a, say, URL).

Re: Instagram Makes a Smooth Move to Python 3

#48
I've been writing mostly small python projects for 15 years, starting with 2.2.

I've had no issues in the migration to 3.

I did some building with it around 3.3, starting to commit around 3.4, and with 3.5 I build everything in it.

I don't have the performance challenges Instagram has, but my experience with application development in general is that 98% of performance challenges can be solved with (not-too) clever engineering. This applies to projects in every language.

There are a vanishingly small number of scenarios where the performance of your runtime actually dictates your performance limits.

If you're working on something and are worried about Python's performance, or which Python to use, don't. Use 3, optimize later.

Re: Instagram Makes a Smooth Move to Python 3

#49
post #15

Earlier quoted context omitted.

The language itself supports annotations, without any actual typechecking. You use http://mypy-lang.org/ to get the static checking.

There is also Google's pytype: https://github.com/google/pytype

That looks like it adds types rather than checks?

Re: Instagram Makes a Smooth Move to Python 3

#50
post #17
post #14

Earlier quoted context omitted.

And at that scale you can make additional microservices for the critical path where it matters.

Not really. You'll notice a pattern in most tech bigcos where they move from dynamic lang X to a statically typed language that can multithread properly. A few examples: Ruby on rails to java (twitter). Java & c++ (google). Java (linked in). Python/Node -> Java/Go (uber). Or they start doing silly things like make a new VM (facebook).

Linkedin was mostly scala and then they did some stuff with node.js >___>

Walmart also moved to node.js.

Hype was real.

Post reply on HN