Commits

Anonymous committed 0879efc Draft

Replace subscription with slashing

  • Participants
  • Parent commits 05bc7c4

Comments (0)

Files changed (1)

File pep-0428.txt

 Joining
 ^^^^^^^
 
-A path can be joined with another using the ``__getitem__`` operator::
+A path can be joined with another using the ``/`` operator::
 
     >>> p = PurePosixPath('foo')
-    >>> p['bar']
+    >>> p / 'bar'
     PurePosixPath('foo/bar')
-    >>> p[PurePosixPath('bar')]
+    >>> p / PurePosixPath('bar')
     PurePosixPath('foo/bar')
+    >>> 'bar' / p
+    PurePosixPath('bar/foo')
 
 As with the constructor, multiple path components can be specified, either
 collapsed or separately::
 
-    >>> p['bar/xyzzy']
+    >>> p / 'bar/xyzzy'
     PurePosixPath('foo/bar/xyzzy')
-    >>> p['bar', 'xyzzy']
+    >>> p / 'bar' / 'xyzzy'
     PurePosixPath('foo/bar/xyzzy')
 
 A joinpath() method is also provided, with the same behaviour.  It can serve