Skip to content

Commit d2cc2a7

Browse files
Google Python teamgpshead
authored andcommitted
Project import generated by Copybara.
PiperOrigin-RevId: 522150370
1 parent 8042238 commit d2cc2a7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pyguide.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ Module names can still collide. Some module names are inconveniently long.
251251
* Use `import x` for importing packages and modules.
252252
* Use `from x import y` where `x` is the package prefix and `y` is the module
253253
name with no prefix.
254-
* Use `from x import y as z` if two modules named `y` are to be imported, if
255-
`y` conflicts with a top-level name defined in the current module, or if `y`
256-
is an inconveniently long name.
254+
* Use `from x import y as z` in any of the following circumstances:
255+
- Two modules named `y` are to be imported.
256+
- `y` conflicts with a top-level name defined in the current module.
257+
- `y` conflicts with a common parameter name that is part of the public
258+
API (e.g., `features`).
259+
- `y` is an inconveniently long name.
257260
* Use `import y as z` only when `z` is a standard abbreviation (e.g., `np` for
258261
`numpy`).
259262

@@ -1660,7 +1663,7 @@ Make note of the indentation of the elements in the line continuation examples
16601663
above; see the [indentation](#s3.4-indentation) section for explanation.
16611664
16621665
In all other cases where a line exceeds 80 characters, and the
1663-
[yapf](https://github.com/google/yapf/)
1666+
[Black](https://github.com/psf/black) or [Pyink](https://github.com/google/pyink)
16641667
auto-formatter does not help bring the line below the limit, the line is allowed
16651668
to exceed this maximum. Authors are encouraged to manually break the line up per
16661669
the notes above when it is sensible.
@@ -3152,6 +3155,8 @@ CapWorded. If the alias is used only in this module, it should be \_Private.
31523155
Note that the `: TypeAlias` annotation is only supported in versions 3.10+.
31533156
31543157
```python
3158+
from typing import TypeAlias
3159+
31553160
_LossAndGradient: TypeAlias = tuple[tf.Tensor, tf.Tensor]
31563161
ComplexTFMap: TypeAlias = Mapping[str, _LossAndGradient]
31573162
```

0 commit comments

Comments
 (0)