> > Can someone provide a reason why you'd want to use nested classes? > > I've never felt this need myself. What are the motivations? > > Nested classes provide a nice way (IMO) to write metaclasses and keep > them near the classes using them: > > class X(object): > class __metaclass__(type): > .... Sorry, that looks really ugly to me, and makes it impossible to share a metaclass. It sounds like you're trying to emulate Smalltalk's idea of metaclasses. Don't do this; Python's concept of metaclasses is different, and trying to do it the Smalltalk way is counterproductive. (For example, multiple inheritance from two classes with different metaclasses doesn't work unless one metaclass inherits from the other.) --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4