Re: Class definitions
Alan Gauld via Tutor <[email protected]> Mon, 1 Jan 2024 23:53:16 +0000
| Newsgroups | gmane.comp.python.tutor |
|---|---|
| Message-ID | <[email protected]> |
On 01/01/2024 22:05, dn via Tutor wrote: > Are you training folk, or requiring in Code Reviews, the use of > parentheses in stand-alone class definitions (or not)? > I'm not quite sure who you are addressing here? > Accordingly, wondered if you feel there is virtue in writing class-names > without parentheses, and only moving to such syntax upon reaching more > advanced levels involving inheritance (and multiple-inheritance)? My personal take is that it would have been consistent with Python's "explicit is better" approach if class definitions always required the parens with object where appropriate class MyClass(object): Even though it meant more typing. But Guido obviously thought different and we are stuck with the definition structures. Since the idiomatic way of writing it is to omit the parens that's what I do and encourage others to do too. Idioms are powerful tools. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor