Skip to content
This repository was archived by the owner on Nov 21, 2022. It is now read-only.

Commit 4427bc1

Browse files
committed
Explicitly disallow loading '_'
See #73
1 parent ff3170a commit 4427bc1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pep-9999.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,16 @@ considered a reference::
306306
case BLACK: # This will just assign a new value to BLACK.
307307
...
308308

309-
Note: the leading dot can be omitted if the name is already dotted, but
309+
The leading dot can be omitted if the name is already dotted, but
310310
adding it is not prohibited, so ``.Color.BLACK`` is same as ``Color.BLACK``.
311311
See `rejected ideas`_ for other syntactic alternatives that were considered
312312
for constant value pattern.
313313

314+
The initial name must not be ``_``, so these are invalid::
315+
316+
case ._: ...
317+
case _.a: ...
318+
314319

315320
.. _sequence_pattern:
316321

@@ -402,7 +407,10 @@ If the method returns ``None``, the match fails, otherwise the
402407
match continues w.r.t. attributes of the returned proxy object, see details
403408
in `runtime`_ section.
404409

405-
The named class must inherit from ``type``.
410+
The named class must inherit from ``type``. It may be a single name
411+
or a dotted name (e.g. ``some_mod.SomeClass`` or ``mod.pkg.Class``).
412+
The leading name must not be ``_``, so e.g. ``_(...)`` and
413+
``_.C(...)`` are invalid.
406414

407415
This PEP only fully specifies the behavior of ``__match__()`` for ``object``
408416
and some builtin and standard library classes, custom classes are only

0 commit comments

Comments
 (0)