Created
October 16, 2022 22:23
-
-
Save Quetzalcohuatl/e1909f845146933b7f0276ff84a782a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car(): | |
def __init__(self, miles_traveled): | |
self.miles_traveled = miles_traveled | |
def ride(self, miles): | |
self.miles_traveled += miles | |
toyota = Car(miles_traveled=0) | |
def ride_a_lot(self, miles): | |
self.miles_traveled += miles*2 | |
fn = ride_a_lot.__get__(toyota, toyota.__class__) | |
toyota.ride = fn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment