Talks - Bruce Eckel: Rethinking Objects

  Рет қаралды 5,089

PyCon US

PyCon US

Күн бұрын

This presentation revisits two core concepts of Object-Oriented programming: encapsulation and code reuse. Using a series of examples, we'll ask whether these concepts have satisfied their promises, and how functional approaches can do a better job. We'll also see that objects still have value in making library use easy.

Пікірлер: 19
@The_Hynek
@The_Hynek Жыл бұрын
Great talk, one small amendment: you don't have to inherit from a protocol for a class to be considered an implementation of it - you just have to fulfill the API! It's called structural subtyping and is kind of the whole point of Protocols (if you want interfaces by inheritance, we've had the abc module forever). This will print True: ``` from attrs import frozen from typing import Protocol, runtime_checkable @runtime_checkable # this makes a Protocol work with isinstance() class Coord(Protocol): x: int y: int @frozen class Point: x: int y: int print(isinstance(Point(1, 2), Coord)) ```
@sfermigier
@sfermigier Жыл бұрын
Funny that Bruce is using attrs in his talk and you are using dataclasses in yours 😂
@rednafi
@rednafi Жыл бұрын
Fantastic talk. This and Hynek's talk on object orchestration have been the best talks of Pycon 2023 for me.
@Ca1vema
@Ca1vema 11 ай бұрын
Got a link?
@sghosh4223
@sghosh4223 11 ай бұрын
m.kzbin.info/www/bejne/oWmwhWiinqiEbck
@jamesdow21
@jamesdow21 11 ай бұрын
@@Ca1vema kzbin.info/www/bejne/oWmwhWiinqiEbcksi=Iqqp1GjQ4ZrYAumr
@eclecticaaronbentley
@eclecticaaronbentley 10 ай бұрын
The audio seems messed up. On my 5.1 system, Bruce is coming from the rear speakers, and on my Bluetooth speaker, it's quiet, tinny, and has distortions that sound like sloshing water. My Nest Hub Max sounds similar to the Bluetooth speaker, but without the sloshing.
@cygn
@cygn 9 ай бұрын
sounds like the sound is out of phase. I.e. the left and right channels almost cancel each other out. Sounds very unpleasant. It could be fixed with some tool like audacity that allows you to switch the phase of one channel.
@eclecticaaronbentley
@eclecticaaronbentley 10 ай бұрын
The discussion of protocols treats them like abstract base classes, but they are not. In Python that doesn't use type hinting, protocols are simply duck-typing: you are a file-like object if you implement the public attributes that a file does. PEP 544 added protocols to type-hinting with the explicit purpose of not requiring the protocol to be used as a parent class. Instead of "nominal" subtyping, like Abstract Base Classes, this is "structural" subtyping. This confusion extends to the comparison of protocols with Rust Traits. Rust structs must be declared to support a given trait. This is nominal subtyping, unlike protocols. As I understand it, a better comparison would be with Go's interfaces. As with Python's typing.Protocol, a Go value implements an interface if it implements the methods of that interface, without needing any declaration that it implements that interface. I haven't used Go extensively, but "A Tour of Go" says "A value of interface type can hold any value that implements [the interface type's set of method signatures.]"
@Rickety3263
@Rickety3263 10 ай бұрын
Oh no! Audio is corrupted?!
@imrepub
@imrepub 9 ай бұрын
looks like on mono audio output the sound is scrambled
@dustinking2965
@dustinking2965 Жыл бұрын
I'd be interested to hear the full version of this talk from the universe where he had 45 minutes or an hour. Or maybe there would be a better format for it. PS, I learned C++ from Bruce's book years ago, so thanks for that!
@michaelkleehammer6552
@michaelkleehammer6552 9 ай бұрын
A small nit in the part talking about immutability. The integer `_n` was not updated had nothing to do with "primitives" which don't exist in Python. That is straight from Java. It is because the integer class is already immutable and the "+=" operator is already making a copy of it.
@dirkfromhein
@dirkfromhein 10 ай бұрын
Wait you jump from Smalltalk directly to C++? Objective-C anyone? Java was way way more influenced by Objective-C than Smalltalk! Sun was pretty much about to adopt OpenStep when Java won out internally.
@gogognomenl
@gogognomenl 3 ай бұрын
I cannot here the sound.
@wtpollard
@wtpollard Жыл бұрын
Not a very satisfying talk. The history part of the talk was mildly interesting, but it didn't feel like he actually had any strong points to make when it came to reconsidering when and how to use objects.
@Blaxter
@Blaxter 11 ай бұрын
"Those who cannot remember the past are condemned to repeat it." Something very true in software development, knowing how things have evolved is something very important
@Lexaire
@Lexaire 6 ай бұрын
I found the talk very informative. Try watching it again. He shows examples of constructing adapters and protocol-based functions instead of class methods.
@davebaker1549
@davebaker1549 4 ай бұрын
Damn this defective sound level.
Talk - Bruce Eckel: Making Data Classes Work for You
28:38
PyCon US
Рет қаралды 7 М.
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 20 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,4 МЛН
Un coup venu de l’espace 😂😂😂
00:19
Nicocapone
Рет қаралды 11 МЛН
Talk - Trey Hunner: Python Oddities Explained
25:45
PyCon US
Рет қаралды 8 М.
Object Oriented Programming is Good | Prime Reacts
31:30
ThePrimeTime
Рет қаралды 318 М.
Talk: Conor Hoekstra - Beautiful Python Refactoring
30:05
PyCon US
Рет қаралды 24 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,2 МЛН
Don't use VSCode
35:31
PyCon South Africa
Рет қаралды 227 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 810 М.
"What can't WebAssembly do?" - Katie Bell (PyCon AU 2023)
29:03
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 20 МЛН