00:12:32.937,00:12:35.937 Matt Niznik: If you've used classes in other languages, __init__ is similar to the concept of a constructor for a class 00:13:52.849,00:13:55.849 Matt Niznik: Similarly, self is similar to the concept of "this" in other languages 00:14:15.593,00:14:18.593 Greg Stumpf - NOAA Affiliate: Can you have multiple __init__ functions (i.e. constructors)? 00:14:29.907,00:14:32.907 Matt Niznik: Great question, let me look 00:14:48.484,00:14:51.484 Alan Brammer - NOAA Affiliate: no, __init__ is called once when you create the object. __init__ can call internal methods though 00:15:21.464,00:15:24.464 Matt Niznik: It looks like the preferred way in Python would be assigning a default to some of the parameters in init and branching within init based on what the user passes 00:16:08.320,00:16:11.320 Matt Niznik: https://stackoverflow.com/questions/682504/what-is-a-clean-pythonic-way-to-have-multiple-constructors-in-python 00:16:25.517,00:16:28.517 Greg Stumpf - NOAA Affiliate: Multiple constructors in Java require that each constructor has a different set of parameters. Nothing like that in Python? 00:16:28.380,00:16:31.380 Alan Brammer - NOAA Affiliate: yeah, doing "work" in the __init__ is controversial. but in reality it's just a function that returns the object, so can do anything any other code would do. 00:17:49.882,00:17:52.882 Matt Niznik: @Greg the closest thing I saw is defining multiple methods in the class that call init differently, but that's probably controversial too 00:18:16.024,00:18:19.024 Alan Brammer - NOAA Affiliate: ahh yeah. I think that gets into FactoryMethods and AbstractBaseClasses. They're there and possible, likely out of the scope of this course. It gets messy quick 00:18:54.310,00:18:57.310 Matt Niznik: Java and Python tend to be on opposite ends of the spectrum in terms of "strictness" 00:21:19.760,00:21:22.760 Matt Niznik: As an aside, I've always found "self" being the first param for a class method to be counterintuitive. 00:22:49.830,00:22:52.830 Greg Stumpf - NOAA Affiliate: I found this re: multiple constructors: https://www.geeksforgeeks.org/what-is-a-clean-pythonic-way-to-have-multiple-constructors-in-python/ 00:25:08.489,00:25:11.489 Matt Niznik: Yeah, that's probably the most reasonable way to do it if you really have to 00:26:14.467,00:26:17.467 Greg Stumpf - NOAA Affiliate: They are very common in Java 00:26:35.507,00:26:38.507 Matt Niznik: I remember 😀