PEP 675: Add explicit `circumference` method (#2618)

Not adding a `radius` attribute, because the Circle class needs to be
instantiable from just the `scale` config value. So, I'm going with a
method.
This commit is contained in:
Pradeep Kumar 2022-05-23 06:26:25 -07:00 committed by GitHub
parent 5df9e7c829
commit 2b791d84e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -227,7 +227,8 @@ value of type ``Shape``, when in fact it should be ``Circle``:
::
class Circle(Shape): ...
class Circle(Shape):
def circumference(self) -> float: ...
shape = Shape.from_config({"scale": 7.0})
# => Shape