|
167 | 167 | d['foo'] = 4 |
168 | 168 | d['foo'] = 42 |
169 | 169 | d['bar'] = 123 |
| 170 | + d['__static_attributes__'] = () |
170 | 171 | >>> |
171 | 172 |
|
172 | 173 | Use a metaclass that doesn't derive from type. |
|
182 | 183 | ... b = 24 |
183 | 184 | ... |
184 | 185 | meta: C () |
185 | | - ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)] |
| 186 | + ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('__static_attributes__', ()), ('a', 42), ('b', 24)] |
186 | 187 | kw: [] |
187 | 188 | >>> type(C) is dict |
188 | 189 | True |
189 | 190 | >>> print(sorted(C.items())) |
190 | | - [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 42), ('b', 24)] |
| 191 | + [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('__static_attributes__', ()), ('a', 42), ('b', 24)] |
191 | 192 | >>> |
192 | 193 |
|
193 | 194 | And again, with a __prepare__ attribute. |
|
208 | 209 | d['a'] = 1 |
209 | 210 | d['a'] = 2 |
210 | 211 | d['b'] = 3 |
| 212 | + d['__static_attributes__'] = () |
211 | 213 | meta: C () |
212 | | - ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('a', 2), ('b', 3)] |
| 214 | + ns: [('__module__', 'test.test_metaclass'), ('__qualname__', 'C'), ('__static_attributes__', ()), ('a', 2), ('b', 3)] |
213 | 215 | kw: [('other', 'booh')] |
214 | 216 | >>> |
215 | 217 |
|
|
0 commit comments