Live data from Hacker News

Most popular Python packages now support Python 3

py3readiness.org

21–30 of 166 posts

Re: Most popular Python packages now support Python 3

#21

I would like to know if fellow HNers who regularly code in Python are using f-strings and type hints in your production code or otherwise. I often find myself inclined to use type hinting.

New code at Facebook does use both. Instagram uses both extensively.

Re: Most popular Python packages now support Python 3

#23

I would like to know if fellow HNers who regularly code in Python are using f-strings and type hints in your production code or otherwise. I often find myself inclined to use type hinting.

f-strings are great. I use Ubuntu 16.04 LTS so I thought I was stuck without easy access to Python 3.6 until I found this PPA. https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6

Re: Most popular Python packages now support Python 3

#24
post #12

Yup at this point there is no reason to not use Python 3 for new projects. What I'm finding actually is that some companies that have their codebase in Python 2 have actually started migrating to Golang rather than Python 3, because of the increased performance benefits. I'm kind of sad about this, but I think that Golang will eventually replace Python as the go-to back-end server language (maybe even data processing…

As much as a I like Go in general, there are two pythonic things that, IMO, really should go into the next major revision. 1: sets; in this day and age, not having sets as native, stdlib-provided data types is simply unacceptable.[ß] 2: The ease of python's "in" keyword; being able to test for a key in a map (or set!) without any indirection is crucial ß: granted, IIRC python moved sets into native stdlib types only…

Sets don't need to be native in languages that are both fast and have a proper type system. For example, rust and OCaml have a standard set in their stdlib, but it's not builtin. Of course, go lacking generics makes it impossible to implement a decent set type in it.

Re: Most popular Python packages now support Python 3

#25

I would like to know if fellow HNers who regularly code in Python are using f-strings and type hints in your production code or otherwise. I often find myself inclined to use type hinting.

F-strings are super convenient, especially for transient expressions such as debugging statements, but also for things like error messages (I often shy away from them on library code for backwards compatibility, though). I wish they were available as a __future__ import.

Re: Most popular Python packages now support Python 3

#26
post #18
post #12

Earlier quoted context omitted.

As much as a I like Go in general, there are two pythonic things that, IMO, really should go into the next major revision. 1: sets; in this day and age, not having sets as native, stdlib-provided data types is simply unacceptable.[ß] 2: The ease of python's "in" keyword; being able to test for a key in a map (or set!) without any indirection is crucial ß: granted, IIRC python moved sets into native stdlib types only…

Sets, if you mean a collection that contains no more than 1 of something, are easy. Use a map with struct{}{} values. If ordering is important, it's ~30 lines of simple code to encase a slice and a map in a struct and define your desired interface. Testing for a key's existence is easy as well. Accessing a map returns two variables--the 1st is the value itself. The 2nd variable is that "exists" variable you're asking…

Yes you can hack sets into most any modern language, but mostly involves writing annoying looking boilerplate, or pulling in external libraries.

I think parent is looking for a native set type (which I agree with). I don't know if it has a place in golang, but I always sigh and roll my eyes when I have to implement a set in most languages.

Re: Most popular Python packages now support Python 3

#27
post #8

Clicking around, those that don't seem to be: 1. Obsolete. Either explicitly so (e.g. Google API) or abandoned, without even a minor/patch release (initools, 2010) or in some cases a code commit (e.g. pathtools, 2012) for five years or more. I suspect that they will never be Py3, the community will just move on to alternatives. 2. Working hard to bring support (e.g. ansible). 3. Part of the graphite ecosystem. If the…

Huh. I know if I have a server that only has python3, Ansible can configure that server with only the python3 interpreter available. So Ansible can use python3 on the box it's configuring, but not the host it's running from?

Re: Most popular Python packages now support Python 3

#28

I would like to know if fellow HNers who regularly code in Python are using f-strings and type hints in your production code or otherwise. I often find myself inclined to use type hinting.

I'm still on on Python 3.5, probably will be until Ubuntu 18.04 comes out.

There is support for type hints in Python 3.5. You may want to check this out at:

https://docs.python.org/3.5/library/typing.html

Re: Most popular Python packages now support Python 3

#29

I would like to know if fellow HNers who regularly code in Python are using f-strings and type hints in your production code or otherwise. I often find myself inclined to use type hinting.

New code at Facebook does use both. Instagram uses both extensively.

You have links to public repos, or you're speaking from work experience?

Re: Most popular Python packages now support Python 3

#30
Python 3 is a case study on how you should never create a new version of a language implementation that can't load and interface with code written for the old version.

After almost 10 years, the old version is still in use, and the new version isn't even that much better.

Post reply on HN