On Fri, Feb 21, 2014 at 7:42 AM, Nick Coghlan <ncoghlan at gmail.com> wrote: > It's a relatively arcane scoping rule that only matters if you have > non-trivial logic at class scope. The vast majority of Python > programmers will never have to care, because they do the typical thing > and their class bodies consist almost entirely of function definitions > and relatively simple assignment statements. That is definitely an esoteric corner. It's only really bitten me when I was doing stuff with nested classes [1] and mined too deeply. Here's a simple example: class Spam: class Ham: A = None B = None class Eggs: class Bacon(Ham): A = 3 If I recall correctly, Larry Hastings ran into something similar a while back. -eric [1] The nested classes were used just for easy-to-read namespaces, effectively hijacking the class definition syntax with no intention of actually using the class as a type.
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