453
453
454
454
These represent a mutable set. They are created by the built-in :func: `set `
455
455
constructor and can be modified afterwards by several methods, such as
456
- :meth: `~set .add `.
456
+ :meth: `~add <frozenset .add> `.
457
457
458
458
459
459
Frozen sets
@@ -1272,7 +1272,7 @@ Special attributes
1272
1272
* - .. attribute:: type.__firstlineno__
1273
1273
- The line number of the first line of the class definition,
1274
1274
including decorators.
1275
- Setting the :attr: `__module__ ` attribute removes the
1275
+ Setting the :attr: `~type. __module__ ` attribute removes the
1276
1276
:attr: `!__firstlineno__ ` item from the type's dictionary.
1277
1277
1278
1278
.. versionadded :: 3.13
@@ -2351,6 +2351,9 @@ Customizing module attribute access
2351
2351
single: __dir__ (module attribute)
2352
2352
single: __class__ (module attribute)
2353
2353
2354
+ .. method :: module.__getattr__
2355
+ module.__dir__
2356
+
2354
2357
Special names ``__getattr__ `` and ``__dir__ `` can be also used to customize
2355
2358
access to module attributes. The ``__getattr__ `` function at the module level
2356
2359
should accept one argument which is the name of an attribute and return the
@@ -2364,6 +2367,8 @@ The ``__dir__`` function should accept no arguments, and return an iterable of
2364
2367
strings that represents the names accessible on module. If present, this
2365
2368
function overrides the standard :func: `dir ` search on a module.
2366
2369
2370
+ .. attribute :: module.__class__
2371
+
2367
2372
For a more fine grained customization of the module behavior (setting
2368
2373
attributes, properties, etc.), one can set the ``__class__ `` attribute of
2369
2374
a module object to a subclass of :class: `types.ModuleType `. For example::
@@ -2685,7 +2690,7 @@ class defining the method.
2685
2690
.. versionadded :: 3.6
2686
2691
2687
2692
2688
- When a class is created, :meth: `type.__new__ ` scans the class variables
2693
+ When a class is created, :meth: `! type.__new__ ` scans the class variables
2689
2694
and makes callbacks to those with a :meth: `~object.__set_name__ ` hook.
2690
2695
2691
2696
.. method :: object.__set_name__(self, owner, name)
0 commit comments