mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)
This commit is contained in:
parent
4a686504eb
commit
2085bd0877
34 changed files with 126 additions and 261 deletions
|
@ -56,7 +56,7 @@ You can create custom local objects by subclassing the local class:
|
|||
|
||||
>>> class MyLocal(local):
|
||||
... number = 2
|
||||
... def __init__(self, **kw):
|
||||
... def __init__(self, /, **kw):
|
||||
... self.__dict__.update(kw)
|
||||
... def squared(self):
|
||||
... return self.number ** 2
|
||||
|
@ -204,7 +204,7 @@ def _patch(self):
|
|||
class local:
|
||||
__slots__ = '_local__impl', '__dict__'
|
||||
|
||||
def __new__(cls, *args, **kw):
|
||||
def __new__(cls, /, *args, **kw):
|
||||
if (args or kw) and (cls.__init__ is object.__init__):
|
||||
raise TypeError("Initialization arguments are not supported")
|
||||
self = object.__new__(cls)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue