Live data from Hacker News

Python 3.7 released

python.org

21–30 of 56 posts

Re: Python 3.7 released

#21
post #8

Notable parts of this release (IMO): * Data classes ( https://docs.python.org/3.7/library/dataclasses.html ) * New breakpoint() builtin ( https://docs.python.org/3.7/library/functions.html#breakpoin... ) * Dictionaries preserve insertion order. (Implemented in 3.6, but now is part of the official spec.)

[deleted]

Re: Python 3.7 released

#22
post #20
post #10

Earlier quoted context omitted.

Data classes are awesome! No more boilerplate __init__(self) methods needed. Another notable part of this release is type annotations: https://www.python.org/dev/peps/pep-0560/

Not a python coder, but from my understanding they are essentially auto-constructors?

Technically, no, but that is how they are written. __init__ was always called after the instance was already created. I think it was originally useful for managing inheritance and baseclass initialization, which can be handled other less hard-coded ways now. I could be wrong.

Re: Python 3.7 released

#23

Does anyone know how long new versions of Python take to get into Homebrew? Will current Python 3.6 installations on Homebrew autoupdate to Python 3.7 when brew update/brew upgrade is run and the new version is packaged?

The PR is open here: https://github.com/Homebrew/homebrew-core/pull/29490

Looks like it's waiting for tests to pass at present.

Re: Python 3.7 released

#24
post #8

Notable parts of this release (IMO): * Data classes ( https://docs.python.org/3.7/library/dataclasses.html ) * New breakpoint() builtin ( https://docs.python.org/3.7/library/functions.html#breakpoin... ) * Dictionaries preserve insertion order. (Implemented in 3.6, but now is part of the official spec.)

[deleted]

Re: Python 3.7 released

#25
post #19

I've become a heavy user of attrs, a small library that makes it easy to replace named tuples with a class that automatically includes initialisation and string representation functions. So I'm very glad to see data classes bringing this to the core language.

Why? attrs does it already.

Re: Python 3.7 released

#26
post #19

I've become a heavy user of attrs, a small library that makes it easy to replace named tuples with a class that automatically includes initialisation and string representation functions. So I'm very glad to see data classes bringing this to the core language.

Why? attrs does it already.

I'm not a python dev, but isn't less dependencies generally better? Or is attrs in Python natively already?

Re: Python 3.7 released

#27
post #8

Notable parts of this release (IMO): * Data classes ( https://docs.python.org/3.7/library/dataclasses.html ) * New breakpoint() builtin ( https://docs.python.org/3.7/library/functions.html#breakpoin... ) * Dictionaries preserve insertion order. (Implemented in 3.6, but now is part of the official spec.)

Data classes look cool. Maybe replacing named tuples in my future code? They always felt awkward to work with.

Will data classes save a ton of memory since you’re specifying the types?

Re: Python 3.7 released

#28
post #9

Data classes seem pretty neat. I haven't used attrs yet. And I rarely extend namedtuples, but it's nice to have a mechanism to do that built in. breakpoint() is certainly more memorable than the current incantation.

Yes! I’ve never been able to convince anyone to use pdb.settrace. I think they see the pdb and assume there’s a whole new thing they’d have to learn.

If I tell them you just call breakpoint() they might be willing to try it out.

Re: Python 3.7 released

#29
post #8

Notable parts of this release (IMO): * Data classes ( https://docs.python.org/3.7/library/dataclasses.html ) * New breakpoint() builtin ( https://docs.python.org/3.7/library/functions.html#breakpoin... ) * Dictionaries preserve insertion order. (Implemented in 3.6, but now is part of the official spec.)

Data classes look cool. Maybe replacing named tuples in my future code? They always felt awkward to work with. Will data classes save a ton of memory since you’re specifying the types?

Data classes are just regular classes with some methods generated for you. For now you still have to specify __slots__ manually to save memory.

Re: Python 3.7 released

#30

Earlier quoted context omitted.

Why? attrs does it already.

I'm not a python dev, but isn't less dependencies generally better? Or is attrs in Python natively already?

Attrs isn't in python natively. Not sure why less dependencies would be better though.
Post reply on HN